public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Add hardlink-multifile.sh test-case
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

Add test-case that checks that dwz -h maintains hardlinks in multifile mode.

Committed to trunk.

Thanks,
- Tom

Add hardlink-multifile.sh test-case

2019-03-17  Tom de Vries  <tdevries@suse.de>

	* testsuite/scripts/hardlinks-p.sh: New script.
	* testsuite/dwz.tests/hardlink.sh: Use hardlinks-p.sh.
	* testsuite/dwz.tests/hardlink-multifile.sh: New test.

---
 testsuite/dwz.tests/hardlink-multifile.sh | 15 +++++++++++++++
 testsuite/dwz.tests/hardlink.sh           |  4 +---
 testsuite/scripts/hardlinks-p.sh          | 16 ++++++++++++++++
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/testsuite/dwz.tests/hardlink-multifile.sh b/testsuite/dwz.tests/hardlink-multifile.sh
new file mode 100644
index 0000000..91d25e3
--- /dev/null
+++ b/testsuite/dwz.tests/hardlink-multifile.sh
@@ -0,0 +1,15 @@
+cp ../hello 1
+ln 1 2
+cp ../hello 3
+
+dwz -h -m 4 1 2 3
+
+hardlinks-p.sh 1 2
+
+smaller-than.sh 1 ../hello
+smaller-than.sh 3 ../hello
+
+[ "$(gnu-debugaltlink-name.sh 1)" = "4" ]
+[ "$(gnu-debugaltlink-name.sh 3)" = "4" ]
+
+rm -f 1 2 3 4
diff --git a/testsuite/dwz.tests/hardlink.sh b/testsuite/dwz.tests/hardlink.sh
index b70722c..d928989 100644
--- a/testsuite/dwz.tests/hardlink.sh
+++ b/testsuite/dwz.tests/hardlink.sh
@@ -6,8 +6,6 @@ dwz -h 1 2
 smaller-than.sh 1 ../hello
 smaller-than.sh 2 ../hello
 
-hl="$(find -samefile 1 | sort)"
-hl="$(echo $hl)"
-[ "$hl" = "./1 ./2" ]
+hardlinks-p.sh 1 2
 
 rm -f 1 2
diff --git a/testsuite/scripts/hardlinks-p.sh b/testsuite/scripts/hardlinks-p.sh
new file mode 100755
index 0000000..a9a3020
--- /dev/null
+++ b/testsuite/scripts/hardlinks-p.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+hardlinks=$(find -samefile "$1")
+
+for f in "$@"; do
+    found=false
+    for hl in $hardlinks; do
+	if [ "$hl" = "./$f" ]; then
+	    found=true
+	    break
+	fi
+    done
+    if ! $found; then
+	exit 1
+    fi
+done

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-16 23:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Add hardlink-multifile.sh test-case Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).