Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libmudflap / testsuite / libmudflap.c++ / ctors.exp
1 global MUDFLAP_FLAGS
2 set MUDFLAP_FLAGS [list {-O0} {-static} {-O2} {-O3}]
3
4 libmudflap-init c++
5 if {$cxx == "g++"} then {
6     unsupported "g++ not found"
7     return
8 }
9
10 dg-init
11
12 global srcdir subdir
13
14 foreach flags $MUDFLAP_FLAGS {
15     set l1 [libmudflap_target_compile "$srcdir/$subdir/ctors-1.cxx" "ctors-1.o" object {additional_flags=-fmudflap}]
16     set test "ctors-1 compilation ${flags}"
17     if [string match "*mudflap cannot track unknown size extern *k*" $l1] { pass $test } { fail $test }
18
19     set l2 [libmudflap_target_compile "$srcdir/$subdir/ctors-2.cxx" "ctors-2.o" object {additional_flags=-fmudflap}]
20     set test "ctors-2 compilation ${flags}"
21     if [string match "" $l2]  { pass $test } { fail $test }
22
23     set l3 [libmudflap_target_compile "ctors-1.o ctors-2.o" "ctors-12.exe" executable {additional_flags=-fmudflap additional_flags=-lmudflap additional_flags=-lstdc++}]
24     set test "ctors-12 linkage ${flags}"
25     if [string match "" $l3]  { pass $test } { fail $test }
26
27     set l4 [libmudflap_target_compile "ctors-2.o ctors-1.o" "ctors-21.exe" executable {additional_flags=-fmudflap additional_flags=-lmudflap additional_flags=-lstdc++}]
28     set test "ctors-21 linkage ${flags}"
29     if [string match "" $l3]  { pass $test } { fail $test }
30
31     setenv MUDFLAP_OPTIONS "-viol-segv"
32
33     remote_spawn host "./ctors-12.exe"
34     set l5 [remote_wait host 10]
35     set test "ctors-12 execution ${flags}"
36     if {[lindex $l5 0] == 0}  { pass $test } { fail $test }
37
38     remote_spawn host "./ctors-21.exe"
39     set l6 [remote_wait host 10]
40     set test "ctors-21 execution ${flags}"
41     if {[lindex $l6 0] == 0}  { pass $test } { fail $test }
42
43     foreach f [glob -nocomplain "ctors-*"] {
44        remote_file build delete $f
45     }
46 }
47
48 dg-finish