diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/license.py | 1 | ||||
-rw-r--r-- | lib/spack/spack/test/sbang.py | 65 |
2 files changed, 0 insertions, 66 deletions
diff --git a/lib/spack/spack/cmd/license.py b/lib/spack/spack/cmd/license.py index 5fd57c39c9..84a4a02282 100644 --- a/lib/spack/spack/cmd/license.py +++ b/lib/spack/spack/cmd/license.py @@ -32,7 +32,6 @@ licensed_files = [ # spack scripts r'^bin/spack$', r'^bin/spack-python$', - r'^bin/sbang$', # all of spack core r'^lib/spack/spack/.*\.py$', diff --git a/lib/spack/spack/test/sbang.py b/lib/spack/spack/test/sbang.py index bdab7a8cfc..18bbe9f345 100644 --- a/lib/spack/spack/test/sbang.py +++ b/lib/spack/spack/test/sbang.py @@ -217,68 +217,3 @@ def test_install_sbang(install_mockery): # install again and make sure sbang is still fine sbang.install_sbang() check_sbang_installation() - - -def test_sbang_fails_without_argument(): - sbang = which(spack.paths.sbang_script) - sbang(fail_on_error=False) - assert sbang.returncode == 1 - - -@pytest.mark.parametrize("shebang,returncode,expected", [ - # perl, with and without /usr/bin/env - ("#!/path/to/perl", 0, "/path/to/perl -x"), - ("#!/usr/bin/env perl", 0, "/usr/bin/env perl -x"), - - # perl -w, with and without /usr/bin/env - ("#!/path/to/perl -w", 0, "/path/to/perl -w -x"), - ("#!/usr/bin/env perl -w", 0, "/usr/bin/env perl -w -x"), - - # ruby, with and without /usr/bin/env - ("#!/path/to/ruby", 0, "/path/to/ruby -x"), - ("#!/usr/bin/env ruby", 0, "/usr/bin/env ruby -x"), - - # python, with and without /usr/bin/env - ("#!/path/to/python", 0, "/path/to/python"), - ("#!/usr/bin/env python", 0, "/usr/bin/env python"), - - # php with one-line php comment - ("<?php #!/usr/bin/php ?>", 0, "/usr/bin/php"), - - # simple shell scripts - ("#!/bin/sh", 0, "/bin/sh"), - ("#!/bin/bash", 0, "/bin/bash"), - - # error case: sbang as infinite loop - ("#!/path/to/sbang", 1, None), - ("#!/usr/bin/env sbang", 1, None), - - # lua - ("--!/path/to/lua", 0, "/path/to/lua"), - - # node - ("//!/path/to/node", 0, "/path/to/node"), -]) -def test_sbang_with_specific_shebang( - tmpdir, shebang, returncode, expected): - - script = str(tmpdir.join("script")) - - # write a script out with <shebang> on second line - with open(script, "w") as f: - f.write("#!/bin/sh {sbang}\n{shebang}\n".format( - sbang=spack.paths.sbang_script, - shebang=shebang - )) - fs.set_executable(script) - - # test running the script in debug, which prints what would be executed - exe = which(script) - out = exe(output=str, fail_on_error=False, env={"SBANG_DEBUG": "1"}) - - # check error status and output vs. expected - assert exe.returncode == returncode - - if expected is not None: - expected += " " + script - assert expected == out.strip() |