[waffle] [PATCH 21/29] waffle_test: bye bye

Emil Velikov emil.l.velikov at gmail.com
Wed Jan 6 13:27:47 PST 2016


No longer used/needed.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 .gitignore                           |   1 -
 include/waffle_test/priv/wt_runner.h |  46 --------
 include/waffle_test/priv/wt_test.h   |  52 ---------
 include/waffle_test/waffle_test.h    |  76 -------------
 src/CMakeLists.txt                   |   4 -
 src/waffle_test/CMakeLists.txt       |  10 --
 src/waffle_test/wt_main.c            |  48 --------
 src/waffle_test/wt_runner.c          | 165 ---------------------------
 src/waffle_test/wt_test.c            | 208 -----------------------------------
 9 files changed, 610 deletions(-)
 delete mode 100644 include/waffle_test/priv/wt_runner.h
 delete mode 100644 include/waffle_test/priv/wt_test.h
 delete mode 100644 include/waffle_test/waffle_test.h
 delete mode 100644 src/waffle_test/CMakeLists.txt
 delete mode 100644 src/waffle_test/wt_main.c
 delete mode 100644 src/waffle_test/wt_runner.c
 delete mode 100644 src/waffle_test/wt_test.c

diff --git a/.gitignore b/.gitignore
index ee8c0fe..e9e3049 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,7 +46,6 @@ Makefile
 /libcmocka.a
 /src/waffle/libwaffle_static.a
 /tests/functional/gl_basic_test
-/tests/waffle_test/libwaffle_test.dylib
 /tests/unittests/waffle-unittest
 /tests/wcore_attrib_list_unittest
 /tests/wcore_config_attrs_unittest
