dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Check if test has reportable output in process_test


From: Tom de Vries
Subject: Check if test has reportable output in process_test
Date: Sat, 3 Jun 2017 17:59:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

Hi,

I found a problem in the dejagnu testsuite, with process_test.

If there is a problem running a .test file, then process_test is silent about it.

This minimal demonstrator patch adds basic reporting if there is a problem, by checking that at least a single clause in the expect command triggered. Using this patch we're able to demonstrate that there are problems in target.test and remote.test.

Thanks,
- Tom
Check if test has reportable output in process_test

Result:
...
Running target unix
Using ../src/testsuite/config/default.exp as tool-and-target-specific interface 
file.
Running ../src/testsuite/libdejagnu/tunit.exp ...
Running ../src/testsuite/runtest.all/libs.exp ...
ERROR: ../src/testsuite/runtest.all/target.test gives no reportable output
ERROR: ../src/testsuite/runtest.all/remote.test gives no reportable output
Running ../src/testsuite/runtest.all/load_lib.exp ...
Running ../src/testsuite/runtest.all/options.exp ...
Running ../src/testsuite/runtest.all/stats-sub.exp ...
Running ../src/testsuite/runtest.all/stats.exp ...
...

2017-06-03  Tom de Vries  <address@hidden>

        * testsuite/runtest.all/libs.exp (process_test): Check if test has
        reportable output.

---
 testsuite/runtest.all/libs.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/testsuite/runtest.all/libs.exp b/testsuite/runtest.all/libs.exp
index 7520e12..c201258 100644
--- a/testsuite/runtest.all/libs.exp
+++ b/testsuite/runtest.all/libs.exp
@@ -31,40 +31,52 @@ proc process_test { test } {
 
     if [file exists $test] {
        verbose "Processing test $test" 2
+       set n 0
        spawn -open  [open "|$EXPECT $test $srcdir $subdir [pwd]" r]
        expect {
            "No such file or directory" {
                perror "$test wouldn't run" 0
+               set n [expr $n + 1]
            }
            -re "\[\r\n\]*NOTSUPPORTED: $text\[\r\n\]*" {
                unsupported "[lrange $expect_out(0,string) 1 end]"
+               set n [expr $n + 1]
                exp_continue
            }
            -re "\[\r\n\]*NOTTESTED: $text\[\r\n\]*" {
                untested "[lrange $expect_out(0,string) 1 end]"
+               set n [expr $n + 1]
                exp_continue
            }
            -re "\[\r\n\]*PASSED: $text\[\r\n\]*" {
                pass "[lrange $expect_out(0,string) 1 end]"
+               set n [expr $n + 1]
                exp_continue
            }
            -re "\[\r\n\]*FAILED: $text\[\r\n\]*" {
                fail "[lrange $expect_out(0,string) 1 end]"
+               set n [expr $n + 1]
                exp_continue
            }
            -re "\[\r\n\]*WARNED: $text\[\r\n\]*" {
                verbose "$expect_out(0,string)" 2
+               set n [expr $n + 1]
                exp_continue
            }
            -re "\[\r\n\]*ERRORED: $text\[\r\n\]*" {
                verbose "$expect_out(0,string)" 2
+               set n [expr $n + 1]
                exp_continue
            }
            timeout {
                perror "$test timed out" 0
+               set n [expr $n + 1]
                exp_continue
            }
            eof {
+               if { $n == 0 } {
+                   perror "$test gives no reportable output" 0
+               }
                verbose "All Done" 3
            }
        }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]