unit tests: replace /bin/bash with /bin/sh (#41495)

This commit is contained in:
Harmen Stoppels 2023-12-11 11:11:27 +01:00 committed by GitHub
parent 16bb4c360a
commit 28b49d5d2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View file

@ -25,7 +25,7 @@ def test_error_when_multiple_specs_are_given():
assert "only takes one spec" in output assert "only takes one spec" in output
@pytest.mark.parametrize("args", [("--", "/bin/bash", "-c", "echo test"), ("--",), ()]) @pytest.mark.parametrize("args", [("--", "/bin/sh", "-c", "echo test"), ("--",), ()])
@pytest.mark.usefixtures("config", "mock_packages", "working_env") @pytest.mark.usefixtures("config", "mock_packages", "working_env")
def test_build_env_requires_a_spec(args): def test_build_env_requires_a_spec(args):
output = build_env(*args, fail_on_error=False) output = build_env(*args, fail_on_error=False)
@ -35,7 +35,7 @@ def test_build_env_requires_a_spec(args):
_out_file = "env.out" _out_file = "env.out"
@pytest.mark.parametrize("shell", ["pwsh", "bat"] if sys.platform == "win32" else ["bash"]) @pytest.mark.parametrize("shell", ["pwsh", "bat"] if sys.platform == "win32" else ["sh"])
@pytest.mark.usefixtures("config", "mock_packages", "working_env") @pytest.mark.usefixtures("config", "mock_packages", "working_env")
def test_dump(shell_as, shell, tmpdir): def test_dump(shell_as, shell, tmpdir):
with tmpdir.as_cwd(): with tmpdir.as_cwd():

View file

@ -2000,7 +2000,7 @@ def test_ci_reproduce(
install_script = os.path.join(working_dir.strpath, "install.sh") install_script = os.path.join(working_dir.strpath, "install.sh")
with open(install_script, "w") as fd: with open(install_script, "w") as fd:
fd.write("#!/bin/bash\n\n#fake install\nspack install blah\n") fd.write("#!/bin/sh\n\n#fake install\nspack install blah\n")
spack_info_file = os.path.join(working_dir.strpath, "spack_info.txt") spack_info_file = os.path.join(working_dir.strpath, "spack_info.txt")
with open(spack_info_file, "w") as fd: with open(spack_info_file, "w") as fd:

View file

@ -253,8 +253,8 @@ def test_get_compiler_link_paths_load_env(working_env, monkeypatch, tmpdir):
gcc = str(tmpdir.join("gcc")) gcc = str(tmpdir.join("gcc"))
with open(gcc, "w") as f: with open(gcc, "w") as f:
f.write( f.write(
"""#!/bin/bash """#!/bin/sh
if [[ $ENV_SET == "1" && $MODULE_LOADED == "1" ]]; then if [ "$ENV_SET" = "1" ] && [ "$MODULE_LOADED" = "1" ]; then
echo '""" echo '"""
+ no_flag_output + no_flag_output
+ """' + """'
@ -699,8 +699,8 @@ def test_compiler_get_real_version(working_env, monkeypatch, tmpdir):
gcc = str(tmpdir.join("gcc")) gcc = str(tmpdir.join("gcc"))
with open(gcc, "w") as f: with open(gcc, "w") as f:
f.write( f.write(
"""#!/bin/bash """#!/bin/sh
if [[ $CMP_ON == "1" ]]; then if [ "$CMP_ON" = "1" ]; then
echo "$CMP_VER" echo "$CMP_VER"
fi fi
""" """
@ -745,8 +745,8 @@ def test_compiler_get_real_version_fails(working_env, monkeypatch, tmpdir):
gcc = str(tmpdir.join("gcc")) gcc = str(tmpdir.join("gcc"))
with open(gcc, "w") as f: with open(gcc, "w") as f:
f.write( f.write(
"""#!/bin/bash """#!/bin/sh
if [[ $CMP_ON == "1" ]]; then if [ "$CMP_ON" = "1" ]; then
echo "$CMP_VER" echo "$CMP_VER"
fi fi
""" """
@ -799,7 +799,7 @@ def test_compiler_flags_use_real_version(working_env, monkeypatch, tmpdir):
gcc = str(tmpdir.join("gcc")) gcc = str(tmpdir.join("gcc"))
with open(gcc, "w") as f: with open(gcc, "w") as f:
f.write( f.write(
"""#!/bin/bash """#!/bin/sh
echo "4.4.4" echo "4.4.4"
""" """
) # Version for which c++11 flag is -std=c++0x ) # Version for which c++11 flag is -std=c++0x