diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/args.py | 22 | ||||
| -rw-r--r-- | src/config.py | 8 | ||||
| -rwxr-xr-x | src/main.py | 7 | ||||
| -rw-r--r-- | src/suites/builtin.py | 4 |
4 files changed, 29 insertions, 12 deletions
diff --git a/src/args.py b/src/args.py index 9f31d98..a7dda05 100644 --- a/src/args.py +++ b/src/args.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:32 by charles #+# #+# # -# Updated: 2020/09/12 02:21:51 by charles ### ########.fr # +# Updated: 2020/09/13 14:45:15 by charles ### ########.fr # # # # ############################################################################ # @@ -22,29 +22,33 @@ def parse_args(): ) parser.add_argument( "-v", "--verbose", action="count", - help="increase verbosity level (e.g -vv == 2)" + help="Increase verbosity level (e.g -vv == 2)" ) parser.add_argument( "-b", "--bonus", action="store_true", - help="enable bonus tests" + help="Enable bonus tests" ) parser.add_argument( "-n", "--no-bonus", action="store_true", - help="disable bonus tests" + help="Disable bonus tests" ) parser.add_argument( "-l", "--list", action="store_true", - help="print available test suites" + help="Print available test suites" ) parser.add_argument( "-m", "--make", action="store_true", - help="make minishell and exit" + help="Make minishell and exit" + ) + parser.add_argument( + "-p", "--pager", action="store_true", + help="After running the test, display the result in a pager of your choice" ) parser.add_argument( "suites", nargs='*', metavar="suite", - help="test suites/group to run, " - "It tries to be smart and auto complete the suite name " - "you put in (e.g ./run int -> ./run preprocess/interpolation)" + help="Test suites/group to run. " + "It tries to be smart and autocomplete the suite name " + "(e.g ./run int -> ./run preprocess/interpolation)" ) tmp = parser.parse_args() if tmp.verbose is None: diff --git a/src/config.py b/src/config.py index ab5a922..a1bc12f 100644 --- a/src/config.py +++ b/src/config.py @@ -6,7 +6,7 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:19 by charles #+# #+# # -# Updated: 2020/09/13 11:48:55 by charles ### ########.fr # +# Updated: 2020/09/13 14:31:21 by charles ### ########.fr # # # # ############################################################################ # @@ -17,6 +17,7 @@ import os # run the bonus tests +# can be changed with `export MINISHELL_TEST_BONUS=yes` in your shell rc file. BONUS = False # minishell dir path @@ -31,8 +32,13 @@ MINISHELL_MAKE = True # path to reference shell (shell which will be compared minishell) # has to support the -c option (sh, bash and zsh support it) REFERENCE_PATH = "/bin/bash" +# can be changed with `export MINISHELL_TEST_ARGS=--poxix,--otherarg` REFERENCE_ARGS = [] # ["--posix"] +# pager to use with --pager option +# can be changed with `export MINISHELL_TEST_PAGER=yourpager` +PAGER = "less" + # log file path LOG_PATH = "result.log" diff --git a/src/main.py b/src/main.py index 1c652b6..4ba5128 100755 --- a/src/main.py +++ b/src/main.py @@ -54,6 +54,10 @@ def main(): if reference_args is not None: config.REFERENCE_ARGS.extend(reference_args.split(',')) + pager = os.environ.get("MINISHELL_TEST_PAGER") + if pager is not None: + config.PAGER = pager + config.VERBOSE_LEVEL = args.verbose if args.bonus or os.environ.get("MINISHELL_TEST_BONUS") == "yes": config.BONUS = True @@ -69,6 +73,9 @@ def main(): Suite.save_log() print("See", config.LOG_PATH, "for more information") + if args.pager: + subprocess.run([config.PAGER, config.LOG_PATH]) + if __name__ == "__main__": main() diff --git a/src/suites/builtin.py b/src/suites/builtin.py index 0c468d2..40c4eb5 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/12 10:37:05 by charles ### ########.fr # +# Updated: 2020/09/13 13:57:13 by charles ### ########.fr # # Updated: 2020/09/11 18:01:27 by juligonz ### ########.fr # # # # **************************************************************************** # @@ -130,7 +130,6 @@ def suite_cd(test): test("cd d ''; pwd; echo $PWD", setup="mkdir d") test("cd d d; pwd; echo $PWD", setup="mkdir d") test("cd d ' '; pwd; echo $PWD", setup="mkdir d") - test("cd $HOME; pwd; echo $PWD") test("cd $HOME; pwd; echo $PWD", exports={"HOME": os.getenv("HOME")}) test("cd /; pwd; echo $PWD") test("cd /.; pwd; echo $PWD") @@ -198,6 +197,7 @@ def suite_cd(test): # test("cd ~; pwd; echo $PWD"); # do we have to handle ~ ? # test("cd ~/..; pwd; echo $PWD"); # test("cd ~/../..; pwd; echo $PWD"); + # test("cd $HOME; pwd; echo $PWD") @suite() |
