set test "global_var" set testpath "$srcdir/$subdir" # Check each "global" value picks up the right one. # See GCC PR51410 and Systemtap PR10622 set ::result_string {main value@main: 42 getdistance value: 60 getdistance value@main: 42 getdistance value@speed: 6 getdistance value@distance: 60 getspeed value: 6 getspeed value@main: 42 getspeed value@speed: 6 getspeed value@distance: 60 compare value: 42 compare value@main: 42 compare value@speed: 6 compare value@distance: 60 main return value@main: 42} # Only run on make installcheck and uprobes present. if {! [installtest_p]} { untested "$test"; return } proc dyninst_kfails {index} { # The dyninst runtime isn't multi-arch, it only works on the # native architecture. PR14490. if {! [all_compile_flag_native_p $index]} { setup_kfail 14490 "*-*-*" } } set compiled_objs {} for {set i 0} {$i < [all_compile_flags]} {incr i} { set extra_flag [all_compile_flag $i] set extra_name [all_compile_flag_name $i] # Compile our object files separately, then combine with main. set oname "${test}_speed" set res [target_compile ${testpath}/${oname}.c ${oname}_${extra_name}.o object "$extra_flag additional_flags=-g"] if { $res != "" } { verbose "target_compile for ${oname} failed: $res" 2 fail "unable to compile ${oname} $extra_name" continue } lappend compiled_objs ${oname}_${extra_name}.o set oname2 "${test}_distance" set res [target_compile ${testpath}/${oname2}.c ${oname2}_${extra_name}.o object "$extra_flag additional_flags=-g"] if { $res != "" } { verbose "target_compile for ${oname2} failed: $res" 2 fail "unable to compile ${oname2} $extra_name" continue } lappend compiled_objs ${oname2}_${extra_name}.o set mname "${test}_main" set res [target_compile "${testpath}/${mname}.c ${oname}_${extra_name}.o ${oname2}_${extra_name}.o" ${mname}_${extra_name} executable "$extra_flag additional_flags=-g"] if { $res != "" } { verbose "target_compile failed: $res" 2 fail "unable to compile ${mname} $extra_name" continue } lappend compiled_objs ${mname}_${extra_name} foreach runtime [get_runtime_list] { if {$runtime != ""} { if {[info procs ${runtime}_kfails] ne ""} { ${runtime}_kfails $i } stap_run3 $test-$extra_name-$runtime $srcdir/$subdir/$test.stp \ -c ./${mname}_${extra_name} --runtime=$runtime } elseif {[uretprobes_p]} { stap_run3 $test-$extra_name $srcdir/$subdir/$test.stp \ -c ./${mname}_${extra_name} } else { untested "$test-$extra_name" } } } # Cleanup. Note we remove objects individually to avoid the command # line getting too long. if { $verbose == 0 && [llength compiled_objs] > 0 } { foreach obj $compiled_objs { catch { exec rm -f $obj } } }