# This test ensures that "-l" lists only include probe names, and not any of
# the local variables.  There was a bug that "-l" would print variables that
# couldn't be optimized away, due to an incorrect assumption in the
# implementation.

# NB: This is a bit abusively formed.  Currently -l internally writes "probe"
# and "{}" around its argument.  For this test we want to introduce a variable
# that can't be optimized away.  The trailing comment mark lets the auto "{}"
# get ignored.
spawn stap -l "begin { if (a) next }#"

set ok 0
expect {
    # the output should not include anything else, like the 'a' local.
    -re "^begin\r\n$" {
	incr ok
    }
}
catch {close}; catch {wait}
if {$ok == 1} {
    pass "probe list is correct"
} else {
    fail "probe list is incorrect"
}
