From 9682ac83c4b685818bdaf222f813df044b3107fd Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 15 Jun 2020 18:25:35 +0200 Subject: Changing default minishell dir path, Added exit status --- README.md | 6 +++--- config.py | 2 +- main.py | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe6ea90..1da4fc9 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ README.md test.sh README.md test.sh ``` -The reasons for this is are: -1. we're free to set the prompt to whatever we want -2. termcaps would be a nightmare to test +The reasons for this: +1. You're free to set the prompt to whatever you want +2. Termcaps would be a nightmare to test ## Run diff --git a/config.py b/config.py index 286ff36..ff46de9 100644 --- a/config.py +++ b/config.py @@ -1,7 +1,7 @@ # Minishell configuration file # minishell dir path -MINISHELL_DIR = "/home/charles/minishell" +MINISHELL_DIR = ".." # minishell executable MINISHELL_EXEC = "minishell" diff --git a/main.py b/main.py index addebf6..68e3a5a 100755 --- a/main.py +++ b/main.py @@ -35,18 +35,22 @@ def run_sandboxed(program: str, cmd: str) -> str: return output +status = 0 ignored_suites = [] suites = {} current_suite = "default" def test(cmd, setup = None, *files): + global status + if current_suite in ignored_suites: return expected = run_sandboxed(config.REFERENCE_SHELL_PATH, cmd) - actual = run_sandboxed(os.path.join(config.MINISHELL_DIR, config.MINISHELL_EXEC), cmd) + actual = run_sandboxed(os.path.abspath(os.path.join(config.MINISHELL_DIR, config.MINISHELL_EXEC)), cmd) if actual != expected: sys.stdout.write(red(config.FAIL_MARKER)) + status = 1 else: sys.stdout.write(green(config.PASS_MARKER)) sys.stdout.flush() @@ -76,3 +80,4 @@ def main(): if __name__ == "__main__": main() + sys.exit(status) -- cgit