commit c0889d3bb72e1975c8d7f4cfbb873f0dacf06004
parent 5555952a9d8391d0dc2c46a3ea2e877486d76b21
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 19 Feb 2018 17:00:52 +0000
[tests/ar] First version of the test for -p
It is known that this test has some problems.
Diffstat:
1 file changed, 65 insertions(+), 0 deletions(-)
diff --git a/tests/ar/execute/20-test-p.sh b/tests/ar/execute/20-test-p.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+exec >> test.log 2>&1
+
+
+set -e
+
+tmp1=`mktemp`
+tmp2=`mktemp`
+trap "rm -f file.a" 0 2 3
+
+echo tmp1=$tmp1 and tmp2=$tmp2
+
+############################################################################
+#print 1st member
+
+cp master.a file.a
+
+ar -p file.a file1 > $tmp1
+
+cat <<! > $tmp2
+This is the first file,
+and it should go in the
+first position in the archive.
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print 3rd member
+
+ar -p file.a file3 > $tmp1
+
+cat <<! > $tmp2
+But this other one is the second one,
+and it shouldn't go in the first position
+because it should go in the second position.
+!
+
+cmp $tmp1 $tmp2
+
+############################################################################
+#print all members
+
+ar -p file.a file1 file2 file3 >$tmp1
+
+cat <<! > $tmp2
+This is the first file,
+and it should go in the
+first position in the archive.
+But this other one is the second one,
+and it shouldn't go in the first position
+because it should go in the second position.
+and at the end, this is the last file
+that should go at the end of the file,
+thus it should go in the third position.
+!
+
+cmp $tmp1 $tmp2
+
+#and now with no members in command line
+
+ar -p file.a > $tmp1
+
+cmp $tmp1 $tmp2