summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rw-r--r--tests/Makefile.am4
-rwxr-xr-xtests/run-ar.sh40
3 files changed, 48 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 0d5bee75..7b6bf304 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-10 Mark Wielaard <[email protected]>
+
+ * run-ar.sh: New test.
+ * Makefile.am (TESTS): Add run-ar.sh.
+ (EXTRA_DIST): Likewise.
+
2017-08-18 Ulf Hermann <[email protected]>
* Makefile.am: Drop -rdynamic from deleted_lib_so_LDFLAGS.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2eac8020..e5835046 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -72,7 +72,7 @@ backtrace-child-biarch$(EXEEXT): backtrace-child.c
$(AM_LDFLAGS) $(LDFLAGS) $(backtrace_child_LDFLAGS) \
-o $@ $<
-TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
+TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
update1 update2 update3 update4 \
run-show-die-info.sh run-get-files.sh run-get-lines.sh \
run-get-pubnames.sh run-get-aranges.sh run-allfcts.sh \
@@ -159,7 +159,7 @@ check_PROGRAMS += $(asm_TESTS)
TESTS += $(asm_TESTS) run-disasm-bpf.sh
endif
-EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
+EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
run-show-die-info.sh run-get-files.sh run-get-lines.sh \
run-get-pubnames.sh run-get-aranges.sh \
run-show-abbrev.sh run-strip-test.sh \
diff --git a/tests/run-ar.sh b/tests/run-ar.sh
new file mode 100755
index 00000000..fb9394d5
--- /dev/null
+++ b/tests/run-ar.sh
@@ -0,0 +1,40 @@
+#! /bin/bash
+# Copyright (C) 2017 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+tempfiles objects.list test.ar
+
+echo Make a sorted list of the just build src .o files.
+(cd ${abs_top_builddir}/src; ls *.o | sort) > objects.list
+cat objects.list
+
+echo Create a new ar file with the .o files.
+testrun ${abs_top_builddir}/src/ar -r test.ar \
+ $(echo ${abs_top_builddir}/src/*.o | sort)
+
+echo List the ar file contents.
+testrun_compare ${abs_top_builddir}/src/ar -t test.ar < objects.list
+
+echo Delete all objects again.
+testrun ${abs_top_builddir}/src/ar -d test.ar $(cat objects.list)
+
+echo Check new ar file is now empty
+testrun_compare ${abs_top_builddir}/src/ar -t test.ar << EOF
+EOF
+
+exit 0