set test "auto_path" if {![installtest_p]} { untested $test; return } if {![uprobes_p]} { untested "$test"; return } # Note that the test diriectory name, '/tmp/stap_auto_path', is fixed # on purpose, since we're testing the auto path feature. This matches # up to the paths in the tapset directory. set cmd_dir "/tmp/stap_auto_path" set test_dir "$srcdir/$subdir" set include_root "$srcdir/$subdir/tapset" exec /bin/mkdir -p ${cmd_dir} set res [target_compile ${test_dir}/${test}.c ${cmd_dir}/ap executable "additional_flags=-g"] if { $res != "" } { fail "unable to compile ${test}.c" } exec /bin/mkdir -p ${cmd_dir}/a exec /bin/mkdir -p ${cmd_dir}/a/b exec /bin/mkdir -p ${cmd_dir}/b exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/a/ap1 exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/a/b/ap2 exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/b/ap3 set status 0 spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/a/ap1\")} probe ap1.process {println(pp()) exit()}" expect { -timeout 120 -re ${cmd_dir}/a/ap1.*main {incr status;} } catch { close }; catch { wait } if {$status == 1} {pass ${test}1} else {fail ${test}1} set status 0 spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/a/b/ap2\")} probe ap2 {println(pp()) exit()}" expect { -timeout 120 -re ${cmd_dir}/a/b/ap2.*main {incr status;} } catch { close }; catch { wait } if {$status == 1} {pass ${test}2} else {fail ${test}2} set status 0 spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/b/ap3\")} probe ap3 {println(pp()); exit()}" expect { -timeout 120 -re ${cmd_dir}/b/ap3.*main {incr status;} } catch { close }; catch { wait } if {$status == 1} {pass ${test}3} else {fail ${test}3} # cleanup exec /bin/rm -rf $cmd_dir