Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / libmudflap / testsuite / libmudflap.c++ / ctors.exp
blob5d4f1efff61fd1bc7e4d06948e06c28b24395c29
2 libmudflap-init c++
4 dg-init
6 global srcdir subdir
8 foreach flags [list {} {-static} {-O2} {-O3}] {
9 set l1 [libmudflap_target_compile "$srcdir/$subdir/ctors-1.cxx" "ctors-1.o" object {additional_flags=-fmudflap}]
10 set test "ctors-1 compilation ${flags}"
11 if [string match "*mudflap cannot track unknown size extern *k*" $l1] { pass $test } { fail $test }
13 set l2 [libmudflap_target_compile "$srcdir/$subdir/ctors-2.cxx" "ctors-2.o" object {additional_flags=-fmudflap}]
14 set test "ctors-2 compilation ${flags}"
15 if [string match "" $l2] { pass $test } { fail $test }
17 set l3 [libmudflap_target_compile "ctors-1.o ctors-2.o" "ctors-12.exe" executable {additional_flags=-fmudflap additional_flags=-lmudflap additional_flags=-lstdc++}]
18 set test "ctors-12 linkage ${flags}"
19 if [string match "" $l3] { pass $test } { fail $test }
21 set l4 [libmudflap_target_compile "ctors-2.o ctors-1.o" "ctors-21.exe" executable {additional_flags=-fmudflap additional_flags=-lmudflap additional_flags=-lstdc++}]
22 set test "ctors-21 linkage ${flags}"
23 if [string match "" $l3] { pass $test } { fail $test }
25 setenv MUDFLAP_OPTIONS "-viol-segv"
27 remote_spawn host "./ctors-12.exe"
28 set l5 [remote_wait host 10]
29 set test "ctors-12 execution ${flags}"
30 if {[lindex $l5 0] == 0} { pass $test } { fail $test }
32 remote_spawn host "./ctors-21.exe"
33 set l6 [remote_wait host 10]
34 set test "ctors-21 execution ${flags}"
35 if {[lindex $l6 0] == 0} { pass $test } { fail $test }
37 foreach f [glob -nocomplain "ctors-*"] {
38 remote_file build delete $f
42 dg-finish