- Patch added (move zypper hint test to testsuite):

* gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=294
This commit is contained in:
Tom de Vries 2021-11-05 20:33:16 +00:00 committed by Git OBS Bridge
parent 89d377df6f
commit 00c47a8576
4 changed files with 107 additions and 70 deletions

View File

@ -0,0 +1,89 @@
[gdb/testsuite] Add gdb.suse/zypper-hint.exp
---
gdb/testsuite/gdb.suse/zypper-hint.c | 25 +++++++++++++++++++
gdb/testsuite/gdb.suse/zypper-hint.exp | 45 ++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
diff --git a/gdb/testsuite/gdb.suse/zypper-hint.c b/gdb/testsuite/gdb.suse/zypper-hint.c
new file mode 100644
index 00000000000..e179788f04f
--- /dev/null
+++ b/gdb/testsuite/gdb.suse/zypper-hint.c
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2021 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("hello\n");
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.suse/zypper-hint.exp b/gdb/testsuite/gdb.suse/zypper-hint.exp
new file mode 100644
index 00000000000..a9dc84b96f2
--- /dev/null
+++ b/gdb/testsuite/gdb.suse/zypper-hint.exp
@@ -0,0 +1,45 @@
+# Copyright 2021 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile .c
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
+ return -1
+}
+
+clean_restart ${binfile}
+
+gdb_test_no_output "set build-id-verbose 1"
+
+set test "zypper hint printed"
+if { ![gdb_breakpoint main qualified] } {
+ unresolved $test
+ return -1
+}
+
+gdb_run_cmd
+
+set re_64 \
+ "Missing separate debuginfos, use: zypper install glibc-debuginfo-"
+set re_32 \
+ "Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-"
+gdb_test_multiple "" $test {
+ -re -wrap ($re_64|$re_32).* {
+ pass $gdb_test_name
+ }
+}
+
+# To give some background information in case the previous test failed.
+gdb_test "info shared"

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Nov 5 19:15:43 UTC 2021 - Tom de Vries <tdevries@suse.com>
- Patch added (move zypper hint test to testsuite):
* gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch
-------------------------------------------------------------------
Fri Nov 5 15:21:03 UTC 2021 - Tom de Vries <tdevries@suse.com>

View File

@ -273,6 +273,8 @@ Patch1101: gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch
# It would be nice to upstream this, but in order to do that I'd like to have
# an explanation of why this happens, so for now, park this here.
Patch1102: gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch
# Tests the zypper install hints.
Patch1103: gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch
# Patches to upstream
@ -728,6 +730,7 @@ find -name "*.info*"|xargs rm -f
%patch1100 -p1
%patch1101 -p1
%patch1102 -p1
%patch1103 -p1
%patch1500 -p1
%patch1501 -p1
@ -1012,74 +1015,6 @@ then
cd ..
fi
# This is a build-time test, but still a test. So, skip if we don't do tests.
# This is relevant for %%qemu_user_space_build == 1 builds, which atm is
# the case for riscv64.
%if %{build_testsuite}
if [ "$LIBRPM" != "no" ]; then
cd gdb
cat \
> hello.c \
<<EOF
#include <stdio.h>
int
main (void)
{
printf ("hello\n");
return 0;
}
EOF
$CC hello.c
libc=$(ldd a.out \
| grep libc.so \
| awk '{print $3}')
if readelf -SW $libc \
| grep -q "\.gnu_debuglink"; then
cat \
> test.exp \
<<EOF
expect {
"(gdb) " {
puts "\nPASS: first prompt"
send "start\n"
}
default {
puts "\nFAIL: first prompt (eof or timeout)"
exit 1
}
}
expect {
-re {Missing separate debuginfos, use: zypper install glibc-debuginfo-.*\(gdb\) } {
puts "\nPASS: zypper install message"
send "quit\n"
exit 0
}
"(gdb) " {
puts "\nFAIL: zypper install message"
send "quit\n"
exit 1
}
default {
puts "\nFAIL: zypper install message (eof or timeout)"
exit 1
}
}
EOF
gdb="./gdb -q -nw -nx -data-directory $(pwd -P)/data-directory"
# Due to bsc#1146899 "gdb's zypper install message disappears with
# -batch", we need to use an expect test.
expect -c "spawn $gdb ./a.out" -f test.exp
rm ./test.exp
else
# If packages are not build with debuginfo, we cannot expect a zypper
# install message.
echo "UNSUPPORTED: zypper install message"
fi
rm ./hello.c ./a.out
cd ..
fi
%endif
cd ..
done # fprofile

11
qa.sh
View File

@ -8,16 +8,17 @@ if [ $# -eq 0 ]; then
echo "2: gdb.sum: Check for 'ERROR:' (all configs)"
echo "3: gdb.log: Check for 'internal-error:' (all configs)"
echo "4: gdb.sum: Check FAIL and ERROR (known clean configs)"
echo "5: gdb.sum: Check gdb.suse PASS (all configs)"
echo "Verify local results at:"
echo " \$dir"
echo "5: gdb.sum: Check FAIL and ERROR"
echo "6: gdb.sum: Check FAIL and ERROR"
exit 1
fi
n="$1"
shift
if [ "$n" = "5" ]; then
if [ "$n" = "6" ]; then
dir="$1"
shift
fi
@ -238,6 +239,12 @@ case $n in
;;
5)
grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed" \
binaries-testsuite*/gdb-testresults/*.sum \
| grep -E -v ":1"
;;
6)
sums=()
mapfile -t < <(echo_line "$dir"/*-m64.-fno-PIE.-no-pie.sum)