jit: Fix truncation of testsuite output [PR69435]
authorAlex Coplan <alex.coplan@arm.com>
Mon, 20 Jul 2020 15:15:29 +0000 (16:15 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Mon, 20 Jul 2020 15:31:57 +0000 (16:31 +0100)
This fixes a bug in jit.exp which causes the DejaGnu output of the
libgccjit testsuite to be nondeterministically truncated. This bug was
copied from DejaGnu's own implementation of the host_execute function.
See the upstream bug report [0] where the maintainers point out that the
regex patterns in host_execute should (but don't currently) explicitly
match newlines to avoid relying on DejaGnu not reading more than one
line of the output (which is not guaranteed).

This should make it easier to test jit patches in the future, since it
makes it possible to reliably compare the output of two jit.sum files
(as with the other tests in GCC).

[0] : https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42399

gcc/testsuite/
PR jit/69435
* jit.dg/jit.exp (fixed_host_execute): Fix regex patterns to
always explicitly match newlines.

gcc/testsuite/jit.dg/jit.exp

index 2f54681713b86c44069da88efd769e01f7c7bae4..2d8c884b6b8c76c5919418adb77e6ac98399456c 100644 (file)
@@ -202,37 +202,37 @@ proc fixed_host_execute {args} {
            set timetol 0
            exp_continue
        }
-       -re "^$prefix\tNOTE:${text}*" {
+       -re "^$prefix\tNOTE:\[^\r\n\]+\r\n" {
            regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
-           set output [string range $output 6 end]
+           set output [string range $output 6 end-2]
            verbose "$output" 2
            set timetol 0
            exp_continue
        }
-       -re "^$prefix\tPASSED:${text}*" {
+       -re "^$prefix\tPASSED:\[^\r\n\]+\r\n" {
            regsub "\[\n\r\t\]*PASSED: $text\r\n" $expect_out(0,string) "" output
-           set output [string range $output 8 end]
+           set output [string range $output 8 end-2]
            pass "$output"
            set timetol 0
            exp_continue
        }
-       -re "^$prefix\tFAILED:${text}*" {
+       -re "^$prefix\tFAILED:\[^\r\n\]+\r\n" {
            regsub "\[\n\r\t\]*FAILED: $text\r\n" $expect_out(0,string) "" output
-           set output [string range $output 8 end]
+           set output [string range $output 8 end-2]
            fail "$output"
            set timetol 0
            exp_continue
        }
-       -re "^$prefix\tUNTESTED:${text}*" {
+       -re "^$prefix\tUNTESTED:\[^\r\n\]+\r\n" {
            regsub "\[\n\r\t\]*TESTED: $text\r\n" $expect_out(0,string) "" output
-           set output [string range $output 8 end]
+           set output [string range $output 8 end-2]
            untested "$output"
            set timetol 0
            exp_continue
        }
-       -re "^$prefix\tUNRESOLVED:${text}*" {
+       -re "^$prefix\tUNRESOLVED:\[^\r\n\]+\r\n" {
            regsub "\[\n\r\t\]*UNRESOLVED: $text\r\n" $expect_out(0,string) "" output
-           set output [string range $output 8 end]
+           set output [string range $output 8 end-2]
            unresolved "$output"
            set timetol 0
            exp_continue