From bf2fb5f2cca5961cf450af23d320231a7b0b71d3 Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 12 Jan 2018 16:56:02 +0300 Subject: [PATCH] clickhouse-test: early exit if server died (more than 20 queries failed in chain). Auto use system queries dir. --- dbms/tests/clickhouse-test | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/dbms/tests/clickhouse-test b/dbms/tests/clickhouse-test index fd38d065754..871ba2dd635 100755 --- a/dbms/tests/clickhouse-test +++ b/dbms/tests/clickhouse-test @@ -114,6 +114,7 @@ def main(args): print("\nRunning {} tests.\n".format(suite)) failures = 0 + failures_chain = 0 if 'stateful' in suite and not is_data_present(): print("Won't run stateful tests because test data wasn't loaded. See README.txt.") continue @@ -208,6 +209,7 @@ def main(args): report_testcase.append(stdout_element) failures = failures + 1 + failures_chain = failures_chain + 1 print("{0} - return code {1}".format(MSG_FAIL, proc.returncode)) if stderr: @@ -228,6 +230,7 @@ def main(args): report_testcase.append(stderr_element) failures = failures + 1 + failures_chain = failures_chain + 1 print("{0} - having stderror:\n{1}".format(MSG_FAIL, stderr.encode('utf-8'))) elif 'Exception' in stdout: failure = et.Element("error", attrib = {"message": "having exception"}) @@ -238,6 +241,7 @@ def main(args): report_testcase.append(stdout_element) failures = failures + 1 + failures_chain = failures_chain + 1 print("{0} - having exception:\n{1}".format(MSG_FAIL, stdout.encode('utf-8'))) elif not os.path.isfile(reference_file): skipped = et.Element("skipped", attrib = {"message": "no reference file"}) @@ -268,6 +272,7 @@ def main(args): os.remove(stdout_file) if os.path.exists(stderr_file): os.remove(stderr_file) + failures_chain = 0 except KeyboardInterrupt as e: print(colored("Break tests execution", "red")) raise e @@ -281,6 +286,9 @@ def main(args): finally: dump_report(args.output, suite, name, report_testcase) + if failures_chain >= 20: + break + failures_total = failures_total + failures if failures_total > 0: @@ -293,8 +301,8 @@ def main(args): if __name__ == '__main__': parser = ArgumentParser(description = 'ClickHouse functional tests') - parser.add_argument('-q', '--queries', default = 'queries', help = 'Path to queries dir') - parser.add_argument('--tmp', default = 'queries', help = 'Path to tmp dir') + parser.add_argument('-q', '--queries', help = 'Path to queries dir') + parser.add_argument('--tmp', help = 'Path to tmp dir') parser.add_argument('-b', '--binary', default = 'clickhouse', help = 'Main clickhouse binary') parser.add_argument('-c', '--client', help = 'Client program') parser.add_argument('--clientconfig', help = 'Client config (if you use not default ports)') @@ -314,6 +322,16 @@ if __name__ == '__main__': group.add_argument('--no-shard', action = 'store_false', default = None, dest = 'shard', help = 'Do not run shard related tests') args = parser.parse_args() + + if args.queries is None and os.path.isdir('queries'): + args.queries = 'queries' + if args.tmp is None: + args.tmp = args.queries + else: + args.queries = '/usr/share/clickhouse-test/queries' + if args.tmp is None: + args.tmp = '/tmp/clickhouse-test' + if args.client is None: args.client = args.binary + '-client' if args.clientconfig: