Fix testcase: gdb.base/gdb-rhbz1156192-recursive-dlopen.exp

This commit is contained in:
Jan Kratochvil 2016-10-24 23:23:00 +02:00
parent 43d7d2a8eb
commit b513153c46
2 changed files with 63 additions and 42 deletions

View File

@ -200,8 +200,8 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp 2016-10-23 21:56:43.815767639 +0200
@@ -0,0 +1,119 @@
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp 2016-10-24 23:21:58.043064177 +0200
@@ -0,0 +1,137 @@
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
@ -247,47 +247,44 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+ return -1
+}
+
+set opts ""
+if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \
+ [ list debug shlib_load "additional_flags=-Wno-deprecated-declarations -Wl,${binfile_lib1},-rpath,[file dirname ${binfile_lib1}],${binfile_lib2},-rpath,[file dirname ${binfile_lib2}]" ]] } {
+ [ list debug shlib_load "additional_flags=-Wno-deprecated-declarations" ]] } {
+ untested "Could not compile ${executable}"
+ return -1
+}
+
+proc do_test { has_libfoo has_libbar pass } {
+proc do_test { has_libfoo has_libbar } {
+ global hex binfile_lib2 binfile_lib1 gdb_prompt
+ set libbar_match "[string_to_regexp $binfile_lib2]"
+ set libfoo_match "[string_to_regexp $binfile_lib1]"
+
+ with_test_prefix "pass #$pass" {
+ gdb_test_multiple "info shared" "info shared" {
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libfoo && $has_libbar } {
+ pass "matched libfoo and libbar"
+ } else {
+ fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ gdb_test_multiple "info shared" "info shared" {
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libfoo && $has_libbar } {
+ pass "matched libfoo and libbar"
+ } else {
+ fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libfoo && !$has_libbar } {
+ pass "matched libfoo"
+ } else {
+ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libfoo && !$has_libbar } {
+ pass "matched libfoo"
+ } else {
+ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libbar && !$has_libfoo } {
+ pass "matched libbar"
+ } else {
+ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libbar && !$has_libfoo } {
+ pass "matched libbar"
+ } else {
+ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ "\r\n${gdb_prompt} $" {
+ if { !$has_libfoo && !$has_libbar } {
+ pass "did not match libfoo nor libbar"
+ } else {
+ fail "did not match libfoo nor libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ "\r\n${gdb_prompt} $" {
+ if { !$has_libfoo && !$has_libbar } {
+ pass "did not match libfoo nor libbar"
+ } else {
+ fail "did not match libfoo nor libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ }
@ -297,13 +294,12 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+ set pass 0
+ # This variable holds the information about whether libfoo and
+ # libbar (respectively) are expected in the "info shared" output.
+# set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 1 0 } { 1 1 } \
+# { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
+# { 1 1 } { 1 0 } { 1 0 } { 1 0 } }
+ set solib_event_order { { 0 0 } { 1 1 } }
+ set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+ { 0 1 } { 0 0 } { 0 0 1 } { 1 1 } \
+ { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
+ { 1 1 } { 1 0 1 } { 1 0 } { 1 0 } }
+
+ with_test_prefix "stop-on-solib-events" {
+ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
@ -311,12 +307,34 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+ gdb_run_cmd
+ foreach l $solib_event_order {
+ incr pass
+ do_test [lindex $l 0] [lindex $l 1] $pass
+ gdb_test "continue" "\(Called \(foo\|bar\)\r\n\)?Stopped due to shared library event.*"
+ with_test_prefix "pass #$pass" {
+ set should_be_corrupted [expr 0+0[lindex $l 2]]
+ do_test [lindex $l 0] [lindex $l 1]
+ set test "continue"
+ global gdb_prompt
+ gdb_test_multiple $test $test {
+ -re "\r\nwarning: Corrupted shared library list:.*\r\nStopped due to shared library event.*\r\n$gdb_prompt $" {
+ set corrupted 1
+ pass $test
+ }
+ -re "\r\nStopped due to shared library event.*\r\n$gdb_prompt $" {
+ set corrupted 0
+ pass $test
+ }
+ }
+ set test "corrupted=$corrupted but should_be_corrupted=$should_be_corrupted"
+ if {$corrupted == $should_be_corrupted} {
+ pass $test
+ } else {
+ fail $test
+ }
+ }
+ }
+ # In the last pass we do not expect to see libfoo or libbar.
+ incr pass
+ do_test 0 0 $pass
+ with_test_prefix "pass #$pass" {
+ do_test 0 0
+ }
+ }
+}
+

View File

@ -26,7 +26,7 @@ Version: 7.12
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 27%{?dist}
Release: 28%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -1572,6 +1572,9 @@ then
fi
%changelog
* Mon Oct 24 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-28.fc25
- Fix testcase: gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
* Sun Oct 23 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-27.fc25
- More work on missing testcases present in rhel6 GDB; some still FAIL.