diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2013-12-15 11:48:51 +0100 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2013-12-15 12:39:12 +0100 |
commit | 113958276b96d7f1aab7042e1807a9970425d234 (patch) | |
tree | ea1963db467def83db42fec353eb55a448749247 /regtest/commands | |
parent | 44cf2de0df351d5948893f6a4e2bca1168d16b70 (diff) |
regtest: Return an exist status code depending on whether the command succeeded
Diffstat (limited to 'regtest/commands')
-rw-r--r-- | regtest/commands/__init__.py | 4 | ||||
-rw-r--r-- | regtest/commands/create-refs.py | 2 | ||||
-rw-r--r-- | regtest/commands/create-report.py | 2 | ||||
-rw-r--r-- | regtest/commands/find-regression.py | 4 | ||||
-rw-r--r-- | regtest/commands/run-tests.py | 6 |
5 files changed, 13 insertions, 5 deletions
diff --git a/regtest/commands/__init__.py b/regtest/commands/__init__.py index 86f58fd7..78e1f6fa 100644 --- a/regtest/commands/__init__.py +++ b/regtest/commands/__init__.py @@ -44,7 +44,7 @@ class Command: def execute(self, args): ns = self._parser.parse_args(args) - self.run(vars(ns)) + return self.run(vars(ns)) def run(self, options): raise NotImplementedError @@ -68,7 +68,7 @@ def _get_command(command_name): def run(args): command_class = _get_command(args[0]) command = command_class() - command.execute(args[1:]) + return command.execute(args[1:]) def print_help(): import os diff --git a/regtest/commands/create-refs.py b/regtest/commands/create-refs.py index d559fb3f..b8073d35 100644 --- a/regtest/commands/create-refs.py +++ b/regtest/commands/create-refs.py @@ -63,4 +63,6 @@ class CreateRefs(Command): refs.create_refs_for_file(os.path.basename(doc)) get_printer().printout_ln("Refs created in %s" % (t.elapsed_str())) + return 0 + register_command('create-refs', CreateRefs) diff --git a/regtest/commands/create-report.py b/regtest/commands/create-report.py index f17aabea..8e1ad053 100644 --- a/regtest/commands/create-report.py +++ b/regtest/commands/create-report.py @@ -55,4 +55,6 @@ class CreateReport(Command): report = HTMLReport(docs_dir, options['refs_dir'], options['out_dir']) report.create() + return 0 + register_command('create-report', CreateReport) diff --git a/regtest/commands/find-regression.py b/regtest/commands/find-regression.py index 8f5f8113..734d12ad 100644 --- a/regtest/commands/find-regression.py +++ b/regtest/commands/find-regression.py @@ -68,11 +68,13 @@ class FindRegression(Command): doc = options['test'] if not os.path.isfile(doc): get_printer().printerr("Invalid test %s: not a regulat file" % (doc)) - return + return 1 t = Timer() bisect = Bisect(options['test'], options['refs_dir'], options['out_dir']) bisect.run() get_printer().printout_ln("Tests run in %s" % (t.elapsed_str())) + return 0 + register_command('find-regression', FindRegression) diff --git a/regtest/commands/run-tests.py b/regtest/commands/run-tests.py index c5d87f96..29e7dfae 100644 --- a/regtest/commands/run-tests.py +++ b/regtest/commands/run-tests.py @@ -65,10 +65,12 @@ class RunTests(Command): tests = TestRun(docs_dir, options['refs_dir'], options['out_dir']) if doc == docs_dir: - tests.run_tests() + status = tests.run_tests() else: - tests.run_test(os.path.basename(doc)) + status = tests.run_test(os.path.basename(doc)) tests.summary() get_printer().printout_ln("Tests run in %s" % (t.elapsed_str())) + return status + register_command('run-tests', RunTests) |