diff --git a/include/waffle_test/priv/wt_runner.h b/include/waffle_test/priv/wt_runner.h
deleted file mode 100644
index 543792d..0000000
--- a/include/waffle_test/priv/wt_runner.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-//   list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#pragma once
-
-void
-wt_runner_init(void);
-
-void
-wt_runner_finish(void);
-
-void
-wt_runner_run_test(
-        const char *group,
-        const char *name,
-        void (*test)(void),
-        void (*setup)(void),
-        void (*teardown)(void));
-
-void
-wt_runner_print_summary(void);
-
-void
-wt_runner_get_totals(int *pass, int *fail, int *ignore);
diff --git a/include/waffle_test/priv/wt_test.h b/include/waffle_test/priv/wt_test.h
deleted file mode 100644
index d6c75f5..0000000
--- a/include/waffle_test/priv/wt_test.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-//   list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#pragma once
-
-#include <stdbool.h>
-
-enum wt_result {
-    WT_RESULT_PASS,
-    WT_RESULT_FAIL,
-    WT_RESULT_SKIP,
-};
-
-/// This must be called only from wt_main().
-void
-wt_test_run(
-        const char *group, const char *name,
-        void (*test)(void),
-        void (*fixture_setup)(void),
-        void (*fixture_teardown)(void),
-        int *result);
-
-void wt_test_pass(void);
-void wt_test_skip(void);
-void wt_test_fail(const char *file, int line);
-void wt_test_fail_printf(const char *file, int line, const char *format, ...);
-void wt_test_error(const char *filename, int line);
-void wt_test_error_printf(const char *file, int line, const char *format, ...);
-void wt_test_expect(const char *file, int line, bool cond, const char *cond_str);
-void wt_test_assert(const char *file, int line, bool cond, const char *cond_str);
diff --git a/include/waffle_test/waffle_test.h b/include/waffle_test/waffle_test.h
deleted file mode 100644
index 32cd2b6..0000000
--- a/include/waffle_test/waffle_test.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-//   list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#pragma once
-
-#include "priv/wt_test.h"
-#include "priv/wt_runner.h"
-
-#define TEST(group, name) \
-    static void test_##group##_##name(void)
-
-#define TESTGROUP(group, setup, teardown) \
-    static void testgroup_##group##_setup(void)    { setup();    } \
-    static void testgroup_##group##_teardown(void) { teardown(); }
-
-#define TESTGROUP_SIMPLE(group) \
-    static void testgroup_##group##_setup(void) {} \
-    static void testgroup_##group##_teardown(void) {}
-
-/// This must be called only from test suite s passed to wt_main().
-#define TEST_RUN(group, name) \
-    wt_runner_run_test( \
-           #group, #name, \
-           test_##group##_##name, \
-           testgroup_##group##_setup, \
-           testgroup_##group##_teardown)
-
-/// This must be called only from test suite s passed to wt_main().
-#define TEST_RUN2(group, displayname, testname) \
-    wt_runner_run_test( \
-           #group, #displayname, \
-           test_##group##_##testname, \
-           testgroup_##group##_setup, \
-           testgroup_##group##_teardown)
-
-/// @param test_runners is a list of functions that call TEST_RUN(). The list
-///     is a null-terminated.
-/// @return number of failed tests.
-#ifdef _WIN32
-int wt_main(int *argc, char **argv, void (__stdcall *test_suites[])(void));
-#else
-int wt_main(int *argc, char **argv, void (*test_suites[])(void));
-#endif // _WIN32
-
-#define TEST_PASS()                           wt_test_pass()
-#define TEST_SKIP()                           wt_test_skip()
-#define TEST_FAIL()                           wt_test_fail( __FILE__, __LINE__)
-#define TEST_FAIL_PRINTF(format, ...)         wt_test_fail_printf( __FILE__, __LINE__, format, __VA_ARGS__)
-
-#define TEST_ERROR()                          wt_test_error(__FILE__, __LINE__)
-#define TEST_ERROR_PRINTF(format, ...)        wt_test_error_printf(__FILE__, __LINE__, format, __VA_ARGS__)
-
-#define EXPECT_TRUE(cond)                     wt_test_expect( __FILE__, __LINE__, (cond), #cond)
-#define ASSERT_TRUE(cond)                     wt_test_assert( __FILE__, __LINE__, (cond), #cond)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index aa6d3c3..e714d90 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,2 @@
-if(waffle_build_tests)
-    add_subdirectory(waffle_test)
-endif()
-
 add_subdirectory(utils)
 add_subdirectory(waffle)
diff --git a/src/waffle_test/CMakeLists.txt b/src/waffle_test/CMakeLists.txt
deleted file mode 100644
index 8ed4ea2..0000000
--- a/src/waffle_test/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-include_directories(
-    "${CMAKE_SOURCE_DIR}/include/waffle_test"
-    "${CMAKE_SOURCE_DIR}/include/waffle_test/priv"
-    )
-
-add_library(waffle_test STATIC
-    wt_main.c
-    wt_runner.c
-    wt_test.c
-    )
diff --git a/src/waffle_test/wt_main.c b/src/waffle_test/wt_main.c
deleted file mode 100644
index b3e6580..0000000
--- a/src/waffle_test/wt_main.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-//   list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "waffle_test.h"
-#include "priv/wt_runner.h"
-
-int
-#ifdef _WIN32
-wt_main(int *argc, char **argv, void (__stdcall *test_suites[])(void))
-#else
-wt_main(int *argc, char **argv, void (*test_suites[])(void))
-#endif // _WIN32
-{
-    int num_fail;
-
-    wt_runner_init();
-
-    for (int i = 0; test_suites[i] != 0; ++i)
-        test_suites[i]();
-
-    wt_runner_print_summary();
-    wt_runner_get_totals(0, &num_fail, 0);
-    wt_runner_finish();
-
-    return num_fail;
-}
diff --git a/src/waffle_test/wt_runner.c b/src/waffle_test/wt_runner.c
deleted file mode 100644
index bd1e561..0000000
--- a/src/waffle_test/wt_runner.c
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-//   list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "wt_runner.h"
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../waffle_test.h"
-#include "wt_test.h"
-
-struct wt_testname {
-    const char *group;
-    const char *name;
-};
-
-struct wt_runner {
-    bool is_init;
-
-    int num_pass;
-    int num_fail;
-    int num_skip;
-
-    struct wt_testname *fail_names;
-    int fail_names_length;
-};
-
-/// @brief Singleton test runner.
-static struct wt_runner self;
-
-static void
-wt_runner_check_preconditions(void)
-{
-    if (!self.is_init) {
-        printf("wt: error: wt_run_test*() was called outside of wt_main()\n");
-        abort();
-    }
-}
-
-static void
-wt_runner_accum_result(int result)
-{
-    switch (result) {
-        case WT_RESULT_PASS:   ++self.num_pass;    break;
-        case WT_RESULT_FAIL:   ++self.num_fail;    break;
-        case WT_RESULT_SKIP:   ++self.num_skip;    break;
-
-        default:
-            printf("wt: internal error: %s:%d: result has bad value 0x%x\n",
-                    __FILE__, __LINE__, result);
-            abort();
-    }
-}
-
-static void
-wt_runner_double_failed_test_names(void)
-{
-    int size = 2 * self.fail_names_length * sizeof(*self.fail_names);
-    self.fail_names_length *= 2;
-    self.fail_names = realloc(self.fail_names, size);
-
-    if (!self.fail_names) {
-        printf("wt: error: out of memory\n");
-        abort();
-    }
-}
-
-static void
-wt_runner_save_failed_test_name(const char *group, const char *name)
-{
-    if (self.num_fail == self.fail_names_length)
-        wt_runner_double_failed_test_names();
-
-    self.fail_names[self.num_fail].group = strdup(group);
-    self.fail_names[self.num_fail].name = strdup(name);
-}
-
-static void
-wt_runner_finish_test(const char *group, const char *name, int result)
-{
-    if (result == WT_RESULT_FAIL)
-        wt_runner_save_failed_test_name(group, name);
-
-    wt_runner_accum_result(result);
-}
-
-void
-wt_runner_init(void)
-{
-    memset(&self, 0, sizeof(self));
-    self.is_init = true;
-    self.fail_names_length = 64;
-    self.fail_names = malloc(self.fail_names_length * sizeof(*self.fail_names));
-}
-
-void
-wt_runner_finish(void)
-{
-    free(self.fail_names);
-    self.is_init = false;
-}
-
-void
-wt_runner_run_test(
-        const char *group,
-        const char *name,
-        void (*test)(void),
-        void (*setup)(void),
-        void (*teardown)(void))
-{
-    int result;
-
-    wt_runner_check_preconditions();
-    wt_test_run(group, name, test, setup, teardown, &result);
-    wt_runner_finish_test(group, name, result);
-}
-
-void
-wt_runner_get_totals(int *pass, int *fail, int *ignore)
-{
-    if (pass)
-        *pass = self.num_pass;
-    if (fail)
-        *fail = self.num_fail;
-    if (ignore)
-        *ignore = self.num_skip;
-}
-
-void
-wt_runner_print_summary(void)
-{
-    if (self.num_fail > 0) {
-        printf("test: failed tests:\n");
-        for (int i = 0; i < self.num_fail; ++i) {
-            struct wt_testname *name = &self.fail_names[i];
-            printf("  %s.%s\n", name->group, name->name);
-        }
-    }
-
-    printf("test: summary: failed %d, skipped %d, passed %d\n",
-           self.num_fail, self.num_skip, self.num_pass);
-}
diff --git a/src/waffle_test/wt_test.c b/src/waffle_test/wt_test.c
deleted file mode 100644
index 41d7b8d..0000000
--- a/src/waffle_test/wt_test.c
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright 2012 Intel Corporation
-//
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// - Redistributions of source code must retain the above copyright notice, this
-//   list of conditions and the following disclaimer.
-//
-// - Redistributions in binary form must reproduce the above copyright notice,
-//   this list of conditions and the following disclaimer in the documentation
-//   and/or other materials provided with the distribution.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "wt_test.h"
-
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-struct wt_test {
-    const char *group;
-    const char *name;
-
-    /// This is initialized to TEST_PASS at the start of each test.
-    int result;
-
-    /// @brief Allows wt_fail() and friends to terminate the test.
-    jmp_buf jump;
-
-    /// @brief A test is executing.
-    bool in_test;
-};
-
-/// @brief The test singleton.
-struct wt_test self;
-
-static void
-wt_test_print_result(void)
-{
-    const char *tag;
-
-    switch (self.result) {
-        default:
-        case WT_RESULT_FAIL:       tag = "fail:";      break;
-        case WT_RESULT_PASS:       tag = "pass:";      break;
-        case WT_RESULT_SKIP:       tag = "skip:";    break;
-    }
-
-    printf("test: %-7s %s.%s\n", tag, self.group, self.name);
-}
-
-static void
-wt_test_run_check_preconditions(void)
-{
-    if (self.in_test) {
-        printf("test: error: attempted to run a new test while one was "
-               "already running\n");
-        abort();
-    }
-}
-
-void
-wt_test_run(
-        const char *group, const char *name,
-        void (*test)(void),
-        void (*fixture_setup)(void),
-        void (*fixture_teardown)(void),
-        int *result)
-{
-    wt_test_run_check_preconditions();
-
-    self.group = group;
-    self.name = name;
-    self.result = WT_RESULT_PASS;
-    self.in_test = true;
-
-    if (setjmp(self.jump) == 0) {
-        fixture_setup();
-        test();
-        fixture_teardown();
-    }
-
-    wt_test_print_result();
-    *result = self.result;
-    self.in_test = false;
-}
-
-static void
-wt_test_check_command_preconditions(void)
-{
-    if (!self.in_test) {
-        printf("test: error: a test command was called (such as ASSERT_TRUE), "
-               "but no test is running\n");
-        abort();
-    }
-}
-
-static void
-wt_test_terminate_early(int result)
-{
-    self.result = result;
-    longjmp(self.jump, 1);
-}
-
-static void
-wt_test_error_vprintf(
-        const char *file, int line,
-        const char *format, va_list ap)
-{
-    self.result = WT_RESULT_FAIL;
-
-    // Use the same error format as GCC.
-    printf("%s:%d: error in test %s.%s", file, line, self.group, self.name);
-    if (format) {
-        printf(": ");
-        vprintf(format, ap);
-    }
-    printf("\n");
-}
-
-void
-wt_test_pass(void)
-{
-    wt_test_check_command_preconditions();
-    wt_test_terminate_early(WT_RESULT_PASS);
-}
-
-void
-wt_test_skip(void)
-{
-    wt_test_check_command_preconditions();
-    wt_test_terminate_early(WT_RESULT_SKIP);
-}
-
-void
-wt_test_fail(const char *file, int line)
-{
-    wt_test_check_command_preconditions();
-    wt_test_error_printf(file, line, "forced failure");
-    wt_test_terminate_early(WT_RESULT_FAIL);
-}
-
-void
-wt_test_fail_printf(const char *file, int line, const char *format, ...)
-{
-    va_list ap;
-
-    wt_test_check_command_preconditions();
-
-    va_start(ap, format);
-    wt_test_error_vprintf(file, line, format, ap);
-    va_end(ap);
-
-    wt_test_terminate_early(WT_RESULT_FAIL);
-}
-
-void
-wt_test_error(const char *file, int line)
-{
-    wt_test_error_printf(file, line, NULL);
-}
-
-void
-wt_test_error_printf(const char *file, int line, const char *format, ...)
-{
-    va_list ap;
-
-    va_start(ap, format);
-    wt_test_error_vprintf(file, line, format, ap);
-    va_end(ap);
-}
-
-void
-wt_test_expect(
-        const char *file, int line,
-        bool cond, const char *cond_str)
-{
-    if (cond)
-        return;
-
-    wt_test_error_printf(file, line, "expect(%s)", cond_str);
-}
-
-void
-wt_test_assert(
-        const char *file, int line,
-        bool cond, const char *cond_str)
-{
-    if (cond)
-        return;
-
-    wt_test_error_printf(file, line, "assert(%s)", cond_str);
-    wt_test_terminate_early(WT_RESULT_FAIL);
-}
-- 
2.6.2



More information about the waffle mailing list