Skip to content

Commit

Permalink
Adjust exit codes
Browse files Browse the repository at this point in the history
  • Loading branch information
r0qs committed Apr 18, 2023
1 parent 308f00d commit f1a27c2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/external_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# ------------------------------------------------------------------------------

from argparse import ArgumentParser, Namespace
import os
from os import listdir
from pathlib import Path
import sys
Expand Down Expand Up @@ -58,16 +59,16 @@ def external_tests_scripts() -> dict:
def display_available_external_tests(_) -> int:
print("Available external tests:")
print(*external_tests_scripts().keys())
return 0
return os.EX_OK


def run_test_script(solc_binary_type: str, solc_binary_path: Path, tests: dict) -> int:
for test_name, test_script_path in tests.items():
print(f"Running {test_name} external test...")
ret = run_cmd(f"{test_script_path} {solc_binary_type} {solc_binary_path}")
if ret != 0:
if ret != os.EX_OK:
return ret
return 0
return os.EX_OK


def run_external_tests(args: dict) -> int:
Expand Down Expand Up @@ -107,7 +108,7 @@ def parse_commandline() -> Namespace:
list_command.set_defaults(cmd=display_available_external_tests)

run_command = subparser.add_parser(
"run",
"test",
help="Run external tests.",
)
run_command.set_defaults(cmd=run_external_tests)
Expand Down Expand Up @@ -157,10 +158,10 @@ def main():
args = parse_commandline()
return args.cmd(vars(args))
except OptionNotFound:
return 1
return os.EX_USAGE
except ExternalTestNotFound as exception:
print(f"Error: {exception}", file=sys.stderr)
return 1
return os.EX_NOINPUT
except RuntimeError as exception:
print(f"Error: {exception}", file=sys.stderr)
return 1
Expand Down

0 comments on commit f1a27c2

Please sign in to comment.