set test "beginenderror"

if {![installtest_p]} {untested $test; return}

foreach runtime [get_runtime_list] {
    set test "beginenderror"
    set args ""
    if {$runtime != ""} {
	lappend test "($runtime)"
	set args "--runtime=$runtime"
    }

    spawn stap $srcdir/$subdir/beginenderror.stp $args
    set ok1 0
    set ok2 0
    set ko 0
    expect {
	-timeout 30
	-re {^ERROR:[^\r\n]*\r\n} { incr ok1; exp_continue }
	-re {^WARNING:[^\r\n]*\r\n} { incr ok1; exp_continue }
	-re {^ok[^\r\n]*\r\n} { incr ok2; exp_continue }
	-re {^ko[^\r\n]*\r\n} { incr ko; exp_continue }
	timeout { fail "$test (timeout)" }
	eof { }
    }
    catch { close }; catch { wait }
    if {$ok1 == 5 && $ok2 == 3 && $ko == 0} then {
	pass "$test ($ok1 $ok2 $ko)"
    } else {
	fail "$test ($ok1 $ok2 $ko)" 
    }
}
