Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 31 May 2013 14:17:10 +0000 (16:17 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 31 May 2013 14:17:10 +0000 (16:17 +0200)
src/test.c

index c00c0bf..c762dbe 100644 (file)
@@ -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"
@@ -199,6 +206,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);
+    }
 }