From f7a951d79bc895eb2171c2570add9f4899794a10 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 19:55:52 +0200 Subject: Adding upstream version 0.15. Signed-off-by: Daniel Baumann --- testsuite/scripts/gnu-debugaltlink-name.sh | 11 +++++++ testsuite/scripts/hardlinks-p.sh | 16 ++++++++++ testsuite/scripts/smaller-than.sh | 48 ++++++++++++++++++++++++++++++ testsuite/scripts/verify-dwarf.sh | 5 ++++ testsuite/scripts/xunzip-dir.sh | 20 +++++++++++++ 5 files changed, 100 insertions(+) create mode 100755 testsuite/scripts/gnu-debugaltlink-name.sh create mode 100755 testsuite/scripts/hardlinks-p.sh create mode 100755 testsuite/scripts/smaller-than.sh create mode 100755 testsuite/scripts/verify-dwarf.sh create mode 100755 testsuite/scripts/xunzip-dir.sh (limited to 'testsuite/scripts') 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 -- cgit v1.2.3