aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-15 18:25:35 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-15 18:25:35 +0200
commit9682ac83c4b685818bdaf222f813df044b3107fd (patch)
tree4d8e3c1b21e47725508858fb0ebc077e4e612955
parentb298afeb9da27038cbd54802a2d70504909427a3 (diff)
downloadminishell_test-9682ac83c4b685818bdaf222f813df044b3107fd.tar.gz
minishell_test-9682ac83c4b685818bdaf222f813df044b3107fd.tar.bz2
minishell_test-9682ac83c4b685818bdaf222f813df044b3107fd.zip
Changing default minishell dir path, Added exit status
-rw-r--r--README.md6
-rw-r--r--config.py2
-rwxr-xr-xmain.py7
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)