summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/a-plus-b.a6
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/a.txt1
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/b.txt1
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/c.txt1
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/d.txt1
-rw-r--r--llvm/test/tools/llvm-ar/Inputs/nested-thin-archive.a7
-rw-r--r--llvm/test/tools/llvm-ar/flatten-thin-archive-recursive.test13
-rw-r--r--llvm/test/tools/llvm-ar/flatten-thin-archive.test18
8 files changed, 48 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-ar/Inputs/a-plus-b.a b/llvm/test/tools/llvm-ar/Inputs/a-plus-b.a
new file mode 100644
index 00000000000..a58406edbfb
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/a-plus-b.a
@@ -0,0 +1,6 @@
+!<thin>
+// 14 `
+a.txt/
+b.txt/
+/0 0 0 0 644 11 `
+/7 0 0 0 644 11 `
diff --git a/llvm/test/tools/llvm-ar/Inputs/a.txt b/llvm/test/tools/llvm-ar/Inputs/a.txt
new file mode 100644
index 00000000000..12d91b61779
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/a.txt
@@ -0,0 +1 @@
+a-contents
diff --git a/llvm/test/tools/llvm-ar/Inputs/b.txt b/llvm/test/tools/llvm-ar/Inputs/b.txt
new file mode 100644
index 00000000000..aee476f3937
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/b.txt
@@ -0,0 +1 @@
+b-contents
diff --git a/llvm/test/tools/llvm-ar/Inputs/c.txt b/llvm/test/tools/llvm-ar/Inputs/c.txt
new file mode 100644
index 00000000000..a80e36bc3f0
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/c.txt
@@ -0,0 +1 @@
+c-contents
diff --git a/llvm/test/tools/llvm-ar/Inputs/d.txt b/llvm/test/tools/llvm-ar/Inputs/d.txt
new file mode 100644
index 00000000000..20d7aa0cf37
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/d.txt
@@ -0,0 +1 @@
+d-contents
diff --git a/llvm/test/tools/llvm-ar/Inputs/nested-thin-archive.a b/llvm/test/tools/llvm-ar/Inputs/nested-thin-archive.a
new file mode 100644
index 00000000000..312e8de8876
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/Inputs/nested-thin-archive.a
@@ -0,0 +1,7 @@
+!<thin>
+// 20 `
+a-plus-b.a/
+c.txt/
+
+/0 0 0 0 644 202 `
+/12 0 0 0 644 11 `
diff --git a/llvm/test/tools/llvm-ar/flatten-thin-archive-recursive.test b/llvm/test/tools/llvm-ar/flatten-thin-archive-recursive.test
new file mode 100644
index 00000000000..fdd752d48b2
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/flatten-thin-archive-recursive.test
@@ -0,0 +1,13 @@
+# Since llvm-ar cannot create thin archives that contain any thin archives,
+# nested-thin-archive.a is a manually constructed thin archive that contains
+# another (unflattened) thin archive.
+# This test ensures that flat archives are recursively flattened.
+
+RUN: rm -f %t.a
+RUN: llvm-ar rcsT %t.a %S/Inputs/nested-thin-archive.a %S/Inputs/d.txt
+RUN: llvm-ar t %t.a | FileCheck %s
+
+CHECK: a.txt
+CHECK-NEXT: b.txt
+CHECK-NEXT: c.txt
+CHECK-NEXT: d.txt
diff --git a/llvm/test/tools/llvm-ar/flatten-thin-archive.test b/llvm/test/tools/llvm-ar/flatten-thin-archive.test
new file mode 100644
index 00000000000..430f48fe7c4
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/flatten-thin-archive.test
@@ -0,0 +1,18 @@
+# This test creates a thin archive that contains a thin archive, a regular
+# archive, and a file.
+#
+# The inner thin archive should be flattened, but the regular archive should
+# not. The order of members in the archive should match the input order, with
+# flattened members appearing together.
+
+RUN: touch %t-a.txt %t-b.txt %t-c.txt %t-d.txt %t-e.txt
+RUN: rm -f %t-a-plus-b.a %t.a
+RUN: llvm-ar rcsT %t-a-plus-b.a %t-a.txt %t-b.txt
+RUN: llvm-ar rcs %t-d-plus-e.a %t-d.txt %t-e.txt
+RUN: llvm-ar rcsT %t.a %t-a-plus-b.a %t-c.txt %t-d-plus-e.a
+RUN: llvm-ar t %t.a | FileCheck %s
+
+CHECK: a.txt
+CHECK-NEXT: b.txt
+CHECK-NEXT: c.txt
+CHECK-NEXT: -d-plus-e.a
OpenPOWER on IntegriCloud