public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Add hardlink-multifile.sh test-case
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190316234546.GA29313@delia> (raw)

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

                 reply	other threads:[~2019-03-16 23:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190316234546.GA29313@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).