aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-08 09:05:33 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-08 09:05:33 +0200
commitc48f9194ac7cd2a15d0f86d8d03b0a8d6001d387 (patch)
treec642233cbadf2e4fe2b84dee2a91a13bf189cb22 /src/test
parentc20cbfea9bb878fc88e76f0ba773ded5a7b149ca (diff)
downloadminishell_test-c48f9194ac7cd2a15d0f86d8d03b0a8d6001d387.tar.gz
minishell_test-c48f9194ac7cd2a15d0f86d8d03b0a8d6001d387.tar.bz2
minishell_test-c48f9194ac7cd2a15d0f86d8d03b0a8d6001d387.zip
Added test range selection for long valgrind tests
Diffstat (limited to 'src/test')
-rw-r--r--src/test/result.py7
-rw-r--r--src/test/test.py8
2 files changed, 9 insertions, 6 deletions
diff --git a/src/test/result.py b/src/test/result.py
index 30ce31e..3d16c7e 100644
--- a/src/test/result.py
+++ b/src/test/result.py
@@ -6,7 +6,7 @@
# By: charles <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/09/11 12:17:34 by charles #+# #+# #
-# Updated: 2020/10/07 18:53:27 by cacharle ### ########.fr #
+# Updated: 2020/10/08 08:53:49 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -82,6 +82,8 @@ class Result:
return self.green('.') if self.passed else self.red('!')
elif config.VERBOSE_LEVEL == 1:
printed = self.escaped_cmd[:]
+ if config.SHOW_RANGE:
+ printed = "{:2}: ".format(self.index) + printed
if len(printed) > config.TERM_COLS - 7:
printed = printed[:config.TERM_COLS - 10] + "..."
fmt = self.green("{:{width}} [PASS]") if self.passed else self.red("{:{width}} [FAIL]")
@@ -91,10 +93,11 @@ class Result:
else:
raise RuntimeError
- def put(self):
+ def put(self, index: int):
"""Print a summary of the result"""
if config.VERBOSE_LEVEL == 2 and self.passed:
return
+ self.index = index
print(self, end="")
if config.VERBOSE_LEVEL == 0:
sys.stdout.flush()
diff --git a/src/test/test.py b/src/test/test.py
index 52b6db3..542a9d8 100644
--- a/src/test/test.py
+++ b/src/test/test.py
@@ -6,7 +6,7 @@
# By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/06/16 21:48:50 by charles #+# #+# #
-# Updated: 2020/10/07 18:54:13 by cacharle ### ########.fr #
+# Updated: 2020/10/08 08:45:34 by cacharle ### ########.fr #
# #
# ############################################################################ #
@@ -55,7 +55,7 @@ class Test:
if type(self.hook_status) is not list:
self.hook_status = [self.hook_status]
- def run(self):
+ def run(self, index: int):
""" Run the test for minishell and the reference shell and print the result out """
if config.CHECK_LEAKS:
@@ -63,7 +63,7 @@ class Test:
self.hook_status = []
captured = self._run_sandboxed([*config.VALGRIND_CMD, "-c"])
self.result = Result.leak(self.cmd, captured.output)
- self.result.put()
+ self.result.put(index)
return
expected = self._run_sandboxed([config.REFERENCE_PATH, *config.REFERENCE_ARGS, "-c"])
@@ -75,7 +75,7 @@ class Test:
s = "[EXPORTS {}] {}".format(
' '.join(["{}='{:.20}'".format(k, v) for k, v in self.exports.items()]), s)
self.result = Result(s, self.files, expected, actual)
- self.result.put()
+ self.result.put(index)
def _run_sandboxed(self, shell_cmd: [str]) -> Captured:
""" Run the command in a sandbox environment """