1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
# Test that the --remote=host mechanism is working
# Requires the test user to specify hosts with automated ssh access.
set test "remote"
if {[info exists env(SYSTEMTAP_TESTREMOTES)]} {
set remotes [split $env(SYSTEMTAP_TESTREMOTES) ,]
}
if {[llength $remotes] == 0} {
set remotes {direct: stapsh:}
}
set batch_remotes [list]
verbose -log "$test: using $remotes"
if {![llength $remotes] || ![installtest_p]} { untested $test; return }
# Test each remote individually
foreach remote $remotes {
# Try building for the remote
spawn stap $srcdir/$subdir/$test.stp --remote=$remote -p4
expect {
-timeout 180
timeout { fail "$test build $remote (timeout)" }
eof { }
}
catch {close}; catch {wait} res
set rc [lindex $res 3]
if {$rc == 0} {
pass "$test build $remote"
} else {
fail "$test build $remote ($rc)"
untested "$test run $remote"
continue
}
# Try running on the remote
set begin 0
set end 0
set err 0
spawn stap $srcdir/$subdir/$test.stp --remote=$remote
expect {
-timeout 180
-re "^begin0:$remote\r\n" { incr begin; kill -INT [exp_pid] 5; exp_continue }
-re "^end0:$remote\r\n" { incr end; exp_continue }
-re {^[^\r\n]*\r\n} { incr err; exp_continue }
timeout { fail "$test run $remote (timeout)" }
eof { }
}
catch {close}; catch {wait}
if {!$err && $begin == 1 && $end == 1} {
pass "$test run $remote"
lappend batch_remotes "--remote=$remote"
} else {
fail "$test run $remote ($begin $end $err)"
}
}
verbose -log "$test: batch $batch_remotes"
if {[llength $batch_remotes] < 2} {
untested "$test batch"
} else {
# Try running the good ones together
set begin 0
set end 0
set err 0
eval spawn stap {$srcdir/$subdir/$test.stp} $batch_remotes
expect {
-timeout 180
-re {^begin[0-9]+:[^\r\n]+\r\n} {
incr begin
if {$begin == [llength $batch_remotes]} {kill -INT [exp_pid] 5}
exp_continue
}
-re {^end[0-9]+:[^\r\n]+\r\n} { incr end; exp_continue }
-re {^[^\r\n]*\r\n} {
incr err;
if {$err == 1} {kill -INT [exp_pid] 5}
exp_continue
}
timeout { fail "$test batch $batch_remotes (timeout)" }
eof { }
}
catch {close}; catch {wait}
if {!$err && [llength $batch_remotes] == $begin && $begin == $end} {
pass "$test batch $batch_remotes"
} else {
fail "$test batch $batch_remotes ($begin $end $err)"
}
}
|