From c6c106c4eb9f5c25028baaa58943a636def44137 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Wed, 11 Mar 2015 03:17:26 +0100 Subject: [PATCH] Fixed issues with CLI, boyscouting --- include/criterion/hooks.h | 2 +- src/main.c | 29 +++-------------------------- src/runner.c | 4 ++-- 3 files changed, 6 insertions(+), 29 deletions(-) diff --git a/include/criterion/hooks.h b/include/criterion/hooks.h index d427eab..b47b330 100644 --- a/include/criterion/hooks.h +++ b/include/criterion/hooks.h @@ -24,7 +24,7 @@ #ifndef CRITERION_HOOKS_H_ # define CRITERION_HOOKS_H_ -#include "common.h" +# include "common.h" typedef enum { PRE_ALL, diff --git a/src/main.c b/src/main.c index 787076d..3c5f26e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,26 +1,3 @@ -/* - * The MIT License (MIT) - * - * Copyright © 2015 Franklin "Snaipe" Mathieu - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ #define _GNU_SOURCE #include #include @@ -50,9 +27,9 @@ int main(int argc, char *argv[]) { }; criterion_options = (struct criterion_options) { - .always_succeed = strcmp("1", getenv("CRITERION_ALWAYS_SUCCEED") ?: "0"), - .no_early_exit = strcmp("1", getenv("CRITERION_NO_EARLY_EXIT") ?: "0"), - .enable_tap_format = strcmp("1", getenv("CRITERION_ENABLE_TAP") ?: "0"), + .always_succeed = !strcmp("1", getenv("CRITERION_ALWAYS_SUCCEED") ?: "0"), + .no_early_exit = !strcmp("1", getenv("CRITERION_NO_EARLY_EXIT") ?: "0"), + .enable_tap_format = !strcmp("1", getenv("CRITERION_ENABLE_TAP") ?: "0"), .logging_threshold = atoi(getenv("CRITERION_VERBOSITY_LEVEL") ?: "2"), }; diff --git a/src/runner.c b/src/runner.c index 21ab2ef..cc749ba 100644 --- a/src/runner.c +++ b/src/runner.c @@ -158,7 +158,7 @@ static int criterion_run_all_tests_impl(void) { int criterion_run_all_tests(void) { int res = criterion_run_all_tests_impl(); if (res == -1) // if this is the test worker terminating - exit(0); + _exit(0); - return criterion_options.always_succeed && res; + return !criterion_options.always_succeed && res; }