2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / libjava / testsuite / libjava.verify / verify.exp
blob4abdc18acff3d9e72879c61c99185e4a268bf9c4
1 # Tests for class verifier.
3 global gcj_verify_xfail
4 set {gcj_verify_xfail(gij verify of call.fail.Static)} 1
5 set {gcj_verify_xfail(gij verify of simple.fail.dupfield)} 1
6 set {gcj_verify_xfail(gij verify of simple.fail.dupinterface)} 1
7 set {gcj_verify_xfail(gij verify of simple.fail.dupmethod)} 1
8 set {gcj_verify_xfail(gij verify of subr.fail.jsr10)} 1
9 set {gcj_verify_xfail(gij verify of subr.fail.jsr8)} 1
12 proc gcj_verify_list_tests {srcdir} {
13 set result {}
14 if {[file exists $srcdir]} {
15 set here [pwd]
16 cd $srcdir
17 foreach item [lsort [glob -nocomplain */*/*.class]] {
18 lappend result [file rootname $item]
20 cd $here
22 return $result
25 proc gcj_verify_test_gij {gij srcdir test shouldfail} {
26 global gcj_verify_xfail
28 set testname "gij verify of $test"
29 verbose "invoking gij $test - shouldfail=$shouldfail"
30 set result [libjava_load $gij [list --cp $srcdir $test] ""]
31 set status [lindex $result 0]
32 set output [lindex $result 1]
34 if {$shouldfail} {
35 # We match the few exceptions that are allowed. This may need
36 # updating from time to time. We do this rather than check the
37 # exit status because we want to catch the case where gij dies in
38 # some inappropriate way.
39 if {[string match *VerifyError* $output]
40 || [string match *AbstractMethodError* $output]
41 || [string match *IncompatibleClassChangeError* $output]} {
42 set cmd pass
43 } else {
44 set cmd fail
46 if {[info exists gcj_verify_xfail($testname)]} {
47 setup_xfail *-*-*
49 } else {
50 if {$status == "pass"} {
51 set cmd pass
52 } else {
53 set cmd fail
56 $cmd $testname
59 proc gcj_verify_run {} {
60 global INTERPRETER srcdir
62 set gij [libjava_find_gij]
63 set interpret 1
64 # libjava_find_gij will return "" if it couldn't find the
65 # program; in this case we want to skip the test.
66 if {$INTERPRETER != "yes" || $gij == ""} {
67 set interpret 0
70 set testsdir $srcdir/libjava.verify/verify
71 foreach test [gcj_verify_list_tests $testsdir] {
72 set shouldfail [string match */fail/* $test]
74 if {$interpret} {
75 regsub -all -- / $test . gijname
76 gcj_verify_test_gij $gij $testsdir $gijname $shouldfail
79 # FIXME: run gcj --syntax-only here.
83 gcj_verify_run