[llvm] 9e4d2b1 - [llvm-ar] Add some test-cases for empty archives

Ben Dunbobbin via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 02:35:58 PDT 2021


Author: Ben Dunbobbin
Date: 2021-08-10T10:34:50+01:00
New Revision: 9e4d2b193a0b0a21a835886d3eed2205a5194f37

URL: https://github.com/llvm/llvm-project/commit/9e4d2b193a0b0a21a835886d3eed2205a5194f37
DIFF: https://github.com/llvm/llvm-project/commit/9e4d2b193a0b0a21a835886d3eed2205a5194f37.diff

LOG: [llvm-ar] Add some test-cases for empty archives

We had coverage of empty archive in our downstream testsuite.
This adds those cases upstream.

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

Added: 
    llvm/test/tools/llvm-ar/display-empty.test

Modified: 
    llvm/test/tools/llvm-ar/print.test

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-ar/display-empty.test b/llvm/test/tools/llvm-ar/display-empty.test
new file mode 100644
index 0000000000000..22310c8db18bf
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/display-empty.test
@@ -0,0 +1,11 @@
+## Test Display of empty archives.
+
+# RUN: rm -rf %t && mkdir -p %t
+
+## Display empty archive:
+# RUN: llvm-ar cr %t/empty.a
+# RUN: llvm-ar tv %t/empty.a 2>&1 | count 0
+
+## Display empty thin archive:
+# RUN: llvm-ar Trc %t/thin-archive-empty.a
+# RUN: llvm-ar tv %t/thin-archive-empty.a 2>&1 | count 0

diff  --git a/llvm/test/tools/llvm-ar/print.test b/llvm/test/tools/llvm-ar/print.test
index 4c6d8fda9956e..ba7b5259b038c 100644
--- a/llvm/test/tools/llvm-ar/print.test
+++ b/llvm/test/tools/llvm-ar/print.test
@@ -8,6 +8,11 @@
 
 # RUN: llvm-ar -rc %t/archive.a %t/1.txt %t/2.txt %t/3.txt
 
+## Print empty archive:
+# RUN: llvm-ar cr %t/empty.a
+# RUN: llvm-ar p %t/empty.a 2>&1 | count 0
+# RUN: llvm-ar pv %t/empty.a 2>&1 | count 0
+
 ## Print without member:
 # RUN: llvm-ar p %t/archive.a \
 # RUN:   | FileCheck %s --check-prefix=WITHOUT --match-full-lines --implicit-check-not {{.}}
@@ -83,6 +88,11 @@
 
 # MISSING-FILE: error: '[[FILE]]' was not found
 
+## Print empty thin archive:
+# RUN: llvm-ar Trc %t/thin-archive-empty.a
+# RUN: llvm-ar p %t/thin-archive-empty.a 2>&1 | count 0
+# RUN: llvm-ar pv %t/thin-archive-empty.a 2>&1 | count 0
+
 ## Print thin archive:
 # RUN: llvm-ar Trc %t/thin-archive.a %t/1.txt %t/2.txt %t/3.txt
 # RUN: llvm-ar p %t/archive.a %t/2.txt \


        


More information about the llvm-commits mailing list