set test "beginenderror"

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

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

    # The VERREL stuff is just for compile-testing that option; it plays no
    # real role in this test.
    spawn stap -DSTP_NO_VERREL_CHECK $args $srcdir/$subdir/beginenderror.stp
    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)" 
    }
}
