diff options
author | Jacob Bachmeyer <jcb@gnu.org> | 2022-11-28 20:53:29 -0600 |
---|---|---|
committer | Jacob Bachmeyer <jcb@gnu.org> | 2022-11-28 20:53:29 -0600 |
commit | add1e3e32ec43aed703fae19fccb997d09e37fdb (patch) | |
tree | d18126acbaca724abb1892fb62432ed1009d7d29 | |
parent | 92bf23d77f288766eddff2b04323c320f202c8c5 (diff) |
Add UNSUPPORTED test result to DejaGnu unit test protocol
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | dejagnu.h | 35 | ||||
-rw-r--r-- | doc/dejagnu.texi | 2 | ||||
-rw-r--r-- | lib/dejagnu.exp | 1 | ||||
-rw-r--r-- | testsuite/libdejagnu/unit-c.c | 1 | ||||
-rw-r--r-- | testsuite/libdejagnu/unit.exp | 20 |
6 files changed, 61 insertions, 11 deletions
@@ -1,5 +1,18 @@ 2022-11-28 Jacob Bachmeyer <jcb@gnu.org> + * dejagnu.h: Add UNSUPPORTED test result. + (unsupport): New counter variable for UNSUPPORTED results. + (unsupported): New function in C API. + (TestState::unsupported): New function in C++ API. + (outstate_list): Add UNSUPPORTED entry. + (teststate::laststate): Likewise. + (totals): Mention number of unsupported tests. + (TestState::totals): Likewise for C++ API. + * lib/dejagnu.exp (host_execute): Add UNSUPPORTED test result. + * doc/dejagnu.texi (DejaGnu unit test protocol): Document same. + * testsuite/libdejagnu/unit-c.c: Add test for UNSUPPORTED. + * testsuite/libdejagnu/unit.exp: Likewise. + * testsuite/libdejagnu/unit.exp: Add test for NOTE message. 2022-11-26 Jacob Bachmeyer <jcb@gnu.org> @@ -39,6 +39,7 @@ static int passed; static int failed; static int untest; static int unresolve; +static int unsupport; static int xfailed; static int xpassed; @@ -138,6 +139,19 @@ unresolved (const char* fmt, ...) } static inline void +unsupported (const char* fmt, ...) +{ + va_list ap; + + unsupport++; + va_start (ap, fmt); + vsnprintf (buffer, sizeof (buffer), fmt, ap); + va_end (ap); + printf ("\tUNSUPPORTED: %s\n", buffer); + wait (); +} + +static inline void note (const char* fmt, ...) { va_list ap; @@ -163,6 +177,8 @@ totals (void) printf ("\t#untested:\t\t%d\n", untest); if (unresolve) printf ("\t#unresolved:\t\t%d\n", unresolve); + if (unsupport) + printf ("\t#unsupported:\t\t%d\n", unsupport); printf ("\tEND: done\n"); } @@ -174,12 +190,16 @@ totals (void) #include <string> const char *outstate_list[] = { - "FAILED: ", "PASSED: ", "UNTESTED: ", "UNRESOLVED: ", "XFAILED: ", "XPASSED: " + "FAILED: ", "PASSED: ", + "UNTESTED: ", "UNRESOLVED: ", "UNSUPPORTED: ", + "XFAILED: ", "XPASSED: " }; const char ** outstate = outstate_list; -enum teststate { FAILED, PASSED, UNTESTED, UNRESOLVED, XFAILED, XPASSED} laststate; +enum teststate { FAILED, PASSED, + UNTESTED, UNRESOLVED, UNSUPPORTED, + XFAILED, XPASSED } laststate; class TestState { private: @@ -194,6 +214,7 @@ class TestState { xpassed = 0; xfailed = 0; unresolve = 0; + unsupport = 0; } ~TestState (void) { totals(); } @@ -254,6 +275,14 @@ class TestState { std::cout << "\t" << outstate[UNRESOLVED] << s << std::endl; } + void unsupported (std::string s) + { + unsupport++; + laststate = UNSUPPORTED; + lastmsg = s; + std::cout << "\t" << outstate[UNSUPPORTED] << s << std::endl; + } + void totals (void) { std::cout << "\t#passed:\t\t" << passed << std::endl; @@ -266,6 +295,8 @@ class TestState { std::cout << "\t#untested:\t\t" << untest << std::endl; if (unresolve) std::cout << "\t#unresolved:\t\t" << unresolve << std::endl; + if (unsupport) + std::cout << "\t#unsupported:\t\t" << unsupport << std::endl; std::cout << "\tEND: done" << std::endl; } diff --git a/doc/dejagnu.texi b/doc/dejagnu.texi index 62207b7..91048b7 100644 --- a/doc/dejagnu.texi +++ b/doc/dejagnu.texi @@ -2536,6 +2536,8 @@ This will cause @i{text} to be printed at verbose levels 2 and higher. @print{}@t{@ @ @ @ @ @ @ @ UNRESOLVED: }@i{name} +@print{}@t{@ @ @ @ @ @ @ @ UNSUPPORTED: }@i{name} + These indicate simple test results. @print{}@t{@ @ @ @ @ @ @ @ END: }@i{text} diff --git a/lib/dejagnu.exp b/lib/dejagnu.exp index 2489cc1..24b3c5f 100644 --- a/lib/dejagnu.exp +++ b/lib/dejagnu.exp @@ -140,6 +140,7 @@ proc host_execute {args} { XFAILED { xfail $output } UNTESTED { untested $output } UNRESOLVED { unresolved $output } + UNSUPPORTED { unsupported $output } END { expect -re {.+} { exp_continue } verbose "All done" 2 diff --git a/testsuite/libdejagnu/unit-c.c b/testsuite/libdejagnu/unit-c.c index aeccbd5..1265b70 100644 --- a/testsuite/libdejagnu/unit-c.c +++ b/testsuite/libdejagnu/unit-c.c @@ -45,6 +45,7 @@ main(int argc, char ** argv) else if (!strcmp("xfail", argv[i])) xfail("test"); else if (!strcmp("untested", argv[i])) untested("test"); else if (!strcmp("unresolved", argv[i])) unresolved("test"); + else if (!strcmp("unsupported", argv[i])) unsupported("test"); else if (!strcmp("note", argv[i])) note("test"); else { fprintf(stderr, "%s: unknown test `%s'\n", argv[0], argv[i]); diff --git a/testsuite/libdejagnu/unit.exp b/testsuite/libdejagnu/unit.exp index 9580806..545c7bb 100644 --- a/testsuite/libdejagnu/unit.exp +++ b/testsuite/libdejagnu/unit.exp @@ -31,13 +31,14 @@ proc test_libdejagnu_unit { language tests } { "expected failures" xfail untested untested unresolved unresolved + unsupported unsupported } foreach test $tests { array set expected_totals { pass 0 fail 0 xpass 0 xfail 0 - untested 0 unresolved 0 + untested 0 unresolved 0 unsupported 0 } set test_idx 0 set result pass @@ -73,13 +74,14 @@ proc test_libdejagnu_unit { language tests } { -re {(?:\A|\n)\t([][[:upper:]]+):([^\n]+)\n} { # above pattern copied from lib/dejagnu.exp:host_execute switch -- [lindex $test $test_idx] { - note { set expected NOTE } - pass { set expected PASSED } - fail { set expected FAILED } - xpass { set expected XPASSED } - xfail { set expected XFAILED } - untested { set expected UNTESTED } - unresolved { set expected UNRESOLVED } + note { set expected NOTE } + pass { set expected PASSED } + fail { set expected FAILED } + xpass { set expected XPASSED } + xfail { set expected XFAILED } + untested { set expected UNTESTED } + unresolved { set expected UNRESOLVED } + unsupported { set expected UNSUPPORTED } } if { [info exists expected_totals([lindex $test $test_idx])]} { incr expected_totals([lindex $test $test_idx]) @@ -124,5 +126,5 @@ proc test_libdejagnu_unit { language tests } { } test_libdejagnu_unit c { - note pass fail xpass xfail untested unresolved + note pass fail xpass xfail untested unresolved unsupported } |