diff options
| -rwxr-xr-x | src/main.py | 2 | ||||
| -rw-r--r-- | src/suites/cmd.py | 4 | ||||
| -rw-r--r-- | src/suites/path.py | 25 |
3 files changed, 18 insertions, 13 deletions
diff --git a/src/main.py b/src/main.py index 8efb43c..fcb228f 100755 --- a/src/main.py +++ b/src/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # ############################################################################ # # # diff --git a/src/suites/cmd.py b/src/suites/cmd.py index 9363988..196ed85 100644 --- a/src/suites/cmd.py +++ b/src/suites/cmd.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 15:11:46 by charles #+# #+# # -# Updated: 2020/09/15 11:51:58 by charles ### ########.fr # +# Updated: 2020/09/28 10:40:39 by cacharle ### ########.fr # # # # ############################################################################ # @@ -186,7 +186,7 @@ def suite_cmd_path(test): test("_", setup="touch _") test("'-'", setup="touch -") test("./_", setup="touch _") - test("./-", setup="touch a; mv a -- -") + test("./-", setup="touch a; mv a ./-") test("./.", setup="touch .") test("./..", setup="touch ..") test("./somefile", setup='echo > somefile && chmod 0777 somefile') diff --git a/src/suites/path.py b/src/suites/path.py index c0d8c91..21085b3 100644 --- a/src/suites/path.py +++ b/src/suites/path.py @@ -6,16 +6,21 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/09 15:12:58 by charles #+# #+# # -# Updated: 2020/09/15 14:10:37 by charles ### ########.fr # +# Updated: 2020/09/28 10:49:12 by cacharle ### ########.fr # # # # ############################################################################ # +import distutils.spawn + from suite import suite @suite() def suite_path(test): - mode_fmt = "mkdir path && cp /bin/whoami ./path/a && chmod {} ./path/a" + whoami_path = distutils.spawn.find_executable("which") + mode_fmt = ("mkdir path && cp " + + whoami_path + + " ./path/a && chmod {} ./path/a") test("a", setup=mode_fmt.format("000"), exports={"PATH": "path"}) test("a", setup=mode_fmt.format("001"), exports={"PATH": "path"}) test("a", setup=mode_fmt.format("002"), exports={"PATH": "path"}) @@ -60,14 +65,14 @@ def suite_path(test): test("a", setup=mode_fmt.format("6777"), exports={"PATH": "path"}) test("a", setup=mode_fmt.format("7777"), exports={"PATH": "path"}) test("a", setup=mode_fmt.format("0000"), exports={"PATH": "path"}) - test("b", setup="mkdir path && cp /bin/whoami ./path/a && ln -s ./path/a ./path/b", exports={"PATH": "path"}) - test("b", setup="mkdir path && ln -s /bin/whoami ./path/b", exports={"PATH": "path"}) + test("b", setup="mkdir path && cp " + whoami_path + " ./path/a && ln -s ./path/a ./path/b", exports={"PATH": "path"}) + test("b", setup="mkdir path && ln -s " + whoami_path + " ./path/b", exports={"PATH": "path"}) test("a", setup="mkdir path && mkfifo path/a") test("a", setup="mkdir path && mkfifo path/a && chmod 777 path/a") - test("a", setup="mkdir path1 path2 && cp /bin/whoami path1/a" - "&& cp /bin/whoami path2/a && chmod 000 path1/a", exports={"PATH": "path1:path2"}) - test("a", setup="mkdir path1 path2 && cp /bin/whoami path1/a" - "&& cp /bin/whoami path2/a && chmod 000 path1/a", exports={"PATH": "path2:path1"}) + test("a", setup="mkdir path1 path2 && cp " + whoami_path + " path1/a" + "&& cp " + whoami_path + " path2/a && chmod 000 path1/a", exports={"PATH": "path1:path2"}) + test("a", setup="mkdir path1 path2 && cp " + whoami_path + " path1/a" + "&& cp " + whoami_path + " path2/a && chmod 000 path1/a", exports={"PATH": "path2:path1"}) @suite() @@ -93,8 +98,8 @@ def suites_path_variable(test): test("whoami", exports={"PATH": "________"}) test("whoami", exports={"PATH": " "}) test("whoami", exports={"PATH": " : "}) - test("whoami", exports={"PATH": " /bin "}) - test("whoami", exports={"PATH": "/bin:/bin:/bin:/bin"}) + test("whoami", exports={"PATH": " /usr/bin "}) + test("whoami", exports={"PATH": "/usr/bin:/usr/bin:/usr/bin:/usr/bin"}) test("whoami", exports={"PATH": " /sbin "}) test("whoami", exports={"PATH": "/sbin:/sbin:/sbin:/sbin"}) test("whoami", exports={"PATH": ""}) |
