[PATCH] D107471: [llvm-ar] Add some test-cases for empty archives
ben via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 4 08:39:27 PDT 2021
bd1976llvm created this revision.
bd1976llvm added reviewers: MaskRay, gbreynoo, grimar.
Herald added a subscriber: rupprecht.
bd1976llvm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
We had coverage of empty archive in our downstream testsuite.
This adds those cases upstream.
https://reviews.llvm.org/D107471
Files:
llvm/test/tools/llvm-ar/display-empty.test
llvm/test/tools/llvm-ar/extract.test
llvm/test/tools/llvm-ar/print.test
Index: llvm/test/tools/llvm-ar/print.test
===================================================================
--- llvm/test/tools/llvm-ar/print.test
+++ 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 | tee %t1.log | count 0
+# RUN: llvm-ar pv %t/thin-archive-empty.a 2>&1 | tee %t2.log | count 1
+
## 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 \
Index: llvm/test/tools/llvm-ar/extract.test
===================================================================
--- llvm/test/tools/llvm-ar/extract.test
+++ llvm/test/tools/llvm-ar/extract.test
@@ -29,6 +29,10 @@
# RUN: not llvm-ar x %t/thin-archive.a 2>&1 | FileCheck %s --check-prefix=THIN
# THIN: extracting from a thin archive is not supported
+## Extracting from an empty thin archive should not warn or error:
+# RUN: llvm-ar Tcr %t/empty-thin.a
+# RUN: llvm-ar xv %t/empty-thin.a 2>&1 | count 0
+
## No output if 'v' is not specified.
# RUN: rm a.txt b.txt
# RUN: llvm-ar x %t/archive.a 2>&1 | count 0
Index: llvm/test/tools/llvm-ar/display-empty.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-ar/display-empty.test
@@ -0,0 +1,13 @@
+## 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 t %t/empty.a 2>&1 | count 0
+# 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 t %t/thin-archive-empty.a 2>&1 | tee %t1.log | count 0
+# RUN: llvm-ar tv %t/thin-archive-empty.a 2>&1 | tee %t2.log | count 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107471.364130.patch
Type: text/x-patch
Size: 2243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210804/83005df8/attachment.bin>
More information about the llvm-commits
mailing list