Skip to content

Commit f62eb7c

Browse files
committed
ts: ignore Spack warning lines in source-sh install tests
Spack reports on stderr the warnings raised when loading its package repository, for instance the syntax warning emitted by Python 3.12+ over an invalid escape sequence in a package file. Such a warning, introduced by the krona package, makes the bash source-sh test case fail on the tcl91 CI job, the only one running with a recent Python version. These warnings are unrelated to what is tested here, so drop the "==> Warning:" lines from stderr before comparing it against the expected output of the Spack test cases. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
1 parent d87dfe8 commit f62eb7c

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

‎testsuite/install.00-init/091-source-sh.exp‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,50 @@
2222
# test source-sh against Spack setup-env scripts if found installed for test
2323
if {[file exists spack/share/spack/setup-env.sh]} {
2424

25+
# Spack reports on stderr the warnings raised when loading its package
26+
# repository (like a SyntaxWarning from a package file on recent Python
27+
# versions), which is not what is tested here: drop these lines
28+
proc testall_cmd_spack {test_shell cmd answer anserr exitval} {
29+
_test_sub $test_shell $cmd
30+
set ::comp_error [regsub -all -line {^==> Warning: .*(\n|$)}\
31+
$::comp_error {}]
32+
if {[_test_out $test_shell $cmd $answer fail]\
33+
&& [_test_err $test_shell $cmd $anserr fail]\
34+
&& [_test_exit $test_shell $cmd $exitval fail]} {
35+
_test_ok $test_shell $cmd
36+
}
37+
}
38+
2539
if {{bash} in $shell_list} {
2640
set tsout "function\nenvironment-modules"
27-
testall_cmd bash "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; type -t _spack_pathadd && spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" $tsout {} 0
41+
testall_cmd_spack bash "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; type -t _spack_pathadd && spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" $tsout {} 0
2842
}
2943

3044
if {{ksh} in $shell_list} {
3145
set tserr "_spack_pathadd()\nenvironment-modules"
3246
# need to manually specify SPACK_ROOT prior script evaluation for ksh
33-
testall_cmd ksh "module use \"$testsuite_modpath.3\"\; export SPACK_ROOT=spack\; module load source-sh/spack\; typeset +f _spack_pathadd && spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" $tserr {} 0
47+
testall_cmd_spack ksh "module use \"$testsuite_modpath.3\"\; export SPACK_ROOT=spack\; module load source-sh/spack\; typeset +f _spack_pathadd && spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" $tserr {} 0
3448
}
3549

3650
if {{zsh} in $shell_list} {
3751
set tsout "_spack_pathadd\nenvironment-modules"
38-
testall_cmd zsh "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; typeset +f _spack_pathadd && spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" $tsout {} 0
52+
testall_cmd_spack zsh "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; typeset +f _spack_pathadd && spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" $tsout {} 0
3953
}
4054

4155
if {{tcsh} in $shell_list} {
4256
# not working on tcsh as variables used in spack alias are local variable, not environment variable
4357
set tserr "_spack_share_dir: Undefined variable."
44-
testall_cmd tcsh "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" {} $tserr 1
58+
testall_cmd_spack tcsh "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; spack list environment-modules\; module unload source-sh\; test -n \"\$PATH\"" {} $tserr 1
4559
}
4660

4761
if {{fish} in $shell_list} {
4862
set tsout "environment-modules"
4963
# module command seems superseded by spack definition on fish: cannot test unload
50-
testall_cmd fish "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; functions -q spack_pathadd\; and spack list environment-modules" $tsout {} 0
64+
testall_cmd_spack fish "module use \"$testsuite_modpath.3\"\; module load source-sh/spack\; functions -q spack_pathadd\; and spack list environment-modules" $tsout {} 0
5165
}
5266

67+
rename testall_cmd_spack {}
68+
5369
} else {
5470
send_user "\tSkipping source-sh tests over Spack scripts\n"
5571
}

0 commit comments

Comments
 (0)