set test "suppress-time-limit"

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

foreach runtime [get_runtime_list] {
    set test_extra ""
    if {$runtime != ""} {
	set test_extra " ($runtime)"
	spawn stap --runtime=$runtime -g --suppress-time-limits \
	    $srcdir/$subdir/$test.stp
    } else {
	spawn stap -g --suppress-time-limits $srcdir/$subdir/$test.stp
    }
    set ok 0
    set ko 0
    # Testing that -g --suppress-time-limits works properly
    # by looping 100000 time and confirming the number of iterations
    # to what we expect.
    # The default setting only allows for 10000, so we want to test
    # against a value significantly larger than that.
    expect {
	-timeout 30
	-re {^100000\r\n} { incr ok; exp_continue }
	timeout { fail "$test active${test_extra} (timeout)" }
	eof { }
    }
    catch {close}; catch {wait}
    # The actual comparing of active values to what we expect.
    # For debugging purposes, output the value of the variables
    # so we can see which value failed (if any)
    if {$ok == 1} then {
	pass "$test active${test_extra} ($ok)"
    } else {
	fail "$test active${test_extra} ($ok)"
    }
    # Testing the case which should fail, without the new option,
    # and comparing the number of iterations to what we expect (ie 9997).
    if {$runtime != ""} {
	spawn stap --runtime=$runtime $srcdir/$subdir/$test.stp
    } else {
	spawn stap $srcdir/$subdir/$test.stp
    }
    expect {
	-timeout 30
	-re {^ERROR:[^\r\n]*\r\n} { incr ko; exp_continue }
	-re {^WARNING:[^\r\n]*\r\n} { incr ko; exp_continue }
	-re {^9997\r\n} { incr ko; exp_continue }
	eof { }
	timeout { fail "$test passive${test_extra} (timeout)" }
    }
    catch {close}; catch {wait}
    # The actual comparing of passive values to what we expect.
    # For debugging purposes, output the value of the variables
    # so we can see which value failed (if any)
    if {$ko == 4} then {
	pass "$test passive${test_extra} ($ko)"
    } else {
	fail "$test passive${test_extra} ($ko)"
    }
}
