X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Ftest.c;h=4e6b960c17b1b96c861613aa1ae4fb923ce4c85d;hp=c00c0bf2c560131a9445699a8ced037bbeb976b4;hb=a6b61b9f8b6576e8159a4e7e6aee88bba7e5d07d;hpb=0c46d2e66bdeea1600e700124a81a5d0a65d349e diff --git a/src/test.c b/src/test.c index c00c0bf..4e6b960 100644 --- a/src/test.c +++ b/src/test.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ @@ -28,6 +28,7 @@ static int test_todo = 0; static int test_verbose = 1; static const char *test_prog = 0; static int log_tests = 0; +static int test_stop = 0; static FILE *get_file(void) { @@ -74,11 +75,17 @@ void yaz_check_init1(int *argc_p, char ***argv_p) test_verbose = atoi(argv[i]); continue; } + else if (i < argc && !strcmp(suf, "stop")) + { + test_stop = 1; + continue; + } else if (!strcmp(suf, "help")) { fprintf(stderr, "--test-help help\n" "--test-file fname output to fname\n" + "--test-stop stop at first failing test\n" "--test-verbose level verbose level\n" " 0=Quiet. Only exit code tells what's wrong\n" " 1=Report+Summary only if tests fail.\n" @@ -151,6 +158,7 @@ void yaz_check_term1(void) } if (test_fout) fclose(test_fout); + yaz_deinit_globals(); if (test_failed) exit(1); exit(0); @@ -199,6 +207,10 @@ void yaz_check_print1(int type, const char *file, int line, yaz_log(YLOG_LOG, "%s:%d %s: ", file, line, msg); yaz_log(YLOG_LOG, "%s", expr); } + if ( type == YAZ_TEST_TYPE_FAIL && test_stop ) + { + exit(1); + } }