summaryrefslogtreecommitdiff
path: root/test/ar
diff options
context:
space:
mode:
Diffstat (limited to 'test/ar')
-rwxr-xr-xtest/ar/func.sh4
-rw-r--r--test/ar/tc/add-nonexistent/add-nonexistent.err1
-rw-r--r--test/ar/tc/add-nonexistent/add-nonexistent.eval1
-rw-r--r--test/ar/tc/add-nonexistent/add-nonexistent.out0
-rwxr-xr-xtest/ar/tc/add-nonexistent/add-nonexistent.sh4
-rw-r--r--test/ar/tc/addself-liba/addself-liba.eval2
-rw-r--r--test/ar/tc/extract-nonexistent/extract-nonexistent.err1
-rw-r--r--test/ar/tc/extract-nonexistent/extract-nonexistent.eval1
-rw-r--r--test/ar/tc/extract-nonexistent/extract-nonexistent.out0
-rwxr-xr-xtest/ar/tc/extract-nonexistent/extract-nonexistent.sh6
-rw-r--r--test/ar/tc/extract-nonexistent/in/valid.shar55
-rw-r--r--test/ar/tc/extract-nonexistent/out/valid.shar55
-rw-r--r--test/ar/tc/extract-nonleaf/extract-nonleaf.err1
-rw-r--r--test/ar/tc/extract-nonleaf/extract-nonleaf.eval1
-rw-r--r--test/ar/tc/extract-nonleaf/extract-nonleaf.out1
-rwxr-xr-xtest/ar/tc/extract-nonleaf/extract-nonleaf.sh6
-rw-r--r--test/ar/tc/extract-nonleaf/in/invalid.shar54
-rw-r--r--test/ar/tc/extract-nonleaf/out/invalid.shar54
-rw-r--r--test/ar/tc/extract-nonleaf/out/s11
-rw-r--r--test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.err1
-rw-r--r--test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.eval1
-rw-r--r--test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.out0
-rwxr-xr-xtest/ar/tc/ranlib-missing-archive/ranlib-missing-archive.sh7
23 files changed, 254 insertions, 3 deletions
diff --git a/test/ar/func.sh b/test/ar/func.sh
index 635e799ec690..2c31a76dc12a 100755
--- a/test/ar/func.sh
+++ b/test/ar/func.sh
@@ -1,4 +1,4 @@
-# $Id: func.sh 2080 2011-10-27 04:23:24Z jkoshy $
+# $Id: func.sh 3626 2018-09-29 19:26:57Z jkoshy $
# `init' initializes test engine global data.
#
init() {
@@ -72,7 +72,7 @@ udecode() {
fi
cd $1 || exit 1
- find . -type f -execdir uudecode {} \;
+ find . -type f -a -name '*.uu' -execdir uudecode {} \;
find . -type f -name '*.uu' -delete
}
diff --git a/test/ar/tc/add-nonexistent/add-nonexistent.err b/test/ar/tc/add-nonexistent/add-nonexistent.err
new file mode 100644
index 000000000000..852a7613acf1
--- /dev/null
+++ b/test/ar/tc/add-nonexistent/add-nonexistent.err
@@ -0,0 +1 @@
+ar: warning: can't open file: nonexistent: No such file or directory
diff --git a/test/ar/tc/add-nonexistent/add-nonexistent.eval b/test/ar/tc/add-nonexistent/add-nonexistent.eval
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/test/ar/tc/add-nonexistent/add-nonexistent.eval
@@ -0,0 +1 @@
+1
diff --git a/test/ar/tc/add-nonexistent/add-nonexistent.out b/test/ar/tc/add-nonexistent/add-nonexistent.out
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/ar/tc/add-nonexistent/add-nonexistent.out
diff --git a/test/ar/tc/add-nonexistent/add-nonexistent.sh b/test/ar/tc/add-nonexistent/add-nonexistent.sh
new file mode 100755
index 000000000000..7918ee5bef83
--- /dev/null
+++ b/test/ar/tc/add-nonexistent/add-nonexistent.sh
@@ -0,0 +1,4 @@
+# $Id$
+inittest add-nonexistent tc/add-nonexistent
+runcmd "${AR} rc archive.a nonexistent" work true
+rundiff true
diff --git a/test/ar/tc/addself-liba/addself-liba.eval b/test/ar/tc/addself-liba/addself-liba.eval
index 573541ac9702..d00491fd7e5b 100644
--- a/test/ar/tc/addself-liba/addself-liba.eval
+++ b/test/ar/tc/addself-liba/addself-liba.eval
@@ -1 +1 @@
-0
+1
diff --git a/test/ar/tc/extract-nonexistent/extract-nonexistent.err b/test/ar/tc/extract-nonexistent/extract-nonexistent.err
new file mode 100644
index 000000000000..c19434648514
--- /dev/null
+++ b/test/ar/tc/extract-nonexistent/extract-nonexistent.err
@@ -0,0 +1 @@
+ar: warning: nonexistent: not found in archive
diff --git a/test/ar/tc/extract-nonexistent/extract-nonexistent.eval b/test/ar/tc/extract-nonexistent/extract-nonexistent.eval
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/test/ar/tc/extract-nonexistent/extract-nonexistent.eval
@@ -0,0 +1 @@
+1
diff --git a/test/ar/tc/extract-nonexistent/extract-nonexistent.out b/test/ar/tc/extract-nonexistent/extract-nonexistent.out
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/ar/tc/extract-nonexistent/extract-nonexistent.out
diff --git a/test/ar/tc/extract-nonexistent/extract-nonexistent.sh b/test/ar/tc/extract-nonexistent/extract-nonexistent.sh
new file mode 100755
index 000000000000..ff6aa408891e
--- /dev/null
+++ b/test/ar/tc/extract-nonexistent/extract-nonexistent.sh
@@ -0,0 +1,6 @@
+# $Id$
+inittest extract-nonexistent tc/extract-nonexistent
+extshar ${TESTDIR}
+extshar ${RLTDIR}
+runcmd "${AR} xv valid.a nonexistent" work true
+rundiff true
diff --git a/test/ar/tc/extract-nonexistent/in/valid.shar b/test/ar/tc/extract-nonexistent/in/valid.shar
new file mode 100644
index 000000000000..b5a569ea5c5e
--- /dev/null
+++ b/test/ar/tc/extract-nonexistent/in/valid.shar
@@ -0,0 +1,55 @@
+#!/bin/sh
+# This is a shell archive (produced by GNU sharutils 4.15.2).
+# To extract the files from this archive, save it to some FILE, remove
+# everything before the '#!/bin/sh' line above, then type 'sh FILE'.
+#
+lock_dir=_sh05539
+# Made on 2018-09-30 19:46 BST by <jkoshy@erebor>.
+# Source directory was '/home/jkoshy/Work/Elftoolchain/trunk/test/ar/tc/extract-nonexistent/in'.
+#
+# Existing files will *not* be overwritten, unless '-c' is specified.
+#
+# This shar contains:
+# length mode name
+# ------ ---------- ------------------------------------------
+# 80 -rw-rw-r-- valid.a
+#
+if test "X$1" = "X-c"
+then keep_file=''
+else keep_file=true
+fi
+echo=echo
+shar_tty=
+shar_n=
+shar_c='\n'
+if test ! -d ${lock_dir} ; then :
+else ${echo} "lock directory ${lock_dir} exists"
+ exit 1
+fi
+if mkdir ${lock_dir} ; then :
+else ${echo} "failed to create ${lock_dir} lock directory"
+ exit 1
+fi
+# ============= valid.a ==============
+if test -n "${keep_file}" && test -f 'valid.a'
+then
+${echo} "x - SKIPPING valid.a (file already exists)"
+
+else
+${echo} "x - extracting valid.a (text)"
+ sed 's/^X//' << 'SHAR_EOF' > 'valid.a' &&
+X!<arch>
+Xs1/ 0 0 0 644 12 `
+Xs1-contents
+SHAR_EOF
+:
+if test $? -ne 0
+then ${echo} "restore of valid.a failed"
+fi
+fi
+if rm -fr ${lock_dir}
+then ${echo} "x - removed lock directory ${lock_dir}."
+else ${echo} "x - failed to remove lock directory ${lock_dir}."
+ exit 1
+fi
+exit 0
diff --git a/test/ar/tc/extract-nonexistent/out/valid.shar b/test/ar/tc/extract-nonexistent/out/valid.shar
new file mode 100644
index 000000000000..b5a569ea5c5e
--- /dev/null
+++ b/test/ar/tc/extract-nonexistent/out/valid.shar
@@ -0,0 +1,55 @@
+#!/bin/sh
+# This is a shell archive (produced by GNU sharutils 4.15.2).
+# To extract the files from this archive, save it to some FILE, remove
+# everything before the '#!/bin/sh' line above, then type 'sh FILE'.
+#
+lock_dir=_sh05539
+# Made on 2018-09-30 19:46 BST by <jkoshy@erebor>.
+# Source directory was '/home/jkoshy/Work/Elftoolchain/trunk/test/ar/tc/extract-nonexistent/in'.
+#
+# Existing files will *not* be overwritten, unless '-c' is specified.
+#
+# This shar contains:
+# length mode name
+# ------ ---------- ------------------------------------------
+# 80 -rw-rw-r-- valid.a
+#
+if test "X$1" = "X-c"
+then keep_file=''
+else keep_file=true
+fi
+echo=echo
+shar_tty=
+shar_n=
+shar_c='\n'
+if test ! -d ${lock_dir} ; then :
+else ${echo} "lock directory ${lock_dir} exists"
+ exit 1
+fi
+if mkdir ${lock_dir} ; then :
+else ${echo} "failed to create ${lock_dir} lock directory"
+ exit 1
+fi
+# ============= valid.a ==============
+if test -n "${keep_file}" && test -f 'valid.a'
+then
+${echo} "x - SKIPPING valid.a (file already exists)"
+
+else
+${echo} "x - extracting valid.a (text)"
+ sed 's/^X//' << 'SHAR_EOF' > 'valid.a' &&
+X!<arch>
+Xs1/ 0 0 0 644 12 `
+Xs1-contents
+SHAR_EOF
+:
+if test $? -ne 0
+then ${echo} "restore of valid.a failed"
+fi
+fi
+if rm -fr ${lock_dir}
+then ${echo} "x - removed lock directory ${lock_dir}."
+else ${echo} "x - failed to remove lock directory ${lock_dir}."
+ exit 1
+fi
+exit 0
diff --git a/test/ar/tc/extract-nonleaf/extract-nonleaf.err b/test/ar/tc/extract-nonleaf/extract-nonleaf.err
new file mode 100644
index 000000000000..4d22e623f489
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/extract-nonleaf.err
@@ -0,0 +1 @@
+ar: warning: ignoring entry: a/s1
diff --git a/test/ar/tc/extract-nonleaf/extract-nonleaf.eval b/test/ar/tc/extract-nonleaf/extract-nonleaf.eval
new file mode 100644
index 000000000000..573541ac9702
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/extract-nonleaf.eval
@@ -0,0 +1 @@
+0
diff --git a/test/ar/tc/extract-nonleaf/extract-nonleaf.out b/test/ar/tc/extract-nonleaf/extract-nonleaf.out
new file mode 100644
index 000000000000..d4fb851ef13d
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/extract-nonleaf.out
@@ -0,0 +1 @@
+x - s1
diff --git a/test/ar/tc/extract-nonleaf/extract-nonleaf.sh b/test/ar/tc/extract-nonleaf/extract-nonleaf.sh
new file mode 100755
index 000000000000..671833867f35
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/extract-nonleaf.sh
@@ -0,0 +1,6 @@
+# $Id$
+inittest extract-nonleaf tc/extract-nonleaf
+extshar ${TESTDIR}
+extshar ${RLTDIR}
+runcmd "${AR} xv invalid.a" work true
+rundiff true
diff --git a/test/ar/tc/extract-nonleaf/in/invalid.shar b/test/ar/tc/extract-nonleaf/in/invalid.shar
new file mode 100644
index 000000000000..7e718a8192fc
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/in/invalid.shar
@@ -0,0 +1,54 @@
+#!/bin/sh
+# This is invalid, a shell archive (produced by GNU sharutils 4.15.2).
+# To extract the files from this archive, save it to some FILE, remove
+# everything before the '#!/bin/sh' line above, then type 'sh FILE'.
+#
+lock_dir=_sh29263
+# Existing files will *not* be overwritten, unless '-c' is specified.
+#
+# This shar contains:
+# length mode name
+# ------ ---------- ------------------------------------------
+# 152 -rw-rw-r-- invalid.a
+#
+if test "X$1" = "X-c"
+then keep_file=''
+else keep_file=true
+fi
+echo=echo
+shar_tty=
+shar_n=
+shar_c='\n'
+if test ! -d ${lock_dir} ; then :
+else ${echo} "lock directory ${lock_dir} exists"
+ exit 1
+fi
+if mkdir ${lock_dir} ; then :
+else ${echo} "failed to create ${lock_dir} lock directory"
+ exit 1
+fi
+# ============= invalid.a ==============
+if test -n "${keep_file}" && test -f 'invalid.a'
+then
+${echo} "x - SKIPPING invalid.a (file already exists)"
+
+else
+${echo} "x - extracting invalid.a (text)"
+ sed 's/^X//' << 'SHAR_EOF' > 'invalid.a' &&
+X!<arch>
+Xa/s1/ 0 0 0 644 12 `
+Xs1-contents
+Xs1/ 0 0 0 644 12 `
+Xs1-contents
+SHAR_EOF
+:
+if test $? -ne 0
+then ${echo} "restore of invalid.a failed"
+fi
+fi
+if rm -fr ${lock_dir}
+then ${echo} "x - removed lock directory ${lock_dir}."
+else ${echo} "x - failed to remove lock directory ${lock_dir}."
+ exit 1
+fi
+exit 0
diff --git a/test/ar/tc/extract-nonleaf/out/invalid.shar b/test/ar/tc/extract-nonleaf/out/invalid.shar
new file mode 100644
index 000000000000..7e718a8192fc
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/out/invalid.shar
@@ -0,0 +1,54 @@
+#!/bin/sh
+# This is invalid, a shell archive (produced by GNU sharutils 4.15.2).
+# To extract the files from this archive, save it to some FILE, remove
+# everything before the '#!/bin/sh' line above, then type 'sh FILE'.
+#
+lock_dir=_sh29263
+# Existing files will *not* be overwritten, unless '-c' is specified.
+#
+# This shar contains:
+# length mode name
+# ------ ---------- ------------------------------------------
+# 152 -rw-rw-r-- invalid.a
+#
+if test "X$1" = "X-c"
+then keep_file=''
+else keep_file=true
+fi
+echo=echo
+shar_tty=
+shar_n=
+shar_c='\n'
+if test ! -d ${lock_dir} ; then :
+else ${echo} "lock directory ${lock_dir} exists"
+ exit 1
+fi
+if mkdir ${lock_dir} ; then :
+else ${echo} "failed to create ${lock_dir} lock directory"
+ exit 1
+fi
+# ============= invalid.a ==============
+if test -n "${keep_file}" && test -f 'invalid.a'
+then
+${echo} "x - SKIPPING invalid.a (file already exists)"
+
+else
+${echo} "x - extracting invalid.a (text)"
+ sed 's/^X//' << 'SHAR_EOF' > 'invalid.a' &&
+X!<arch>
+Xa/s1/ 0 0 0 644 12 `
+Xs1-contents
+Xs1/ 0 0 0 644 12 `
+Xs1-contents
+SHAR_EOF
+:
+if test $? -ne 0
+then ${echo} "restore of invalid.a failed"
+fi
+fi
+if rm -fr ${lock_dir}
+then ${echo} "x - removed lock directory ${lock_dir}."
+else ${echo} "x - failed to remove lock directory ${lock_dir}."
+ exit 1
+fi
+exit 0
diff --git a/test/ar/tc/extract-nonleaf/out/s1 b/test/ar/tc/extract-nonleaf/out/s1
new file mode 100644
index 000000000000..c77eb94df2df
--- /dev/null
+++ b/test/ar/tc/extract-nonleaf/out/s1
@@ -0,0 +1 @@
+s1-contents
diff --git a/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.err b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.err
new file mode 100644
index 000000000000..7e22663fb0c7
--- /dev/null
+++ b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.err
@@ -0,0 +1 @@
+ranlib: warning: nonexistent.a: no such file
diff --git a/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.eval b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.eval
new file mode 100644
index 000000000000..d00491fd7e5b
--- /dev/null
+++ b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.eval
@@ -0,0 +1 @@
+1
diff --git a/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.out b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.out
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.out
diff --git a/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.sh b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.sh
new file mode 100755
index 000000000000..3a35ce3576d6
--- /dev/null
+++ b/test/ar/tc/ranlib-missing-archive/ranlib-missing-archive.sh
@@ -0,0 +1,7 @@
+# $Id$
+#
+# Verify that 'ranlib' exits with an error if asked to operate on a
+# non-existent archive.
+inittest ranlib-missing-archive tc/ranlib-missing-archive
+runcmd "${RANLIB} nonexistent.a" work true
+rundiff true