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 Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
=================================================================== ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000 --- /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 +++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp 2016-10-24 23:21:58.043064177 +0200
@@ -0,0 +1,119 @@ @@ -0,0 +1,137 @@
+# Copyright 2014 Free Software Foundation, Inc. +# Copyright 2014 Free Software Foundation, Inc.
+# +#
+# This program is free software; you can redistribute it and/or modify +# 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 + return -1
+} +}
+ +
+set opts ""
+if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \ +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}" + untested "Could not compile ${executable}"
+ return -1 + 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 + global hex binfile_lib2 binfile_lib1 gdb_prompt
+ set libbar_match "[string_to_regexp $binfile_lib2]" + set libbar_match "[string_to_regexp $binfile_lib2]"
+ set libfoo_match "[string_to_regexp $binfile_lib1]" + set libfoo_match "[string_to_regexp $binfile_lib1]"
+ +
+ with_test_prefix "pass #$pass" { + gdb_test_multiple "info shared" "info shared" {
+ gdb_test_multiple "info shared" "info shared" { + -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" { + if { $has_libfoo && $has_libbar } {
+ if { $has_libfoo && $has_libbar } { + pass "matched libfoo and libbar"
+ pass "matched libfoo and libbar" + } else {
+ } else { + fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ 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 } { + -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ pass "matched libfoo" + if { $has_libfoo && !$has_libbar } {
+ } else { + pass "matched libfoo"
+ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)" + } 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 } { + -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ pass "matched libbar" + if { $has_libbar && !$has_libfoo } {
+ } else { + pass "matched libbar"
+ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)" + } else {
+ } + fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ } + }
+ "\r\n${gdb_prompt} $" { + }
+ if { !$has_libfoo && !$has_libbar } { + "\r\n${gdb_prompt} $" {
+ pass "did not match libfoo nor libbar" + if { !$has_libfoo && !$has_libbar } {
+ } else { + pass "did not match libfoo nor libbar"
+ fail "did not match libfoo nor libbar (has_libfoo = $has_libfoo, has_libbar = $has_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 + set pass 0
+ # This variable holds the information about whether libfoo and + # This variable holds the information about whether libfoo and
+ # libbar (respectively) are expected in the "info shared" output. + # libbar (respectively) are expected in the "info shared" output.
+# set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 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 } { 0 1 } \ + { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 1 0 } { 1 1 } \ + { 0 1 } { 0 0 } { 0 0 1 } { 1 1 } \
+# { 1 1 } { 1 0 } { 1 0 } { 1 1 } \ + { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
+# { 1 1 } { 1 0 } { 1 0 } { 1 0 } } + { 1 1 } { 1 0 1 } { 1 0 } { 1 0 } }
+ set solib_event_order { { 0 0 } { 1 1 } }
+ +
+ with_test_prefix "stop-on-solib-events" { + with_test_prefix "stop-on-solib-events" {
+ gdb_test_no_output "set stop-on-solib-events 1" "setting 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 + gdb_run_cmd
+ foreach l $solib_event_order { + foreach l $solib_event_order {
+ incr pass + incr pass
+ do_test [lindex $l 0] [lindex $l 1] $pass + with_test_prefix "pass #$pass" {
+ gdb_test "continue" "\(Called \(foo\|bar\)\r\n\)?Stopped due to shared library event.*" + 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. + # In the last pass we do not expect to see libfoo or libbar.
+ incr pass + 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. # 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. # `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 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 Group: Development/Debuggers
@ -1572,6 +1572,9 @@ then
fi fi
%changelog %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 * 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. - More work on missing testcases present in rhel6 GDB; some still FAIL.