aboutsummaryrefslogtreecommitdiff
path: root/src/suites
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-28 10:55:34 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-28 10:55:34 +0200
commit1e713de9e5013c91495e0428179947f0764409a8 (patch)
tree177fa05ce16114f2c84d564a139ee0662c1c2d82 /src/suites
parent4a6fb4b3f1f7209f8d56cd18fdf59860c98dc884 (diff)
downloadminishell_test-1e713de9e5013c91495e0428179947f0764409a8.tar.gz
minishell_test-1e713de9e5013c91495e0428179947f0764409a8.tar.bz2
minishell_test-1e713de9e5013c91495e0428179947f0764409a8.zip
Fixing some setup commands in order to work on mac
Diffstat (limited to 'src/suites')
-rw-r--r--src/suites/cmd.py4
-rw-r--r--src/suites/path.py25
2 files changed, 17 insertions, 12 deletions
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": ""})