aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hooks.py7
-rw-r--r--src/suites/builtin.py6
-rw-r--r--src/suites/cmd.py120
-rw-r--r--src/suites/path.py164
4 files changed, 164 insertions, 133 deletions
diff --git a/src/hooks.py b/src/hooks.py
index e2fbcf8..f14c8f7 100644
--- a/src/hooks.py
+++ b/src/hooks.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 16:10:20 by charles #+# #+# #
-# Updated: 2020/09/13 09:50:21 by charles ### ########.fr #
+# Updated: 2020/09/15 11:44:14 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -43,3 +43,8 @@ def export_singleton(output):
'\n'.join([line for line in output.split('\n')
if re.match("^{}.+=\".*\"$".format(prefix), line) is not None])
)
+
+
+def replace_double_slash(output):
+ """Replace occurence of double slash by one"""
+ return output.replace("//", "/")
diff --git a/src/suites/builtin.py b/src/suites/builtin.py
index 40c4eb5..fdc3a08 100644
--- a/src/suites/builtin.py
+++ b/src/suites/builtin.py
@@ -6,7 +6,7 @@
# By: juligonz <juligonz@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/15 18:24:43 by charles #+# #+# #
-# Updated: 2020/09/13 13:57:13 by charles ### ########.fr #
+# Updated: 2020/09/15 11:44:48 by charles ### ########.fr #
# Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr #
# #
# **************************************************************************** #
@@ -135,7 +135,7 @@ def suite_cd(test):
test("cd /.; pwd; echo $PWD")
test("cd /./; pwd; echo $PWD")
test("cd /././././; pwd; echo $PWD")
- test("cd //; pwd; echo $PWD")
+ test("cd //; pwd; echo $PWD", hook=hooks.replace_double_slash)
test("cd ///; pwd; echo $PWD")
test("cd ////; pwd; echo $PWD")
test("cd //////////////////////////////////////////////////////; pwd; echo $PWD")
@@ -145,7 +145,7 @@ def suite_cd(test):
test("cd ' /'; pwd; echo $PWD")
test("cd ' / '; pwd; echo $PWD")
test("cd ' // '; pwd; echo $PWD")
- test("cd //home; pwd; echo $PWD")
+ test("cd //home; pwd; echo $PWD", hook=hooks.replace_double_slash)
test("cd ' //home'; pwd; echo $PWD")
test("cd ' //home '; pwd; echo $PWD")
test("cd d", setup="mkdir -m 000 d")
diff --git a/src/suites/cmd.py b/src/suites/cmd.py
index d8770d4..9363988 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/12 10:51:19 by charles ### ########.fr #
+# Updated: 2020/09/15 11:51:58 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -131,34 +131,34 @@ def suite_cmd_path(test):
setup="touch a b c; echo bonjour > a; cp {} ls".format(cat_path))
test("ls . a b c",
setup="touch a b c; echo bonjour > a; cp {} ls".format(cat_path))
- test("./somefile", setup="touch somefile; chmod 000 somefile")
- test("./somefile", setup="touch somefile; chmod 001 somefile")
- test("./somefile", setup="touch somefile; chmod 002 somefile")
- test("./somefile", setup="touch somefile; chmod 003 somefile")
- test("./somefile", setup="touch somefile; chmod 004 somefile")
- test("./somefile", setup="touch somefile; chmod 005 somefile")
- test("./somefile", setup="touch somefile; chmod 006 somefile")
- test("./somefile", setup="touch somefile; chmod 007 somefile")
- test("./somefile", setup="touch somefile; chmod 010 somefile")
- test("./somefile", setup="touch somefile; chmod 020 somefile")
- test("./somefile", setup="touch somefile; chmod 030 somefile")
- test("./somefile", setup="touch somefile; chmod 040 somefile")
- test("./somefile", setup="touch somefile; chmod 050 somefile")
- test("./somefile", setup="touch somefile; chmod 060 somefile")
- test("./somefile", setup="touch somefile; chmod 070 somefile")
- test("./somefile", setup="touch somefile; chmod 100 somefile")
- test("./somefile", setup="touch somefile; chmod 200 somefile")
- test("./somefile", setup="touch somefile; chmod 300 somefile")
- test("./somefile", setup="touch somefile; chmod 400 somefile")
- test("./somefile", setup="touch somefile; chmod 500 somefile")
- test("./somefile", setup="touch somefile; chmod 600 somefile")
- test("./somefile", setup="touch somefile; chmod 700 somefile")
- test("./somefile", setup="touch somefile; chmod 755 somefile")
- test("./somefile", setup="touch somefile; chmod 644 somefile")
- test("./somefile", setup="touch somefile; chmod 311 somefile")
- test("./somefile", setup="touch somefile; chmod 111 somefile")
- test("./somefile", setup="touch somefile; chmod 222 somefile")
- test("./somefile", setup="touch somefile; chmod 333 somefile")
+ test("./somefile", setup="echo > somefile; chmod 000 somefile")
+ test("./somefile", setup="echo > somefile; chmod 001 somefile")
+ test("./somefile", setup="echo > somefile; chmod 002 somefile")
+ test("./somefile", setup="echo > somefile; chmod 003 somefile")
+ test("./somefile", setup="echo > somefile; chmod 004 somefile")
+ test("./somefile", setup="echo > somefile; chmod 005 somefile")
+ test("./somefile", setup="echo > somefile; chmod 006 somefile")
+ test("./somefile", setup="echo > somefile; chmod 007 somefile")
+ test("./somefile", setup="echo > somefile; chmod 010 somefile")
+ test("./somefile", setup="echo > somefile; chmod 020 somefile")
+ test("./somefile", setup="echo > somefile; chmod 030 somefile")
+ test("./somefile", setup="echo > somefile; chmod 040 somefile")
+ test("./somefile", setup="echo > somefile; chmod 050 somefile")
+ test("./somefile", setup="echo > somefile; chmod 060 somefile")
+ test("./somefile", setup="echo > somefile; chmod 070 somefile")
+ test("./somefile", setup="echo > somefile; chmod 100 somefile")
+ test("./somefile", setup="echo > somefile; chmod 200 somefile")
+ test("./somefile", setup="echo > somefile; chmod 300 somefile")
+ test("./somefile", setup="echo > somefile; chmod 400 somefile")
+ test("./somefile", setup="echo > somefile; chmod 500 somefile")
+ test("./somefile", setup="echo > somefile; chmod 600 somefile")
+ test("./somefile", setup="echo > somefile; chmod 700 somefile")
+ test("./somefile", setup="echo > somefile; chmod 755 somefile")
+ test("./somefile", setup="echo > somefile; chmod 644 somefile")
+ test("./somefile", setup="echo > somefile; chmod 311 somefile")
+ test("./somefile", setup="echo > somefile; chmod 111 somefile")
+ test("./somefile", setup="echo > somefile; chmod 222 somefile")
+ test("./somefile", setup="echo > somefile; chmod 333 somefile")
test("somedir/", setup="mkdir somedir")
test("./somedir/", setup="mkdir somedir")
test("somedir", setup="mkdir somedir")
@@ -189,37 +189,37 @@ def suite_cmd_path(test):
test("./-", setup="touch a; mv a -- -")
test("./.", setup="touch .")
test("./..", setup="touch ..")
- test("./somefile", setup='touch somefile && chmod 0777 somefile')
- test("./somefile", setup='touch somefile && chmod 1000 somefile')
- test("./somefile", setup='touch somefile && chmod 2000 somefile')
- test("./somefile", setup='touch somefile && chmod 3000 somefile')
- test("./somefile", setup='touch somefile && chmod 4000 somefile')
- test("./somefile", setup='touch somefile && chmod 5000 somefile')
- test("./somefile", setup='touch somefile && chmod 6000 somefile')
- test("./somefile", setup='touch somefile && chmod 7000 somefile')
- test("./somefile", setup='touch somefile && chmod 1777 somefile')
- test("./somefile", setup='touch somefile && chmod 2777 somefile')
- test("./somefile", setup='touch somefile && chmod 3777 somefile')
- test("./somefile", setup='touch somefile && chmod 4777 somefile')
- test("./somefile", setup='touch somefile && chmod 5777 somefile')
- test("./somefile", setup='touch somefile && chmod 6777 somefile')
- test("./somefile", setup='touch somefile && chmod 7777 somefile')
- test("./somefile", setup='touch somefile && chmod 0000 somefile')
- test("./somedir", setup='mkdir somedir && chmod 0777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 1000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 2000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 3000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 4000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 5000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 6000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 7000 somedir')
- test("./somedir", setup='mkdir somedir && chmod 1777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 2777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 3777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 4777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 5777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 6777 somedir')
- test("./somedir", setup='mkdir somedir && chmod 0000 somedir')
+ test("./somefile", setup='echo > somefile && chmod 0777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 1000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 2000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 3000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 4000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 5000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 6000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 7000 somefile')
+ test("./somefile", setup='echo > somefile && chmod 1777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 2777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 3777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 4777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 5777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 6777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 7777 somefile')
+ test("./somefile", setup='echo > somefile && chmod 0000 somefile')
+ test("./somedir", setup='mkdir -m 0777 somedir')
+ test("./somedir", setup='mkdir -m 1000 somedir')
+ test("./somedir", setup='mkdir -m 2000 somedir')
+ test("./somedir", setup='mkdir -m 3000 somedir')
+ test("./somedir", setup='mkdir -m 4000 somedir')
+ test("./somedir", setup='mkdir -m 5000 somedir')
+ test("./somedir", setup='mkdir -m 6000 somedir')
+ test("./somedir", setup='mkdir -m 7000 somedir')
+ test("./somedir", setup='mkdir -m 1777 somedir')
+ test("./somedir", setup='mkdir -m 2777 somedir')
+ test("./somedir", setup='mkdir -m 3777 somedir')
+ test("./somedir", setup='mkdir -m 4777 somedir')
+ test("./somedir", setup='mkdir -m 5777 somedir')
+ test("./somedir", setup='mkdir -m 6777 somedir')
+ test("./somedir", setup='mkdir -m 0000 somedir')
# @suite(bonus=True)
diff --git a/src/suites/path.py b/src/suites/path.py
index d2c9272..2c38c5c 100644
--- a/src/suites/path.py
+++ b/src/suites/path.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/09 15:12:58 by charles #+# #+# #
-# Updated: 2020/09/14 19:28:30 by charles ### ########.fr #
+# Updated: 2020/09/15 13:37:17 by charles ### ########.fr #
# #
# ############################################################################ #
@@ -15,71 +15,97 @@ from suite import suite
@suite()
def suite_path(test):
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 001 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 002 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 003 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 004 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 005 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 006 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 007 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 010 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 020 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 030 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 040 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 050 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 060 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 070 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 100 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 200 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 300 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 400 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 500 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 600 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 700 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 755 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 644 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 311 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 111 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 222 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 333 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 0777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 1000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 2000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 3000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 4000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 5000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 6000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 7000 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 1777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 2777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 3777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 4777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 5777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 6777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 7777 ./path/a", exports={"PATH": "path"})
- test("a", setup="mkdir path && cp /bin/ls ./path/a && chmod 0000 ./path/a", exports={"PATH": "path"})
- test("b", setup="mkdir path && cp /bin/ls ./path/a && ln -s ./path/a ./path/b", exports={"PATH": "path"})
- test("ls", exports={"PATH": "doesnotexits"})
- test("ls", exports={"PATH": "doesnotexits:asdfasdfas"})
- test("ls", exports={"PATH": "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z"})
- test("ls", exports={"PATH": "________"})
- test("ls", exports={"PATH": " "})
- test("ls", exports={"PATH": " : "})
- test("ls", exports={"PATH": " /bin "})
- test("ls", exports={"PATH": "/bin:/bin:/bin:/bin"})
- test("ls", exports={"PATH": ""})
- test("ls", exports={"PATH": ":"})
- test("ls", exports={"PATH": ":::::::::::::::::::"})
- test("ls", exports={"PATH": "/asdfasdf"})
- test("ls", exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"})
- test("ls", setup="unset PATH")
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ""})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ":"})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "::::::::"})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "/asdfasdf"})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd; unset PATH")
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": "/bin:"})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ":/bin"})
- test("somecmd", setup="echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd", exports={"PATH": ":/bin:"})
+ mode_fmt = "mkdir path && cp /bin/whoami ./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"})
+ test("a", setup=mode_fmt.format("003"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("004"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("005"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("006"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("007"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("010"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("020"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("030"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("040"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("050"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("060"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("070"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("100"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("200"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("300"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("400"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("500"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("600"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("700"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("755"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("644"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("311"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("111"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("222"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("333"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("0777"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("1000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("2000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("3000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("4000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("5000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("6000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("7000"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("1777"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("2777"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("3777"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("4777"), exports={"PATH": "path"})
+ test("a", setup=mode_fmt.format("5777"), exports={"PATH": "path"})
+ 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("a", setup="mkdir path && mkfifo path/a")
+ test("a", setup="mkdir path && mkfifo path/a && chmod 777 path/a")
+
+
+@suite()
+def suites_path_variable(test):
+ test("echo $PATH", exports={"PATH": "doesnotexits"})
+ test("echo $PATH", exports={"PATH": "doesnotexits:asdfasdfas"})
+ test("echo $PATH", exports={"PATH": "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z"})
+ test("echo $PATH", exports={"PATH": "________"})
+ test("echo $PATH", exports={"PATH": " "})
+ test("echo $PATH", exports={"PATH": " : "})
+ test("echo $PATH", exports={"PATH": " /bin "})
+ test("echo $PATH", exports={"PATH": " /sbin "})
+ test("echo $PATH", exports={"PATH": "/bin:/bin:/bin:/bin"})
+ test("echo $PATH", exports={"PATH": "/sbin:/sbin:/sbin:/sbin"})
+ test("echo $PATH", exports={"PATH": ""})
+ test("echo $PATH", exports={"PATH": ":"})
+ test("echo $PATH", exports={"PATH": ":::::::::::::::::::"})
+ test("echo $PATH", exports={"PATH": "/asdfasdf"})
+ test("echo $PATH", exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"})
+ test("whoami", exports={"PATH": "doesnotexits"})
+ test("whoami", exports={"PATH": "doesnotexits:asdfasdfas"})
+ test("whoami", exports={"PATH": "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z"})
+ 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": " /sbin "})
+ test("whoami", exports={"PATH": "/sbin:/sbin:/sbin:/sbin"})
+ test("whoami", exports={"PATH": ""})
+ test("whoami", exports={"PATH": ":"})
+ test("whoami", exports={"PATH": ":::::::::::::::::::"})
+ test("whoami", exports={"PATH": "/asdfasdf"})
+ test("whoami", exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"})
+ test("whoami", setup="unset PATH")
+ create_cmd_setup = "echo '#!/bin/sh\necho bonjour' > somecmd; chmod +x somecmd"
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": ""})
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": ":"})
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": "::::::::"})
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": "/asdfasdf"})
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": "/usr/asdf:/usr/lib/asdfasdf"})
+ test("somecmd", setup=create_cmd_setup + "; unset PATH")
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": "/bin:"})
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": ":/bin"})
+ test("somecmd", setup=create_cmd_setup, exports={"PATH": ":/bin:"})