This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in dg.exp prevents the usage of dg magic comments in the test suite


when studying the proper use of dg magic comments, I have stepped over a bug 
in the dg harness. In my opinion it is only by accident that this bug has not 
crashed the test suite completely. 

It seems that there has been a conversion from an "old" to a "new"  dg 
framework. Some of the key procedures, however, seem still to assume that 
variables are still having the content they used to have in the "old" 
E.g. one variable ${dg-do-what} used to be a list of two elements where 
element #1 contained a string "F" "P" "N" reflecting whether the test is 
supposed to pass, fail or skipped. Presently, however, this list has 3 
members and the respective string is element #2!
The proc that is used for the majority of the testsuite test cases (proc 
dg-test in the file dg.exp of the dejagnu library) however still uses element 
#1 of ${dg-do-what} for finding out what to do with the test case.

I therefore had to realize, that many of the magic comments within the test 
cases do not work as intended for this reason. E.g. all of the magic comments 
that are supposed to exclude testcases from compilation for the 6811 and 6812 
targets do no longer work.

You will find enclosed a patch that needs to be applied to dg.exp.

Difficult thing is: 
The patch needs to be applied outside of the gcc source tree, i.e. within the 
dejagnu sources. If I now start adapting the testsuite for being useful for 
the avr target, it possibly might make the test suite crash for all the other 
targets unless the one who is running the tests has also fixed the bug in the 
dejagnu harness.

Any idea how to proceed?



# Patch for file dg.exp to be applied to current dejagnu-1.4.4.
# Removes bug of    
#               dg-do  xfail/target pattern and
# adds support for a new 
#               dg-do skip {target-triple-list } 
# pattern that is the opposite of the target pattern: i.e. the test case
# is assumed to be supported for all targets except those that
# are explicitly named in the curly brackets.

< # dg-do do-what-keyword [{ target/xfail selector }]
> # dg-do do-what-keyword [{ target/xfail/skip selector }]
< # SELECTOR is "xfail target-triplet-1 ..." or "target target-triplet-1 ..."
< # `target-triplet' may be "native".
> # SELECTOR is "xfail target-triplet-1 ...", "skip target-triplet-1 ..."
> #  or "target target-triplet-1 ..." . `target-triplet' may be "native".
> # For skip, the result is "N" (unsupported test) if the current target is 
> # otherwise "P" (expected to Pass).
< # otherwise "N" (target is Not selected).
> # otherwise "N" (target is not selected).
>     } elseif [regexp "^skip " $selector] {
>         set what skip
< 	return [expr { $what == "xfail" ? "F" : "S" }]
>         if {$what == "xfail"} {
> 	  return "F"
> 	} elseif {$what == "skip"} {
> 	  return "N"
> 	} else {
> 	  return "S"
> 	} 
< 	return [expr { $what == "xfail" ? "P" : "N" }]
>         if {$what == "xfail"} {
> 	  return "P"
> 	} elseif {$what == "skip"} {
> 	  return "P"
> 	} else {
> 	  return "N"
> 	}  
<     if { [lindex ${dg-do-what} 1] == "N" } {
>     if { [lindex ${dg-do-what} 2] == "N" } {
< 	    fail "$name (test for excess errors)"
< 	    send_log "Excess errors:\n$comp_output\n"
>             if {[lindex ${dg-do-what} 2] == "F"} {
>                xfail "$name (test for excess errors)"
>             } else {
> 	       fail "$name (test for excess errors)"
> 	       send_log "Excess errors:\n$comp_output\n"
>             }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]