From e16395e1e4ffdce54e53e23be8d26267fbec4a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 23 Dec 2019 11:23:56 +0100 Subject: [PATCH] test/verify/itc.py: minor tweaks --- test/verify/itc.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/verify/itc.py b/test/verify/itc.py index c0cd28c3b..9cc2a41f1 100644 --- a/test/verify/itc.py +++ b/test/verify/itc.py @@ -9,14 +9,19 @@ import re import sys import subprocess -ITC_PATH = os.path.expanduser('~/testing') -ZERO_DIVISION = '000/199/329/zero_division.c' - if sys.argv[0] in ('test/verify/itc.py', './test/verify/itc.py'): CPPCHECK_PATH = './cppcheck' else: CPPCHECK_PATH = '../../cppcheck' +if len(sys.argv) == 2: + TESTFILE = sys.argv[1] + if not os.path.isfile(TESTFILE): + print(f'ERROR: {TESTFILE} is not a file') + sys.exit(1) +else: + TESTFILE = os.path.expanduser('~/itc/01.w_Defects/zero_division.c') + def get_error_lines(filename): ret = [] f = open(filename, 'rt') @@ -46,9 +51,8 @@ def check(filename): ret.append(int(res.group(1))) return ret -filename = os.path.join(ITC_PATH, ZERO_DIVISION) -wanted = get_error_lines(filename) -actual = check(filename) +wanted = get_error_lines(TESTFILE) +actual = check(TESTFILE) print('wanted:' + str(wanted)) print('actual:' + str(actual)) missing = []