* [PATCH] Add testsuite
@ 2019-01-01 0:00 Tom de Vries
2019-01-01 0:00 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2019-01-01 0:00 UTC (permalink / raw)
To: dwz, jakub
Hi,
this patch adds a basic dejagnu testsuite for dwz:
...
$ make check
$ cat dwz.sum
...
Running testsuite/dwz.tests/dwz-tests.exp ...
PASS: testsuite/dwz.tests/regular.sh
PASS: testsuite/dwz.tests/low-mem.sh
PASS: testsuite/dwz.tests/multifile.sh
PASS: testsuite/dwz.tests/too-many-dies.sh
PASS: testsuite/dwz.tests/hardlink.sh
=== dwz Summary ===
nr of expected passes 5
...
OK for trunk?
Thanks,
- Tom
Add testsuite
2019-02-27 Tom de Vries <tdevries@suse.de>
PR dwz/24277
* Makefile (check): Add target.
* hello.c: New test.
* testsuite/lib/dwz.exp: New dejagnu tool config file.
* testsuite/scripts/gnu-debugaltlink-name.sh: New script.
* testsuite/scripts/smaller-than.sh: New script.
* testsuite/dwz.tests/dwz-tests.exp: New file.
* testsuite/dwz.tests/hardlink.sh: New test.
* testsuite/dwz.tests/low-mem.sh: New test.
* testsuite/dwz.tests/multifile.sh: New test.
* testsuite/dwz.tests/regular.sh: New test.
* testsuite/dwz.tests/too-many-dies.sh: New test.
---
Makefile | 12 ++++++++++++
hello.c | 8 ++++++++
testsuite/dwz.tests/dwz-tests.exp | 21 +++++++++++++++++++++
testsuite/dwz.tests/hardlink.sh | 21 +++++++++++++++++++++
testsuite/dwz.tests/low-mem.sh | 13 +++++++++++++
testsuite/dwz.tests/multifile.sh | 20 ++++++++++++++++++++
testsuite/dwz.tests/regular.sh | 13 +++++++++++++
testsuite/dwz.tests/too-many-dies.sh | 13 +++++++++++++
testsuite/lib/dwz.exp | 0
testsuite/scripts/gnu-debugaltlink-name.sh | 7 +++++++
testsuite/scripts/smaller-than.sh | 13 +++++++++++++
11 files changed, 141 insertions(+)
diff --git a/Makefile b/Makefile
index fbac9b5..7163a0a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,3 +14,15 @@ install: dwz
install -D -m 644 dwz.1 $(DESTDIR)$(mandir)/man1/dwz.1
clean:
rm -f $(OBJECTS) *~ core* dwz
+
+PWD:=$(shell pwd -P)
+
+hello:
+ $(CC) hello.c -o $@
+
+check: dwz hello
+ mkdir -p testsuite-bin
+ cd testsuite-bin; ln -sf $(PWD)/dwz .
+ export PATH=$(PWD)/testsuite-bin:$$PATH; \
+ runtest --tool=dwz -srcdir testsuite
+ rm -Rf testsuite-bin hello
diff --git a/hello.c b/hello.c
new file mode 100644
index 0000000..82d070e
--- /dev/null
+++ b/hello.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("hello\n");
+ return 0;
+}
diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp
new file mode 100644
index 0000000..3f0c4d9
--- /dev/null
+++ b/testsuite/dwz.tests/dwz-tests.exp
@@ -0,0 +1,21 @@
+set tests [find $srcdir/$subdir *.sh]
+
+set pwd [pwd]
+
+set env(PATH) $pwd/$srcdir/scripts:$::env(PATH)
+
+foreach test $tests {
+ set dir [exec basename $test]
+ set dir $pwd/tmp.$dir
+ exec rm -Rf $dir
+ exec mkdir $dir
+
+ cd $dir
+ if { [catch { exec ../$test } msg] } {
+ puts "$msg"
+ fail "$test"
+ } else {
+ pass "$test"
+ exec rm -Rf $dir
+ }
+}
diff --git a/testsuite/dwz.tests/hardlink.sh b/testsuite/dwz.tests/hardlink.sh
new file mode 100755
index 0000000..de339b9
--- /dev/null
+++ b/testsuite/dwz.tests/hardlink.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+ln 1 2
+
+dwz -h 1 2
+
+smaller-than.sh 1 ../hello
+smaller-than.sh 2 ../hello
+
+hl="$(find -samefile 1)"
+hl="$(echo $hl)"
+[ "$hl" = "./1 ./2" ]
+
+ls=$(ls)
+ls=$(echo $ls)
+[ "$ls" = "1 2" ]
+
+rm -f 1 2
diff --git a/testsuite/dwz.tests/low-mem.sh b/testsuite/dwz.tests/low-mem.sh
new file mode 100755
index 0000000..d042f7b
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+
+dwz -l0 1
+
+smaller-than.sh 1 ../hello
+
+[ $(ls) = "1" ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/multifile.sh b/testsuite/dwz.tests/multifile.sh
new file mode 100755
index 0000000..5c54d0f
--- /dev/null
+++ b/testsuite/dwz.tests/multifile.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+cp ../hello 2
+
+dwz -m 3 1 2
+
+smaller-than.sh 1 ../hello
+smaller-than.sh 2 ../hello
+
+ls=$(ls)
+ls=$(echo $ls)
+[ "$ls" = "1 2 3" ]
+
+[ $(gnu-debugaltlink-name.sh 1) = "3" ]
+[ $(gnu-debugaltlink-name.sh 2) = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/regular.sh b/testsuite/dwz.tests/regular.sh
new file mode 100755
index 0000000..58a2b63
--- /dev/null
+++ b/testsuite/dwz.tests/regular.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+
+dwz 1
+
+smaller-than.sh 1 ../hello
+
+[ $(ls) = "1" ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/too-many-dies.sh b/testsuite/dwz.tests/too-many-dies.sh
new file mode 100755
index 0000000..2f9e4a2
--- /dev/null
+++ b/testsuite/dwz.tests/too-many-dies.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+
+if dwz -L0 1 2>/dev/null; then exit 1; fi
+
+cmp 1 ../hello
+
+[ "$(ls)" = "1" ]
+
+rm -f 1
diff --git a/testsuite/lib/dwz.exp b/testsuite/lib/dwz.exp
new file mode 100644
index 0000000..e69de29
diff --git a/testsuite/scripts/gnu-debugaltlink-name.sh b/testsuite/scripts/gnu-debugaltlink-name.sh
new file mode 100755
index 0000000..0d0c276
--- /dev/null
+++ b/testsuite/scripts/gnu-debugaltlink-name.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+readelf \
+ --string-dump=.gnu_debugaltlink \
+ $1 \
+ | grep -a '\[[ ]*0\]' \
+ | awk '{$1="";$2=""; print;}'
diff --git a/testsuite/scripts/smaller-than.sh b/testsuite/scripts/smaller-than.sh
new file mode 100755
index 0000000..b3672a5
--- /dev/null
+++ b/testsuite/scripts/smaller-than.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+f1=$1
+f2=$2
+
+s1=$(ls -l $f1 | awk '{print $5}')
+s2=$(ls -l $f2 | awk '{print $5}')
+
+if [ $s1 -ge $s2 ]; then
+ exit 1
+fi
+
+exit 0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add testsuite
2019-01-01 0:00 [PATCH] Add testsuite Tom de Vries
@ 2019-01-01 0:00 ` Jakub Jelinek
2019-01-01 0:00 ` Tom de Vries
2019-01-01 0:00 ` Tom de Vries
0 siblings, 2 replies; 4+ messages in thread
From: Jakub Jelinek @ 2019-01-01 0:00 UTC (permalink / raw)
To: Tom de Vries; +Cc: dwz
On Wed, Feb 27, 2019 at 09:18:39PM +0100, Tom de Vries wrote:
> this patch adds a basic dejagnu testsuite for dwz:
> ...
> $ make check
> $ cat dwz.sum
> ...
> Running testsuite/dwz.tests/dwz-tests.exp ...
> PASS: testsuite/dwz.tests/regular.sh
> PASS: testsuite/dwz.tests/low-mem.sh
> PASS: testsuite/dwz.tests/multifile.sh
> PASS: testsuite/dwz.tests/too-many-dies.sh
> PASS: testsuite/dwz.tests/hardlink.sh
>
> === dwz Summary ===
>
> nr of expected passes 5
> ...
>
> OK for trunk?
Ok, thanks.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add testsuite
2019-01-01 0:00 ` Jakub Jelinek
2019-01-01 0:00 ` Tom de Vries
@ 2019-01-01 0:00 ` Tom de Vries
1 sibling, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2019-01-01 0:00 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: dwz
[-- Attachment #1: Type: text/plain, Size: 930 bytes --]
On 27-02-19 21:23, Jakub Jelinek wrote:
> On Wed, Feb 27, 2019 at 09:18:39PM +0100, Tom de Vries wrote:
>> this patch adds a basic dejagnu testsuite for dwz:
>> ...
>> $ make check
>> $ cat dwz.sum
>> ...
>> Running testsuite/dwz.tests/dwz-tests.exp ...
>> PASS: testsuite/dwz.tests/regular.sh
>> PASS: testsuite/dwz.tests/low-mem.sh
>> PASS: testsuite/dwz.tests/multifile.sh
>> PASS: testsuite/dwz.tests/too-many-dies.sh
>> PASS: testsuite/dwz.tests/hardlink.sh
>>
>> === dwz Summary ===
>>
>> nr of expected passes 5
>> ...
>>
>> OK for trunk?
>
> Ok, thanks.
A minor update of this patch, with obvious changes:
- bug fix: the file hello was not compiled with -g (which I didn't
notice because dwarf information from libraries was picked up).
- addition of variable TEST_EXECS in Makefile
- make gnu-debugaltlink-name.sh robust against files without
.gnu_debugaltlink section
Thanks,
- Tom
[-- Attachment #2: 0001-Add-testsuite.patch --]
[-- Type: text/x-patch, Size: 5744 bytes --]
Add testsuite
Add basic dejagnu testsuite for dwz:
...
$ make check
$ cat dwz.sum
...
Running testsuite/dwz.tests/dwz-tests.exp ...
PASS: testsuite/dwz.tests/regular.sh
PASS: testsuite/dwz.tests/low-mem.sh
PASS: testsuite/dwz.tests/multifile.sh
PASS: testsuite/dwz.tests/too-many-dies.sh
PASS: testsuite/dwz.tests/hardlink.sh
=== dwz Summary ===
nr of expected passes 5
...
2019-02-27 Tom de Vries <tdevries@suse.de>
PR dwz/24277
* Makefile (check): Add target.
* hello.c: New test.
* testsuite/lib/dwz.exp: New dejagnu tool config file.
* testsuite/scripts/gnu-debugaltlink-name.sh: New script.
* testsuite/scripts/smaller-than.sh: New script.
* testsuite/dwz.tests/dwz-tests.exp: New file.
* testsuite/dwz.tests/hardlink.sh: New test.
* testsuite/dwz.tests/low-mem.sh: New test.
* testsuite/dwz.tests/multifile.sh: New test.
* testsuite/dwz.tests/regular.sh: New test.
* testsuite/dwz.tests/too-many-dies.sh: New test.
---
Makefile | 14 ++++++++++++++
hello.c | 8 ++++++++
testsuite/dwz.tests/dwz-tests.exp | 21 +++++++++++++++++++++
testsuite/dwz.tests/hardlink.sh | 21 +++++++++++++++++++++
testsuite/dwz.tests/low-mem.sh | 13 +++++++++++++
testsuite/dwz.tests/multifile.sh | 20 ++++++++++++++++++++
testsuite/dwz.tests/regular.sh | 13 +++++++++++++
testsuite/dwz.tests/too-many-dies.sh | 13 +++++++++++++
testsuite/lib/dwz.exp | 0
testsuite/scripts/gnu-debugaltlink-name.sh | 11 +++++++++++
testsuite/scripts/smaller-than.sh | 13 +++++++++++++
11 files changed, 147 insertions(+)
diff --git a/Makefile b/Makefile
index fbac9b5..bc51ca2 100644
--- a/Makefile
+++ b/Makefile
@@ -14,3 +14,17 @@ install: dwz
install -D -m 644 dwz.1 $(DESTDIR)$(mandir)/man1/dwz.1
clean:
rm -f $(OBJECTS) *~ core* dwz
+
+PWD:=$(shell pwd -P)
+
+TEST_EXECS = hello
+
+hello:
+ $(CC) hello.c -o $@ -g
+
+check: dwz $(TEST_EXECS)
+ mkdir -p testsuite-bin
+ cd testsuite-bin; ln -sf $(PWD)/dwz .
+ export PATH=$(PWD)/testsuite-bin:$$PATH; \
+ runtest --tool=dwz -srcdir testsuite
+ rm -Rf testsuite-bin $(TEST_EXECS)
diff --git a/hello.c b/hello.c
new file mode 100644
index 0000000..82d070e
--- /dev/null
+++ b/hello.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("hello\n");
+ return 0;
+}
diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp
new file mode 100644
index 0000000..3f0c4d9
--- /dev/null
+++ b/testsuite/dwz.tests/dwz-tests.exp
@@ -0,0 +1,21 @@
+set tests [find $srcdir/$subdir *.sh]
+
+set pwd [pwd]
+
+set env(PATH) $pwd/$srcdir/scripts:$::env(PATH)
+
+foreach test $tests {
+ set dir [exec basename $test]
+ set dir $pwd/tmp.$dir
+ exec rm -Rf $dir
+ exec mkdir $dir
+
+ cd $dir
+ if { [catch { exec ../$test } msg] } {
+ puts "$msg"
+ fail "$test"
+ } else {
+ pass "$test"
+ exec rm -Rf $dir
+ }
+}
diff --git a/testsuite/dwz.tests/hardlink.sh b/testsuite/dwz.tests/hardlink.sh
new file mode 100755
index 0000000..de339b9
--- /dev/null
+++ b/testsuite/dwz.tests/hardlink.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+ln 1 2
+
+dwz -h 1 2
+
+smaller-than.sh 1 ../hello
+smaller-than.sh 2 ../hello
+
+hl="$(find -samefile 1)"
+hl="$(echo $hl)"
+[ "$hl" = "./1 ./2" ]
+
+ls=$(ls)
+ls=$(echo $ls)
+[ "$ls" = "1 2" ]
+
+rm -f 1 2
diff --git a/testsuite/dwz.tests/low-mem.sh b/testsuite/dwz.tests/low-mem.sh
new file mode 100755
index 0000000..d042f7b
--- /dev/null
+++ b/testsuite/dwz.tests/low-mem.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+
+dwz -l0 1
+
+smaller-than.sh 1 ../hello
+
+[ $(ls) = "1" ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/multifile.sh b/testsuite/dwz.tests/multifile.sh
new file mode 100755
index 0000000..5c54d0f
--- /dev/null
+++ b/testsuite/dwz.tests/multifile.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+cp ../hello 2
+
+dwz -m 3 1 2
+
+smaller-than.sh 1 ../hello
+smaller-than.sh 2 ../hello
+
+ls=$(ls)
+ls=$(echo $ls)
+[ "$ls" = "1 2 3" ]
+
+[ $(gnu-debugaltlink-name.sh 1) = "3" ]
+[ $(gnu-debugaltlink-name.sh 2) = "3" ]
+
+rm -f 1 2 3
diff --git a/testsuite/dwz.tests/regular.sh b/testsuite/dwz.tests/regular.sh
new file mode 100755
index 0000000..58a2b63
--- /dev/null
+++ b/testsuite/dwz.tests/regular.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+
+dwz 1
+
+smaller-than.sh 1 ../hello
+
+[ $(ls) = "1" ]
+
+rm -f 1
diff --git a/testsuite/dwz.tests/too-many-dies.sh b/testsuite/dwz.tests/too-many-dies.sh
new file mode 100755
index 0000000..2f9e4a2
--- /dev/null
+++ b/testsuite/dwz.tests/too-many-dies.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+
+if dwz -L0 1 2>/dev/null; then exit 1; fi
+
+cmp 1 ../hello
+
+[ "$(ls)" = "1" ]
+
+rm -f 1
diff --git a/testsuite/lib/dwz.exp b/testsuite/lib/dwz.exp
new file mode 100644
index 0000000..e69de29
diff --git a/testsuite/scripts/gnu-debugaltlink-name.sh b/testsuite/scripts/gnu-debugaltlink-name.sh
new file mode 100755
index 0000000..d99a970
--- /dev/null
+++ b/testsuite/scripts/gnu-debugaltlink-name.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if ! readelf -S $1 | grep -q '\.gnu_debugaltlink'; then
+ exit
+fi
+
+readelf \
+ --string-dump=.gnu_debugaltlink \
+ $1 \
+ | grep -a '\[[ ]*0\]' \
+ | awk '{$1="";$2=""; print;}'
diff --git a/testsuite/scripts/smaller-than.sh b/testsuite/scripts/smaller-than.sh
new file mode 100755
index 0000000..b3672a5
--- /dev/null
+++ b/testsuite/scripts/smaller-than.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+f1=$1
+f2=$2
+
+s1=$(ls -l $f1 | awk '{print $5}')
+s2=$(ls -l $f2 | awk '{print $5}')
+
+if [ $s1 -ge $s2 ]; then
+ exit 1
+fi
+
+exit 0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add testsuite
2019-01-01 0:00 ` Jakub Jelinek
@ 2019-01-01 0:00 ` Tom de Vries
2019-01-01 0:00 ` Tom de Vries
1 sibling, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2019-01-01 0:00 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: dwz
On 27-02-19 21:23, Jakub Jelinek wrote:
> On Wed, Feb 27, 2019 at 09:18:39PM +0100, Tom de Vries wrote:
>> this patch adds a basic dejagnu testsuite for dwz:
>> ...
>> $ make check
>> $ cat dwz.sum
>> ...
>> Running testsuite/dwz.tests/dwz-tests.exp ...
>> PASS: testsuite/dwz.tests/regular.sh
>> PASS: testsuite/dwz.tests/low-mem.sh
>> PASS: testsuite/dwz.tests/multifile.sh
>> PASS: testsuite/dwz.tests/too-many-dies.sh
>> PASS: testsuite/dwz.tests/hardlink.sh
>>
>> === dwz Summary ===
>>
>> nr of expected passes 5
>> ...
>>
>> OK for trunk?
>
> Ok, thanks.
I've tried to push to git://sourceware.org/git/dwz.git, but got:
...
$ git br -vv | grep master
* master e5d4908
[origin/master: ahead 1] Add testsuite
$ git push origin
fatal: remote error: service not enabled: /git/dwz.git
...
Do you want to push the patch(es) yourself, or setup write access?
Thanks,
- Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-01 18:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01 0:00 [PATCH] Add testsuite Tom de Vries
2019-01-01 0:00 ` Jakub Jelinek
2019-01-01 0:00 ` Tom de Vries
2019-01-01 0:00 ` 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).