-# This test exists solely to exercise the "environment" commands for
-# code-coverage on HP-UX.
-#
-if ![istarget "hppa*-*-hpux*"] then {
- return
-}
-
-standard_testfile break.c break1.c
-
-if {[prepare_for_testing "failed to prepare" $testfile \
- [list $srcfile $srcfile2] {debug nowarnings}]} {
- return -1
-}
-
-if ![runto_main] then { fail "environment command tests suppressed" }
-
-# (No, this is not really related to the environment commands. But it's
-# a convenient place to verify that this command works.)
-#
-send_gdb "info program\n"
-gdb_expect {
- -re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
- {pass "info program"}
- -re "$gdb_prompt $"\
- {fail "info program"}
- timeout {fail "(timeout) info program"}
-}
-
-# We don't really care where this step lands, so long as it gets
-# the inferior pushed off the breakpoint it's currently on...
-#
-send_gdb "next\n"
-gdb_expect {
- -re ".*$gdb_prompt $"\
- {pass "step before info program"}
- timeout {fail "(timeout) step before info program"}
+proc test_set_show_env_var { name value test_name } {
+ gdb_test_no_output "set environment $name $value" "$test_name"
+ gdb_test "show environment $name" "$name = $value" \
+ "confirm $test_name"