summaryrefslogtreecommitdiffstats
path: root/testsuite/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:55:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 17:55:52 +0000
commitf7a951d79bc895eb2171c2570add9f4899794a10 (patch)
treecc0c7147f472fecbc93add134f5c0e5c1bb72529 /testsuite/scripts
parentInitial commit. (diff)
downloaddwz-upstream.tar.xz
dwz-upstream.zip
Adding upstream version 0.15.upstream/0.15upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/scripts')
-rwxr-xr-xtestsuite/scripts/gnu-debugaltlink-name.sh11
-rwxr-xr-xtestsuite/scripts/hardlinks-p.sh16
-rwxr-xr-xtestsuite/scripts/smaller-than.sh48
-rwxr-xr-xtestsuite/scripts/verify-dwarf.sh5
-rwxr-xr-xtestsuite/scripts/xunzip-dir.sh20
5 files changed, 100 insertions, 0 deletions
diff --git a/testsuite/scripts/gnu-debugaltlink-name.sh b/testsuite/scripts/gnu-debugaltlink-name.sh
new file mode 100755
index 0000000..667c5fd
--- /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\]' \
+ | sed 's/.*0\] //'
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
diff --git a/testsuite/scripts/smaller-than.sh b/testsuite/scripts/smaller-than.sh
new file mode 100755
index 0000000..3b452dc
--- /dev/null
+++ b/testsuite/scripts/smaller-than.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+f1=$1
+f2=$2
+
+section_size ()
+{
+ local f="$1"
+ local section="$2"
+
+ local s
+ s=$(readelf -S -W $f \
+ | grep "\.debug_$section" \
+ | sed 's/.*\.debug_//' \
+ | awk '{print $5}')
+
+ if [ "$s" = "" ]; then
+ echo 0
+ return
+ fi
+
+ # Convert hex to decimal.
+ s=$(printf "%d" $((16#$s)))
+
+ echo $s
+}
+
+size ()
+{
+ local f="$1"
+
+ local total=0
+ local section
+ for section in info abbrev str macro types; do
+ total=$(($total + $(section_size $f $section)))
+ done
+
+ echo $total
+}
+
+s1=$(size $f1)
+s2=$(size $f2)
+
+if [ $s1 -ge $s2 ]; then
+ exit 1
+fi
+
+exit 0
diff --git a/testsuite/scripts/verify-dwarf.sh b/testsuite/scripts/verify-dwarf.sh
new file mode 100755
index 0000000..8e97c3c
--- /dev/null
+++ b/testsuite/scripts/verify-dwarf.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+exec="$1"
+
+gdb -batch "$exec"
diff --git a/testsuite/scripts/xunzip-dir.sh b/testsuite/scripts/xunzip-dir.sh
new file mode 100755
index 0000000..624d525
--- /dev/null
+++ b/testsuite/scripts/xunzip-dir.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+src="$1"
+dst="$2"
+
+if [ ! -d $src ]; then
+ exit 0
+fi
+
+files=$(cd $src; find -name "*.xz")
+
+for f in $files; do
+ df=$(echo $f \
+ | sed 's/\.xz$//')
+ if [ -f $dst/$df ]; then
+ continue
+ fi
+ cp $src/$f $dst/$f
+ xz -d $dst/$f
+done