From 049109b007ccd53ee9bccf9e7e5c4115e33df5e1 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 6 Mar 2013 12:13:41 +0000 Subject: [PATCH] tstatus.exp: use UNSUPPORTED for optional features that are not supported The current tstatus.exp tests shows PASSes if either the target support or not the optional tstatus bits: PASS: gdb.trace/tstatus.exp: tstatus does not report trace stop reason PASS: gdb.trace/tstatus.exp: tstatus reports trace stop reason The former (and any other similar case) should be UNSUPPORTED rather than PASS. That'd make it much easier to spot actually problems with the test (e.g., the one Yao's previous patch addressed), along with regressions and progressions. The "not supported" paths in tstatus.exp explicitly check for output you'd get if the feature wasn't supported, so real unexpected failures will still be caught as FAILs. So now e.g., where we wanted to check if tstatus reports the trace stop reason, and if the target does support it, we get PASS: tstatus reports trace stop reason if the target actually reports what we'd expect if the trace stop reason isn't supported, we get: UNSUPPORTED: tstatus reports trace stop reason and if the target reports something else unexpected, we get: FAIL: tstatus reports trace stop reason That has the added bonus that the test string is always the same and only the test results change (PASS/FAIL/UNSUPPORTED), which makes it easier for testers see regressions, compared to the previous: -PASS: gdb.trace/tstatus.exp: tstatus reports trace stop reason +PASS: gdb.trace/tstatus.exp: tstatus does not report trace stop reason which clearly easily goes by unnoticed, as evidenced by the existing problem Yao's previous patch addressed. Tested on x86_64 Fedora 17. gdb/testsuite/ 2013-03-06 Pedro Alves * gdb.trace/tstatus.exp (run_trace_experiment): When the target doesn't support the tested optional feature, call "unsupported" with the same test message as the "pass" case, instead of calling "pass" with a different message. Use the same text for the "fail" cases too. --- gdb/testsuite/ChangeLog | 8 ++++++ gdb/testsuite/gdb.trace/tstatus.exp | 43 +++++++++++++++-------------- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 83c5050443..f34466e085 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-03-06 Pedro Alves + + * gdb.trace/tstatus.exp (run_trace_experiment): When the target + doesn't support the tested optional feature, call "unsupported" + with the same test message as the "pass" case, instead of calling + "pass" with a different message. Use the same text for the "fail" + cases too. + 2013-03-06 Yao Qi * gdb.trace/tstatus.exp: Remove the invocation of diff --git a/gdb/testsuite/gdb.trace/tstatus.exp b/gdb/testsuite/gdb.trace/tstatus.exp index 46faaf89af..743db913e2 100644 --- a/gdb/testsuite/gdb.trace/tstatus.exp +++ b/gdb/testsuite/gdb.trace/tstatus.exp @@ -51,60 +51,63 @@ proc run_trace_experiment {} { "advance through tracing" # Now play with tstatus a bit. - # Since note support is optional, we need to match both with and without - # cases. - gdb_test_multiple "tstatus" "check on trace status" { + # Since support for notes, user, stop reason, etc. is optional, we + # need to match both with and without cases. + + set test "tstatus reports trace note" + gdb_test_multiple "tstatus" $test { -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: my tracing note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" { - pass "tstatus reports trace note" + pass $test } -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" { - pass "tstatus does not report any trace note" + unsupported $test } } gdb_test "set trace-notes different note" "" "change tracing note" - gdb_test_multiple "tstatus" "check on trace status with diff note" { + set test "tstatus reports different trace note" + gdb_test_multiple "tstatus" $test { -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" { - pass "tstatus reports different trace note" + pass $test } -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" { - pass "tstatus does not report any different trace note" + unsupported $test } } gdb_test "set trace-user me me me" "" "change tracing user" - gdb_test_multiple "tstatus" "check on trace status with diff note" { + set test "tstatus reports trace user" + gdb_test_multiple "tstatus" $test { -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" { - pass "tstatus reports trace user" + pass $test } -re "Trace is running.*Trace will stop if GDB disconnects\.\[\r\n\]+Not looking at any trace frame.*\r\n$gdb_prompt $" { - pass "tstatus does not report trace user" + unsupported $test } } gdb_test_no_output "tstop because I can" "trace stopped with note" - gdb_test_multiple "tstatus" "check on trace status after stop" { + set test "tstatus reports trace stop reason" + gdb_test_multiple "tstatus" $test { -re "Trace stopped by a tstop command \\(because I can\\)\..*Trace will stop if GDB disconnects\.\[\r\n\]+Trace user is me me me\.\[\r\n\]+Trace notes: different note\.\[\r\n\]+Not looking at any trace frame\..*\r\n$gdb_prompt $" { - pass "tstatus reports trace stop reason" + pass $test } -re "Trace stopped by a tstop command\..*\r\n$gdb_prompt $" { - pass "tstatus does not report trace stop reason" + unsupported $test } } - # Hit count and traceframe usage of tracepoint is optional, so - # pass it either way. - - gdb_test_multiple "info trace" "show tracepoint state" { + set test "info trace reports tracepoint hit count and traceframe usage" + gdb_test_multiple "info trace" $test { -re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+tracepoint already hit 1 time\[\r\n\]+\[\t ]+trace buffer usage ${decimal} bytes\.\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" { - pass "info trace reports tracepoint hit count and traceframe usage" + pass $test } -re "actions\.c:\[0-9\]+\[\r\n\]+\[\t ]+collect parm.*\r\n$gdb_prompt $" { - pass "info trace does not report tracepoint hit count and traceframe usage" + unsupported $test } } }