set test "at_var_lvalue"
set testpath "$srcdir/$subdir"
set exefile "[pwd]/$test"

# Test that @var("var") can be used as an lvalue in guru mode.
set ::result_string {0: @var("foo")->bar: 41
0: @var("foo@at_var_lvalue.c")->bar: 40
1: @var("foo@at_var_lvalue.c", @1)->bar: 37
2: @var("foo@at_var_lvalue.c", @1)->bar: 34}

# Only run on make installcheck and uprobes present.
if {! [installtest_p]} { untested "$test"; return }

set res [target_compile ${testpath}/${test}.c ${test} executable "additional_flags=-O2 additional_flags=-g"]
if { $res != "" } {
    verbose "target_compile failed: $res" 2
    fail "unable to compile ${test}.c"
}

foreach runtime [get_runtime_list] {
    if {$runtime != ""} {
        stap_run3 "$test ($runtime)" $srcdir/$subdir/$test.stp -c ./${test} -g $exefile \
            --runtime=$runtime

    } elseif {[uprobes_p]} {
        stap_run3 $test $srcdir/$subdir/$test.stp -c ./${test} -g $exefile

    } else {
        untested "$test"
    }
}

# Cleanup
if { $verbose == 0 } { catch { exec rm -f $test } }
