summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2017-11-09 13:40:01 +0100
committerFrediano Ziglio <fziglio@redhat.com>2017-11-09 13:31:29 +0000
commita61a00f12e1f8e1b982441bb4571376e3b2262e1 (patch)
tree937adcc57404b48b8e1328c698131c16d5108bfc
parent87dbac6202962fe761162aeac9a0ec38f2684118 (diff)
tests: Fix hexdump.sh when builddir != srcdir
This script currently expects the reference file and the generated file to both be in the same directory, which is not the case when doing a build with builddir != srcdir (or when running make distcheck) Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rwxr-xr-xsrc/unittests/hexdump.sh15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/unittests/hexdump.sh b/src/unittests/hexdump.sh
index 602b501..691b264 100755
--- a/src/unittests/hexdump.sh
+++ b/src/unittests/hexdump.sh
@@ -2,14 +2,17 @@
set -e
+SRCDIR=`dirname $0`
+
# avoid weird language handling which could affect
# ascii part of the dump
export LANG=C
-for f in hexdump*.in; do
- out=`echo $f | sed 's,\.in,.out,'`
- rm -f $out.test
- ./test-hexdump $out.test < $f
- cmp $out.test $out
- rm -f $out.test
+for f in "$SRCDIR"/hexdump*.in; do
+ reference=`echo $f | sed 's,\.in,.out,'`
+ out=`basename $reference`.test
+ rm -f $out
+ ./test-hexdump $out < $f
+ cmp $out $reference
+ rm -f $out
done