[llvm] r366334 - [llvm-ar][test] Add tests failing on Darwin

Owen Reynolds via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 08:10:02 PDT 2019


Author: gbreynoo
Date: Wed Jul 17 08:10:02 2019
New Revision: 366334

URL: http://llvm.org/viewvc/llvm-project?rev=366334&view=rev
Log:
[llvm-ar][test] Add tests failing on Darwin

These tests that failed on Darwin but passed on other machines due to the default archive format differing
on a Darwin machine, and what looks to be bugs in the output of this format.
I can not investigate these issue further so the tests are considered expected failures on Darwin.

Differential Revision: https://reviews.llvm.org/D64802

Added:
    llvm/trunk/test/tools/llvm-ar/extract.test
    llvm/trunk/test/tools/llvm-ar/mri-utf8.test
    llvm/trunk/test/tools/llvm-ar/print.test

Added: llvm/trunk/test/tools/llvm-ar/extract.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/extract.test?rev=366334&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-ar/extract.test (added)
+++ llvm/trunk/test/tools/llvm-ar/extract.test Wed Jul 17 08:10:02 2019
@@ -0,0 +1,22 @@
+## Test extract operation.
+# XFAIL: darwin
+
+RUN: rm -rf %t && mkdir -p %t/extracted/
+
+# Extracting from an empty archive should not warn or error:
+RUN: llvm-ar cr %t/empty.a
+RUN: llvm-ar x %t/empty.a 2>&1 | count 0
+
+RUN: echo filea > %t/a.txt
+RUN: echo fileb > %t/b.txt
+RUN: llvm-ar rc %t/archive.a %t/a.txt %t/b.txt
+
+# Single member:
+RUN: cd %t/extracted && llvm-ar x %t/archive.a a.txt
+RUN: diff %t/a.txt %t/extracted/a.txt 
+
+# All members:
+RUN: rm %t/extracted/a.txt
+RUN: cd %t/extracted && llvm-ar x %t/archive.a
+RUN: diff %t/a.txt %t/extracted/a.txt 
+RUN: diff %t/b.txt %t/extracted/b.txt 

Added: llvm/trunk/test/tools/llvm-ar/mri-utf8.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/mri-utf8.test?rev=366334&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-ar/mri-utf8.test (added)
+++ llvm/trunk/test/tools/llvm-ar/mri-utf8.test Wed Jul 17 08:10:02 2019
@@ -0,0 +1,19 @@
+# Test non-ascii archive members
+# XFAIL: darwin
+
+RUN: rm -rf %t && mkdir -p %t/extracted
+
+RUN: echo "contents" > %t/£.txt
+
+RUN: echo "CREATE %t/mri.ar" > %t/script.mri
+RUN: echo "ADDMOD %t/£.txt" >> %t/script.mri
+RUN: echo "SAVE" >> %t/script.mri
+
+RUN: llvm-ar -M < %t/script.mri
+RUN: cd %t/extracted && llvm-ar x %t/mri.ar
+
+# This works around problems launching processess that
+# include arguments with non-ascii characters.
+# Python on Linux defaults to ASCII encoding unless the
+# environment specifies otherwise, so it is explicitly set.
+RUN: env LANG=en_US.UTF-8 %python -c "assert open(u'\U000000A3.txt', 'rb').read() == b'contents\n'"

Added: llvm/trunk/test/tools/llvm-ar/print.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-ar/print.test?rev=366334&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-ar/print.test (added)
+++ llvm/trunk/test/tools/llvm-ar/print.test Wed Jul 17 08:10:02 2019
@@ -0,0 +1,84 @@
+## Test Print output
+# XFAIL: darwin
+
+RUN: rm -rf %t && mkdir -p %t
+RUN: echo file1 > %t/1.txt
+RUN: echo file2 > %t/2.txt
+RUN: echo file3 > %t/3.txt
+
+RUN: llvm-ar -rc %t/archive.a %t/1.txt %t/2.txt %t/3.txt
+
+# Print without member:
+RUN: llvm-ar p %t/archive.a \
+RUN:   | FileCheck %s --check-prefix=WITHOUT --match-full-lines --implicit-check-not {{.}}
+
+WITHOUT:      file1
+WITHOUT-NEXT: file2
+WITHOUT-NEXT: file3
+
+RUN: llvm-ar pv %t/archive.a \
+RUN:   | FileCheck %s --check-prefix=WITHOUT-VERBOSE --match-full-lines --implicit-check-not {{.}}
+
+WITHOUT-VERBOSE:      Printing 1.txt
+WITHOUT-VERBOSE-NEXT: file1
+WITHOUT-VERBOSE-NEXT: Printing 2.txt
+WITHOUT-VERBOSE-NEXT: file2
+WITHOUT-VERBOSE-NEXT: Printing 3.txt
+WITHOUT-VERBOSE-NEXT: file3
+
+# Print single member:
+RUN: llvm-ar p %t/archive.a %t/2.txt  \
+RUN:   | FileCheck %s --check-prefix=SINGLE --match-full-lines --implicit-check-not {{.}}
+
+SINGLE: file2
+
+RUN: llvm-ar pv %t/archive.a %t/2.txt  \
+RUN:   | FileCheck %s --check-prefix=SINGLE-VERBOSE --match-full-lines --implicit-check-not {{.}}
+
+SINGLE-VERBOSE:      Printing 2.txt
+SINGLE-VERBOSE-NEXT: file2
+
+# Print multiple members:
+RUN: llvm-ar p %t/archive.a %t/2.txt %t/1.txt \
+RUN:   | FileCheck %s --check-prefix=MULTIPLE --match-full-lines --implicit-check-not {{.}}
+
+MULTIPLE:      file1
+MULTIPLE-NEXT: file2
+
+RUN: llvm-ar pv %t/archive.a %t/2.txt %t/1.txt \
+RUN:   | FileCheck %s --check-prefix=MULTIPLE-VERBOSE --match-full-lines --implicit-check-not {{.}}
+
+MULTIPLE-VERBOSE:      Printing 1.txt
+MULTIPLE-VERBOSE-NEXT: file1
+MULTIPLE-VERBOSE-NEXT: Printing 2.txt
+MULTIPLE-VERBOSE-NEXT: file2
+
+# Print same member:
+RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \
+RUN:   | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt
+
+SAME-DAG: file2
+SAME-DAG: error: '[[FILE]]' was not found
+
+# Print same member when containing multiple members with shared name:
+llvm-ar -q %t/archive.a %t/2.txt
+RUN: not llvm-ar p %t/archive.a %t/2.txt %t/2.txt 2>&1 \
+RUN:   | FileCheck %s --check-prefix=SAME -DFILE=%t/2.txt
+
+# No archive:
+RUN: not llvm-ar p 2>&1 \
+RUN:   | FileCheck %s --check-prefix=NO-ARCHIVE
+
+NO-ARCHIVE: error: An archive name must be specified.
+
+# Archive does not exist:
+RUN: not llvm-ar p %t/missing.a 2>&1 \
+RUN:   | FileCheck %s --check-prefix=MISSING-ARCHIVE -DARCHIVE=%t/missing.a
+
+MISSING-ARCHIVE: error: error loading '[[ARCHIVE]]': {{[nN]}}o such file or directory.
+
+# Member does not exist:
+RUN: not llvm-ar p %t/archive.a %t-missing.txt 2>&1 \
+RUN:   | FileCheck %s --check-prefix=MISSING-FILE -DFILE=%t-missing.txt
+
+MISSING-FILE: error: '[[FILE]]' was not found




More information about the llvm-commits mailing list