diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-07-19 16:06:33 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-07-19 20:46:30 +0200 |
| commit | 520742c77fc3d52301c54b7d678948f9c7c69ac6 (patch) | |
| tree | 7f3cd45cd344d929e2a138af5bc3b47066e6de43 /suites/preprocess.py | |
| parent | 3a2214f5f6bf3d33166a57912c9a8d18fef808c7 (diff) | |
| download | minishell_test-520742c77fc3d52301c54b7d678948f9c7c69ac6.tar.gz minishell_test-520742c77fc3d52301c54b7d678948f9c7c69ac6.tar.bz2 minishell_test-520742c77fc3d52301c54b7d678948f9c7c69ac6.zip | |
Added permission tests on cmd_path, cd builtin and glob
Diffstat (limited to 'suites/preprocess.py')
| -rw-r--r-- | suites/preprocess.py | 152 |
1 files changed, 150 insertions, 2 deletions
diff --git a/suites/preprocess.py b/suites/preprocess.py index 503f3be..10417e5 100644 --- a/suites/preprocess.py +++ b/suites/preprocess.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:25:00 by charles #+# #+# # -# Updated: 2020/07/17 10:53:43 by charles ### ########.fr # +# Updated: 2020/07/19 16:01:07 by charles ### ########.fr # # # # ############################################################################ # @@ -35,6 +35,27 @@ def suite_quote(test): test('ls "" "" "" \'\' """"') test("ls '' '' '''' ''") + test("' echo' bonjour") + test("'echo ' bonjour") + test('" echo" bonjour') + test('"echo " bonjour') + + test("''echo bonjour") + test('""echo bonjour') + test("''''''''''''''''''''''''''''''''''''''''''''''''''''''''''echo bonjour") + test('""""""""""""""""""""""""""""""""""""""""""""""""""""""""""echo bonjour') + test("echo'' bonjour") + test('echo"" bonjour') + test("echo'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' bonjour") + test('echo"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" bonjour') + test("ec''ho bonjour") + test('ec""ho bonjour') + test("ec''''''''''''''''''''''''''''''''''''''''''''''''''''''''''ho bonjour") + test('ec""""""""""""""""""""""""""""""""""""""""""""""""""""""""""ho bonjour') + + test("'''''''e''''''''''c''''''''''''h''''''''o''''''''''''''''''''' bonjour") + test('"""""""e""""""""""c""""""""""""h""""""""o""""""""""""""""""""" bonjour') + @suite def suite_interpolation(test): test("echo $TEST", exports={"TEST": "bonjour"}) @@ -71,6 +92,9 @@ def suite_interpolation(test): test("echo $") + test("echo $\A $\B", exports={"A": "a", "B": "b"}) + test("echo $\A$\B", exports={"A": "a", "B": "b"}) + @suite def suite_glob(test): test("echo *") @@ -120,7 +144,16 @@ def suite_glob(test): test("echo /*") test("echo /etc/*") test("echo /usr/include/*.h") - test("echo /*/*") + test("echo /*/*", timeout=10) + test("echo /usr/*/*", timeout=10) + test("echo /usr/*") + test("echo /dev/*") + test("echo /etc/*") + test("echo /root/*") + test("echo /usr*") + test("echo /dev*") + test("echo /etc*") + test("echo /root*") test("echo *nothing") test("echo nothing*") @@ -142,6 +175,116 @@ def suite_glob(test): setup="mkdir src; touch src/a src/b src/c src/foo.c src/bar.c;\ mkdir inc; touch inc/a inc/b inc/c inc/foo.c inc/bar.c") + test("export A=*; echo $A") + test("A=*; echo $A") + + test("echo *", setup="mkdir d1; touch d1/a d1/b d1/c; ln -s d1 d1link") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; ln -s d1 d1link") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; ln -s d1 .d1link") + test("echo */*", setup="mkdir .d1; touch .d1/a .d1/b .d1/c; ln -s .d1 d1link") + test("echo .*/*", setup="mkdir d1; touch d1/a d1/b d1/c; ln -s d1 .d1link") + test("echo .*/*", setup="mkdir .d1; touch .d1/a .d1/b .d1/c; ln -s .d1 d1link") + + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 001 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 002 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 003 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 004 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 005 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 006 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 007 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 010 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 020 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 030 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 040 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 050 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 060 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 070 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 100 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 200 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 300 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 400 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 500 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 600 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 700 d1/a") + + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 755 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 644 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 311 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 111 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 222 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 333 d1/a") + + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 001 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 002 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 003 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 004 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 005 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 006 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 007 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 010 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 020 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 030 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 040 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 050 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 060 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 070 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 100 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 200 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 300 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 400 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 500 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 600 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 700 d1") + + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 755 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 644 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 311 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 111 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 222 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 333 d1") + + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 0777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 1000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 2000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 3000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 4000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 5000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 6000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 7000 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 1777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 2777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 3777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 4777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 5777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 6777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 7777 d1/a") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 0000 d1/a") + + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 0777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 1000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 2000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 3000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 4000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 5000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 6000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 7000 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 1777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 2777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 3777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 4777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 5777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 6777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 7777 d1") + test("echo */*", setup="mkdir d1; touch d1/a d1/b d1/c; chmod 0000 d1") + + test("echo *", setup="touch a; ln -s a b") + test("echo *", setup="touch a; ln -s a b; ln -s b c") + test("echo *", setup="touch a; ln -s a b; ln -s b c; ln -s c d") + test("echo d/*", setup="mkdir d; touch a b c d/d d/e d/f") + test("echo d/*", setup="mkdir d; touch a b c d/d d/e d/f; chmod 000 d") + @suite def suite_escape(test): test(r"echo \a") @@ -158,6 +301,11 @@ def suite_escape(test): test(r"echo \$PATH") test(r"echo \$\P\A\T\H") test(r"echo\ bonjour") + test(r"\ echo bonjour") + test(r" \ echo bonjour") + test(r" \ echo bonjour") + test(r" \ echo bonjour") + test(r" \ echo bonjour") @suite def suite_preprocess(test): |
