summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2021-08-27 10:52:00 +0200
committerGitHub <noreply@github.com>2021-08-27 10:52:00 +0200
commit12e87ebf140ea936b2d2711a09e557ac6d2179b9 (patch)
treef96eed8697bfab89203fbd6b10d1ce352527f30c /share
parent1113705080f8acb1634325b2fcdd0998d75a96fd (diff)
downloadspack-12e87ebf140ea936b2d2711a09e557ac6d2179b9.tar.gz
spack-12e87ebf140ea936b2d2711a09e557ac6d2179b9.tar.bz2
spack-12e87ebf140ea936b2d2711a09e557ac6d2179b9.tar.xz
spack-12e87ebf140ea936b2d2711a09e557ac6d2179b9.zip
Fix fish test "framework" (#25242)
Remove broken test, see #21699
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/qa/setup-env-test.fish50
1 files changed, 16 insertions, 34 deletions
diff --git a/share/spack/qa/setup-env-test.fish b/share/spack/qa/setup-env-test.fish
index c0738515d1..585b45bb9c 100755
--- a/share/spack/qa/setup-env-test.fish
+++ b/share/spack/qa/setup-env-test.fish
@@ -24,7 +24,7 @@ function allocate_testing_global -d "allocate global variables used for testing"
end
-function delete_testing_global -d "deallocate global varialbes used for testing"
+function delete_testing_global -d "deallocate global variables used for testing"
set -e __spt_red
set -e __spt_cyan
@@ -90,9 +90,12 @@ function spt_succeeds
set -l output (eval $argv 2>&1)
- if test $status -ne 0
+ # Save the command result
+ set cmd_status $status
+
+ if test $cmd_status -ne 0
fail
- echo_red "Command failed with error $status"
+ echo_red "Command failed with error $cmd_status"
if test -n "$output"
echo_msg "Output:"
echo "$output"
@@ -116,7 +119,7 @@ function spt_fails
if test $status -eq 0
fail
- echo_red "Command failed with error $status"
+ echo_red "Command succeeded, but should fail"
if test -n "$output"
echo_msg "Output:"
echo "$output"
@@ -142,9 +145,14 @@ function spt_contains
set -l output (eval $remaining_args 2>&1)
+ # Save the command result
+ set cmd_status $status
+
if not echo "$output" | string match -q -r ".*$target_string.*"
fail
- echo_red "Command exited with error $status"
+ if test $cmd_status -ne 0
+ echo_red "Command exited with error $cmd_status"
+ end
echo_red "'$target_string' was not in output."
if test -n "$output"
echo_msg "Output:"
@@ -249,13 +257,7 @@ echo "Creating a mock environment"
spack env create spack_test_env
# ensure that we uninstall b on exit
-function spt_cleanup
-
- set trapped_error false
- if test $status -ne 0
- set trapped_error true
- end
-
+function spt_cleanup -p %self
echo "Removing test environment before exiting."
spack env deactivate 2>&1 > /dev/null
spack env rm -y spack_test_env
@@ -268,30 +270,9 @@ function spt_cleanup
echo "$__spt_success tests succeeded."
echo "$__spt_errors tests failed."
- if test "$trapped_error" = false
- echo "Exited due to an error."
- end
-
- if test "$__spt_errors" -eq 0
- if test "$trapped_error" = false
- pass
- exit 0
- else
- fail
- exit 1
- end
- else
- fail
- exit 1
- end
-
delete_testing_global
end
-trap spt_cleanup EXIT
-
-
-
# -----------------------------------------------------------------------
# Test all spack commands with special env support
# -----------------------------------------------------------------------
@@ -322,7 +303,6 @@ spt_contains "set -gx LD_LIBRARY_PATH $_b_ld" spack -m load --only package --fis
spt_succeeds spack -m load b
# test a variable MacOS clears and one it doesn't for recursive loads
spt_contains "set -gx LD_LIBRARY_PATH $_a_ld:$_b_ld" spack -m load --fish a
-spt_contains "set -gx LIBRARY_PATH $_a_ld:$_b_ld" spack -m load --fish a
spt_succeeds spack -m load --only dependencies a
spt_succeeds spack -m load --only package a
spt_fails spack -m load d
@@ -393,3 +373,5 @@ is_not_set SPACK_ENV
# despacktivate
# is_not_set SPACK_ENV
# is_not_set SPACK_OLD_PS1
+
+test "$__spt_errors" -eq 0