Browse Source

Add explicit end-of-test marker to DejaGnu unit test protocol

master
Jacob Bachmeyer 3 years ago
parent
commit
999b7c0475
  1. 14
      ChangeLog
  2. 2
      dejagnu.h
  3. 8
      doc/dejagnu.texi
  4. 13
      lib/dejagnu.exp

14
ChangeLog

@ -1,3 +1,17 @@
2022-11-26 Jacob Bachmeyer <jcb@gnu.org>
* doc/dejagnu.texi (DejaGnu unit test protocol): Add end marker
line using "END" to allow detecting tests that exit prematurely.
The "Totals:" line was previously used for this purpose, but it
does not match the pattern documented as reserved for carrying
unit test results and information.
* lib/dejagnu.exp (host_execute): Remove test for "Totals" line.
(host_execute): Add corresponding support for the new line types.
* dejagnu.h (totals): Add end marker.
(TestState::totals): Likewise.
2022-10-04 Jacob Bachmeyer <jcb@gnu.org>
PR58065

2
dejagnu.h

@ -161,6 +161,7 @@ totals (void)
printf ("\t#untested:\t\t%d\n", untest);
if (unresolve)
printf ("\t#unresolved:\t\t%d\n", unresolve);
printf ("\tEND: done\n");
}
#ifdef __cplusplus
@ -263,6 +264,7 @@ class TestState {
std::cout << "\t#untested:\t\t" << untest << std::endl;
if (unresolve)
std::cout << "\t#unresolved:\t\t" << unresolve << std::endl;
std::cout << "\tEND: done" << std::endl;
}
// This is so this class can be printed in an ostream.

8
doc/dejagnu.texi

@ -10,7 +10,7 @@
@copying
@c man begin COPYRIGHT
Copyright @copyright{} 1992-2020 Free Software Foundation, Inc.
Copyright @copyright{} 1992-2020, 2022 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@ -2538,6 +2538,12 @@ This will cause @i{text} to be printed at verbose levels 2 and higher.
These indicate simple test results.
@print{}@t{@ @ @ @ @ @ @ @ END: }@i{text}
This indicates that the test case is complete. All subsequent output
from the test is ignored. A warning is produced if the test case
closes its output without producing this line.
Note that all output from a unit test program, including the lines
recognized and interpreted by DejaGnu, appears in the log.

13
lib/dejagnu.exp

@ -140,18 +140,16 @@ proc host_execute {args} {
XFAILED { xfail $output }
UNTESTED { untested $output }
UNRESOLVED { unresolved $output }
END {
expect -re {.+} { exp_continue }
verbose "All done" 2
}
default {
unresolved "unknown unit test token $expect_out(1,string)"
}
}
set timetol 0
exp_continue
}
-re {^Totals} {
# Flush the stream to allow the child process to finish writing
# logs or other information, instead of sending SIGPIPE.
expect -re {.+} { exp_continue }
verbose "All done" 2
if { $expect_out(1,string) ne "END" } { exp_continue }
}
-re {^[^\r\n]*([0-9][0-9]:..:..:[^\n]*)\n} {
# No one seems to know why this pattern is here or what it is
@ -170,6 +168,7 @@ proc host_execute {args} {
$executable $arguments"
}
eof {
warning "Test case did not emit an end marker"
}
timeout {
warning "Timed out executing test case"

Loading…
Cancel
Save