Merge branch 'features/language-decouple' into bleeding
This commit is contained in:
commit
78a62465e9
18 changed files with 135 additions and 634 deletions
|
@ -1,19 +0,0 @@
|
|||
# Copyright (C) 2015 Franklin "Snaipe" Mathieu.
|
||||
# Redistribution and use of this file is allowed according to the terms of the MIT license.
|
||||
# For details see the LICENSE file distributed with Criterion.
|
||||
|
||||
# CMake <2.8.10 backward compat
|
||||
if(NOT CMAKE_PLATFORM_INFO_DIR)
|
||||
set(CMAKE_PLATFORM_INFO_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
|
||||
endif(NOT CMAKE_PLATFORM_INFO_DIR)
|
||||
|
||||
set(CMAKE_ObjectiveC_COMPILER_ID ${CMAKE_C_COMPILER_ID})
|
||||
set(CMAKE_ObjectiveC_COMPILER ${CMAKE_C_COMPILER})
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/CMakeObjectiveCCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeObjectiveCCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(CMAKE_ObjectiveC_COMPILER_ENV_VAR "OBJCC")
|
|
@ -1,10 +0,0 @@
|
|||
set(CMAKE_ObjectiveC_COMPILER "@CMAKE_ObjectiveC_COMPILER@")
|
||||
set(CMAKE_ObjectiveC_COMPILER_ID "@CMAKE_ObjectiveC_COMPILER_ID@")
|
||||
|
||||
set(CMAKE_ObjectiveC_IMPLICIT_LINK_LIBRARIES "@CMAKE_ObjectiveC_IMPLICIT_LINK_LIBRARIES@")
|
||||
|
||||
set(CMAKE_ObjectiveC_COMPILER_LOADED 1)
|
||||
set(CMAKE_ObjectiveC_COMPILER_WORKS @CMAKE_ObjectiveC_COMPILER_WORKS@)
|
||||
|
||||
set(CMAKE_ObjectiveC_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_ObjectiveC_SOURCE_FILE_EXTENSIONS m)
|
|
@ -1,192 +0,0 @@
|
|||
if(UNIX)
|
||||
set(CMAKE_ObjectiveC_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_ObjectiveC_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
set(_INCLUDED_FILE 0)
|
||||
set(_INCLUDED_FILE_2 0)
|
||||
|
||||
# Load compiler-specific information.
|
||||
if(CMAKE_ObjectiveC_COMPILER_ID)
|
||||
include(Compiler/${CMAKE_ObjectiveC_COMPILER_ID}-C OPTIONAL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_BASE_NAME)
|
||||
get_filename_component(CMAKE_BASE_NAME "${CMAKE_ObjectiveC_COMPILER}" NAME_WE)
|
||||
|
||||
# load a hardware specific file, mostly useful for embedded compilers
|
||||
if(CMAKE_SYSTEM_PROCESSOR)
|
||||
if(CMAKE_ObjectiveC_COMPILER_ID)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ObjectiveC_COMPILER_ID}-C-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ObjectiveC_COMPILER_ID}-ObjectiveC-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE_2)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE AND NOT _INCLUDED_FILE_2)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# load the system- and compiler specific files
|
||||
if(CMAKE_ObjectiveC_COMPILER_ID)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ObjectiveC_COMPILER_ID}-C
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_ObjectiveC_COMPILER_ID}-ObjectiveC
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE_2)
|
||||
endif()
|
||||
if (NOT _INCLUDED_FILE AND _INCLUDED_FILE_2)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}
|
||||
OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
|
||||
endif ()
|
||||
|
||||
# We specify the compiler information in the system file for some
|
||||
# platforms, but this language may not have been enabled when the file
|
||||
# was first included. Include it again to get the language info.
|
||||
# Remove this when all compiler info is removed from system files.
|
||||
if (NOT _INCLUDED_FILE)
|
||||
include(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL)
|
||||
endif ()
|
||||
|
||||
if(CMAKE_ObjectiveC_COMPILER_LINKS_STATICALLY)
|
||||
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
|
||||
endif()
|
||||
|
||||
# This should be included before the _INIT variables are
|
||||
# used to initialize the cache. Since the rule variables
|
||||
# have if blocks on them, users can still define them here.
|
||||
# But, it should still be after the platform file so changes can
|
||||
# be made to those values.
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_USER_MAKE_RULES_OVERRIDE_ObjectiveC)
|
||||
# Save the full path of the file so try_compile can use it.
|
||||
include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ObjectiveC} RESULT_VARIABLE _override)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE_ObjectiveC "${_override}")
|
||||
endif()
|
||||
|
||||
|
||||
# for most systems a module is the same as a shared library
|
||||
# so unless the variable CMAKE_MODULE_EXISTS is set just
|
||||
# copy the values from the LIBRARY variables
|
||||
if(NOT CMAKE_MODULE_EXISTS)
|
||||
set(CMAKE_SHARED_MODULE_ObjectiveC_FLAGS ${CMAKE_SHARED_LIBRARY_ObjectiveC_FLAGS})
|
||||
set(CMAKE_SHARED_MODULE_CREATE_ObjectiveC_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_ObjectiveC_FLAGS})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
# default build type is none
|
||||
if(NOT CMAKE_NO_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
|
||||
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif()
|
||||
set (CMAKE_ObjectiveC_FLAGS_DEBUG "${CMAKE_ObjectiveC_FLAGS_DEBUG_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during debug builds.")
|
||||
set (CMAKE_ObjectiveC_FLAGS_MINSIZEREL "${CMAKE_ObjectiveC_FLAGS_MINSIZEREL_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release builds for minimum size.")
|
||||
set (CMAKE_ObjectiveC_FLAGS_RELEASE "${CMAKE_ObjectiveC_FLAGS_RELEASE_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release builds.")
|
||||
set (CMAKE_ObjectiveC_FLAGS_RELWITHDEBINFO "${CMAKE_ObjectiveC_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
|
||||
"Flags used by the compiler during release builds with debug info.")
|
||||
endif()
|
||||
|
||||
if(CMAKE_ObjectiveC_STANDARD_LIBRARIES_INIT)
|
||||
set(CMAKE_ObjectiveC_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES_INIT}"
|
||||
CACHE STRING "Libraries linked by default with all C applications.")
|
||||
mark_as_advanced(CMAKE_ObjectiveC_STANDARD_LIBRARIES)
|
||||
endif()
|
||||
|
||||
include(CMakeCommonLanguageInclude)
|
||||
|
||||
# now define the following rule variables
|
||||
|
||||
# CMAKE_ObjectiveC_CREATE_SHARED_LIBRARY
|
||||
# CMAKE_ObjectiveC_CREATE_SHARED_MODULE
|
||||
# CMAKE_ObjectiveC_COMPILE_OBJECT
|
||||
# CMAKE_ObjectiveC_LINK_EXECUTABLE
|
||||
|
||||
# variables supplied by the generator at use time
|
||||
# <TARGET>
|
||||
# <TARGET_BASE> the target without the suffix
|
||||
# <OBJECTS>
|
||||
# <OBJECT>
|
||||
# <LINK_LIBRARIES>
|
||||
# <FLAGS>
|
||||
# <LINK_FLAGS>
|
||||
|
||||
# C compiler information
|
||||
# <CMAKE_ObjectiveC_COMPILER>
|
||||
# <CMAKE_SHARED_LIBRARY_CREATE_ObjectiveC_FLAGS>
|
||||
# <CMAKE_SHARED_MODULE_CREATE_ObjectiveC_FLAGS>
|
||||
# <CMAKE_ObjectiveC_LINK_FLAGS>
|
||||
|
||||
# Static library tools
|
||||
# <CMAKE_AR>
|
||||
# <CMAKE_RANLIB>
|
||||
|
||||
|
||||
# create a C shared library
|
||||
if(NOT CMAKE_ObjectiveC_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_ObjectiveC_CREATE_SHARED_LIBRARY
|
||||
"<CMAKE_ObjectiveC_COMPILER> <CMAKE_SHARED_LIBRARY_ObjectiveC_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_ObjectiveC_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
# create a C shared module just copy the shared library rule
|
||||
if(NOT CMAKE_ObjectiveC_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_ObjectiveC_CREATE_SHARED_MODULE ${CMAKE_ObjectiveC_CREATE_SHARED_LIBRARY})
|
||||
endif()
|
||||
|
||||
# Create a static archive incrementally for large object file counts.
|
||||
# If CMAKE_ObjectiveC_CREATE_STATIObjectiveC_LIBRARY is set it will override these.
|
||||
if(NOT DEFINED CMAKE_ObjectiveC_ARCHIVE_CREATE)
|
||||
set(CMAKE_ObjectiveC_ARCHIVE_CREATE "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_ObjectiveC_ARCHIVE_APPEND)
|
||||
set(CMAKE_ObjectiveC_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_ObjectiveC_ARCHIVE_FINISH)
|
||||
set(CMAKE_ObjectiveC_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
set(CMAKE_INCLUDE_FLAG_ObjectiveC "-I")
|
||||
set(CMAKE_ObjectiveC_IMPLICIT_LINK_LIBRARIES objc)
|
||||
|
||||
# compile a C file into an object file
|
||||
if(NOT CMAKE_ObjectiveC_COMPILE_OBJECT)
|
||||
if("${CMAKE_VERSION}" VERSION_GREATER 3.3.2)
|
||||
set(CMAKE_ObjectiveC_COMPILE_OBJECT
|
||||
"<CMAKE_ObjectiveC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
else ()
|
||||
set(CMAKE_ObjectiveC_COMPILE_OBJECT
|
||||
"<CMAKE_ObjectiveC_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ObjectiveC_LINK_EXECUTABLE)
|
||||
set(CMAKE_ObjectiveC_LINK_EXECUTABLE
|
||||
"<CMAKE_ObjectiveC_COMPILER> <FLAGS> <CMAKE_ObjectiveC_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_ObjectiveC_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_ObjectiveC_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ObjectiveC_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_ObjectiveC_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_ObjectiveC_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ObjectiveC_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_ObjectiveC_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_ObjectiveC_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ObjectiveC_FLAG})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_ObjectiveC_FLAGS
|
||||
CMAKE_ObjectiveC_FLAGS_DEBUG
|
||||
CMAKE_ObjectiveC_FLAGS_MINSIZEREL
|
||||
CMAKE_ObjectiveC_FLAGS_RELEASE
|
||||
CMAKE_ObjectiveC_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
set(CMAKE_ObjectiveC_INFORMATION_LOADED 1)
|
|
@ -1,64 +0,0 @@
|
|||
if(CMAKE_ObjectiveC_COMPILER_FORCED)
|
||||
# The compiler configuration was forced by the user.
|
||||
# Assume the user has configured all compiler information.
|
||||
set(CMAKE_ObjectiveC_COMPILER_WORKS TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CMakeTestCompilerCommon)
|
||||
|
||||
# Remove any cached result from an older CMake version.
|
||||
# We now store this in CMakeCCompiler.cmake.
|
||||
unset(CMAKE_ObjectiveC_COMPILER_WORKS CACHE)
|
||||
|
||||
# This file is used by EnableLanguage in cmGlobalGenerator to
|
||||
# determine that that selected C compiler can actually compile
|
||||
# and link the most basic of programs. If not, a fatal error
|
||||
# is set and cmake stops processing commands and will not generate
|
||||
# any makefiles or projects.
|
||||
if(NOT CMAKE_ObjectiveC_COMPILER_WORKS)
|
||||
PrintTestCompilerStatus("ObjectiveC" "")
|
||||
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testObjectiveCCompiler.m
|
||||
"#ifdef __cplusplus\n"
|
||||
"# error \"The CMAKE_ObjectiveC_COMPILER is set to an ObjectiveC++ compiler\"\n"
|
||||
"#endif\n"
|
||||
"@interface Foo\n"
|
||||
"@end\n"
|
||||
"int main(int argc, char* argv[])\n"
|
||||
"{ (void)argv; return argc-1;}\n")
|
||||
try_compile(CMAKE_ObjectiveC_COMPILER_WORKS ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testObjectiveCCompiler.m
|
||||
OUTPUT_VARIABLE __CMAKE_ObjectiveC_COMPILER_OUTPUT)
|
||||
# Move result from cache to normal variable.
|
||||
set(CMAKE_ObjectiveC_COMPILER_WORKS ${CMAKE_ObjectiveC_COMPILER_WORKS})
|
||||
unset(CMAKE_ObjectiveC_COMPILER_WORKS CACHE)
|
||||
set(ObjectiveC_TEST_WAS_RUN 1)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_ObjectiveC_COMPILER_WORKS)
|
||||
PrintTestCompilerStatus("ObjectiveC" " -- broken")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the ObjectiveC compiler works failed with "
|
||||
"the following output:\n${__CMAKE_ObjectiveC_COMPILER_OUTPUT}\n\n")
|
||||
message(FATAL_ERROR "The ObjectiveC compiler \"${CMAKE_ObjectiveC_COMPILER}\" "
|
||||
"is not able to compile a simple test program.\nIt fails "
|
||||
"with the following output:\n ${__CMAKE_ObjectiveC_COMPILER_OUTPUT}\n\n"
|
||||
"CMake will not be able to correctly generate this project.")
|
||||
else()
|
||||
if(ObjectiveC_TEST_WAS_RUN)
|
||||
PrintTestCompilerStatus("ObjectiveC" " -- works")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the ObjectiveC compiler works passed with "
|
||||
"the following output:\n${__CMAKE_ObjectiveC_COMPILER_OUTPUT}\n\n")
|
||||
endif()
|
||||
|
||||
# Re-configure file
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeObjectiveCCompiler.cmake.in
|
||||
${CMAKE_PLATFORM_INFO_DIR}/CMakeObjectiveCCompiler.cmake
|
||||
@ONLY
|
||||
)
|
||||
include(${CMAKE_PLATFORM_INFO_DIR}/CMakeObjectiveCCompiler.cmake)
|
||||
endif()
|
||||
|
||||
unset(__CMAKE_ObjectiveC_COMPILER_OUTPUT)
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
option(LANG_CXX "Turn on C++ support" ON)
|
||||
option(LANG_OBJC "Turn on Objective-C support" OFF)
|
||||
|
||||
if (LANG_CXX)
|
||||
enable_language(CXX)
|
||||
if (CMAKE_CXX_COMPILER_WORKS)
|
||||
set(CXX_BRIDGE 1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (LANG_OBJC)
|
||||
enable_language(ObjectiveC)
|
||||
if (CMAKE_ObjectiveC_COMPILER_WORKS)
|
||||
set(OBJC_BRIDGE 1)
|
||||
endif ()
|
||||
endif ()
|
|
@ -43,12 +43,13 @@ if (MSVC)
|
|||
include_directories(dependencies/wingetopt/src/)
|
||||
endif ()
|
||||
|
||||
# Language support
|
||||
|
||||
include(Languages)
|
||||
|
||||
# Check for C++11
|
||||
|
||||
option(LANG_CXX "Turn on C++ support" ON)
|
||||
if (LANG_CXX)
|
||||
enable_language(CXX)
|
||||
endif ()
|
||||
|
||||
if (NOT MSVC AND CMAKE_CXX_COMPILER_WORKS)
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
|
@ -133,9 +134,6 @@ find_package(PCRE)
|
|||
# List sources and headers
|
||||
|
||||
set(SOURCE_FILES
|
||||
src/core/wrappers/wrap.h
|
||||
src/core/wrappers/wrap.c
|
||||
src/core/wrappers/wrappers.c
|
||||
src/core/abort.c
|
||||
src/core/abort.h
|
||||
src/core/report.c
|
||||
|
@ -150,6 +148,7 @@ set(SOURCE_FILES
|
|||
src/core/stats.c
|
||||
src/core/stats.h
|
||||
src/core/ordered-set.c
|
||||
src/core/test.c
|
||||
src/compat/internal.h
|
||||
src/compat/pipe.c
|
||||
src/compat/pipe.h
|
||||
|
@ -203,23 +202,6 @@ if (PCRE_FOUND)
|
|||
set(HAVE_PCRE 1)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_WORKS)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} src/core/wrappers/wrap.cc)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_ObjectiveC_COMPILER_WORKS)
|
||||
set(CMAKE_ObjectiveC_FLAGS "${CMAKE_ObjectiveC_FLAGS} ${CMAKE_C_FLAGS} -fobjc-exceptions")
|
||||
if ("${CMAKE_ObjectiveC_COMPILER_ID}" STREQUAL "Clang" AND APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework Foundation")
|
||||
endif ()
|
||||
add_definitions(-D_NATIVE_OBJC_EXCEPTIONS)
|
||||
|
||||
if (NOT WIN32)
|
||||
set(CMAKE_ObjectiveC_FLAGS "${CMAKE_ObjectiveC_FLAGS} -fPIC")
|
||||
endif ()
|
||||
set(SOURCE_FILES ${SOURCE_FILES} src/core/wrappers/wrap.m)
|
||||
endif ()
|
||||
|
||||
set(INTERFACE_FILES
|
||||
include/criterion/assert.h
|
||||
include/criterion/abort.h
|
||||
|
|
|
@ -42,6 +42,8 @@ CR_API CR_NORETURN void criterion_abort_test(void);
|
|||
*/
|
||||
CR_INLINE static void criterion_continue_test(void) {}
|
||||
|
||||
CR_API void criterion_test_die(const char *msg, ...);
|
||||
|
||||
CR_END_C_API
|
||||
|
||||
#endif /* !CRITERION_ABORT_H_ */
|
||||
|
|
|
@ -113,6 +113,9 @@ CR_API int criterion_handle_args(int argc, char *argv[], bool handle_unknown_arg
|
|||
CR_API void criterion_register_test(struct criterion_test_set *tests,
|
||||
struct criterion_test *test);
|
||||
|
||||
extern const struct criterion_test *const criterion_current_test;
|
||||
extern const struct criterion_suite *const criterion_current_suite;
|
||||
|
||||
CR_END_C_API
|
||||
|
||||
#endif /* !CRITERION_H_ */
|
||||
|
|
|
@ -79,6 +79,7 @@ struct criterion_test_params {
|
|||
|
||||
# define CR_PARAM_TEST_BASE(Param, Category, Name, ...) \
|
||||
CR_PARAM_TEST_PROTOTYPE_(Param, Category, Name); \
|
||||
CR_TEST_TRAMPOLINE_(Category, Name) \
|
||||
struct criterion_test_extra_data CR_IDENTIFIER_(Category, Name, extra) = \
|
||||
CR_EXPAND(CRITERION_MAKE_STRUCT(criterion_test_extra_data, \
|
||||
.lang_ = CR_LANG, \
|
||||
|
@ -92,7 +93,7 @@ struct criterion_test_params {
|
|||
struct criterion_test CR_IDENTIFIER_(Category, Name, meta) = { \
|
||||
#Name, \
|
||||
#Category, \
|
||||
(void(*)(void)) CR_IDENTIFIER_(Category, Name, impl), \
|
||||
CR_IDENTIFIER_(Category, Name, jmp), \
|
||||
&CR_IDENTIFIER_(Category, Name, extra) \
|
||||
}; \
|
||||
CR_SECTION_("cr_tst") \
|
||||
|
|
|
@ -27,6 +27,14 @@
|
|||
# include "designated-initializer-compat.h"
|
||||
# include "common.h"
|
||||
|
||||
# ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
# include <exception>
|
||||
# endif
|
||||
|
||||
# define CR_IDENTIFIER_(Category, Name, Suffix) \
|
||||
Category ## _ ## Name ## _ ## Suffix
|
||||
|
||||
|
@ -55,8 +63,88 @@
|
|||
# define CR_SUITE_IDENTIFIER_(Name, Suffix) \
|
||||
suite_ ## Name ## _ ## Suffix
|
||||
|
||||
CR_BEGIN_C_API
|
||||
|
||||
CR_API void criterion_internal_test_setup(void);
|
||||
CR_API void criterion_internal_test_main(void (*fn)(void));
|
||||
CR_API void criterion_internal_test_teardown(void);
|
||||
|
||||
CR_END_C_API
|
||||
|
||||
static const char *const cr_msg_test_init_std_exception = "Caught an unexpected exception during the test initialization: %s.";
|
||||
static const char *const cr_msg_test_init_other_exception = "Caught some unexpected exception during the test initialization.";
|
||||
static const char *const cr_msg_test_main_std_exception = "Caught an unexpected exception during the test execution: %s.";
|
||||
static const char *const cr_msg_test_main_other_exception = "Caught some unexpected exception during the test execution.";
|
||||
static const char *const cr_msg_test_fini_std_exception = "Caught an unexpected exception during the test finalization: %s.";
|
||||
static const char *const cr_msg_test_fini_other_exception = "Caught some unexpected exception during the test finalization.";
|
||||
|
||||
# ifdef __cplusplus
|
||||
# define CR_TEST_TRAMPOLINE_(Category, Name) \
|
||||
static inline void CR_IDENTIFIER_(Category, Name, jmp)(void) { \
|
||||
try { \
|
||||
criterion_internal_test_setup(); \
|
||||
} catch (const std::exception &e) { \
|
||||
criterion_test_die(cr_msg_test_init_std_exception, e.what()); \
|
||||
} catch (...) { \
|
||||
criterion_test_die(cr_msg_test_init_other_exception); \
|
||||
} \
|
||||
try { \
|
||||
criterion_internal_test_main((void(*)(void)) CR_IDENTIFIER_(Category, Name, impl)); \
|
||||
} catch (const std::exception &e) { \
|
||||
criterion_test_die(cr_msg_test_main_std_exception, e.what()); \
|
||||
} catch (...) { \
|
||||
criterion_test_die(cr_msg_test_main_other_exception); \
|
||||
} \
|
||||
try { \
|
||||
criterion_internal_test_teardown(); \
|
||||
} catch (const std::exception &e) { \
|
||||
criterion_test_die(cr_msg_test_fini_std_exception, e.what()); \
|
||||
} catch (...) { \
|
||||
criterion_test_die(cr_msg_test_fini_other_exception); \
|
||||
} \
|
||||
}
|
||||
# else
|
||||
# if defined(__OBJC__) && defined(__EXCEPTIONS)
|
||||
# define CR_TEST_TRAMPOLINE_(Category, Name) \
|
||||
static inline void CR_IDENTIFIER_(Category, Name, jmp)(void) { \
|
||||
@try { \
|
||||
criterion_internal_test_setup(); \
|
||||
} @catch (NSException *e) { \
|
||||
NSString *reason = [e reason]; \
|
||||
criterion_test_die(cr_msg_test_init_std_exception, [reason UTF8String]); \
|
||||
} @catch (...) { \
|
||||
criterion_test_die(cr_msg_test_init_other_exception); \
|
||||
} \
|
||||
@try { \
|
||||
criterion_internal_test_main((void(*)(void)) CR_IDENTIFIER_(Category, Name, impl)); \
|
||||
} @catch (NSException *e) { \
|
||||
NSString *reason = [e reason]; \
|
||||
criterion_test_die(cr_msg_test_main_std_exception, [reason UTF8String]); \
|
||||
} @catch (...) { \
|
||||
criterion_test_die(cr_msg_test_main_other_exception); \
|
||||
} \
|
||||
@try { \
|
||||
criterion_internal_test_teardown(); \
|
||||
} @catch (NSException *e) { \
|
||||
NSString *reason = [e reason]; \
|
||||
criterion_test_die(cr_msg_test_fini_std_exception, [reason UTF8String]); \
|
||||
} @catch (...) { \
|
||||
criterion_test_die(cr_msg_test_fini_other_exception); \
|
||||
} \
|
||||
}
|
||||
# else
|
||||
# define CR_TEST_TRAMPOLINE_(Category, Name) \
|
||||
static inline void CR_IDENTIFIER_(Category, Name, jmp)(void) { \
|
||||
criterion_internal_test_setup(); \
|
||||
criterion_internal_test_main((void(*)(void)) CR_IDENTIFIER_(Category, Name, impl)); \
|
||||
criterion_internal_test_teardown(); \
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define CR_TEST_BASE(Category, Name, ...) \
|
||||
CR_TEST_PROTOTYPE_(Category, Name); \
|
||||
CR_TEST_TRAMPOLINE_(Category, Name) \
|
||||
struct criterion_test_extra_data CR_IDENTIFIER_(Category, Name, extra) = \
|
||||
CR_EXPAND(CRITERION_MAKE_STRUCT(criterion_test_extra_data, \
|
||||
.lang_ = CR_LANG, \
|
||||
|
@ -70,7 +158,7 @@
|
|||
struct criterion_test CR_IDENTIFIER_(Category, Name, meta) = { \
|
||||
#Name, \
|
||||
#Category, \
|
||||
CR_IDENTIFIER_(Category, Name, impl), \
|
||||
CR_IDENTIFIER_(Category, Name, jmp), \
|
||||
&CR_IDENTIFIER_(Category, Name, extra) \
|
||||
}; \
|
||||
CR_SECTION_("cr_tst") \
|
||||
|
|
|
@ -7,13 +7,6 @@
|
|||
#cmakedefine MINGW_DEFINE_OFF_T @MINGW_DEFINE_OFF_T@
|
||||
#cmakedefine01 HAVE_STRTOK_S
|
||||
|
||||
#cmakedefine CXX_BRIDGE @CXX_BRIDGE@
|
||||
#cmakedefine OBJECTIVEC_BRIDGE @OBJECTIVEC_BRIDGE@
|
||||
|
||||
# ifdef OBJECTIVEC_BRIDGE
|
||||
# define OBJC_BRIDGE OBJECTIVEC_BRIDGE
|
||||
# endif
|
||||
|
||||
# define LOCALEDIR "${LOCALEDIR}"
|
||||
# define PACKAGE "${PROJECT_NAME}"
|
||||
# define VERSION "${PROJECT_VERSION}"
|
||||
|
|
|
@ -29,6 +29,4 @@
|
|||
|
||||
extern jmp_buf g_pre_test;
|
||||
|
||||
void criterion_test_die(const char *msg, ...);
|
||||
|
||||
#endif /* !ABORT_H_ */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <errno.h>
|
||||
#include <csptr/smalloc.h>
|
||||
#include <valgrind/valgrind.h>
|
||||
#include "criterion/criterion.h"
|
||||
#include "criterion/internal/test.h"
|
||||
#include "criterion/options.h"
|
||||
#include "criterion/internal/ordered-set.h"
|
||||
#include "criterion/logging.h"
|
||||
|
@ -35,7 +35,6 @@
|
|||
#include "compat/time.h"
|
||||
#include "compat/posix.h"
|
||||
#include "compat/processor.h"
|
||||
#include "wrappers/wrap.h"
|
||||
#include "string/i18n.h"
|
||||
#include "io/event.h"
|
||||
#include "io/output.h"
|
||||
|
@ -159,6 +158,9 @@ struct criterion_test_set *criterion_init(void) {
|
|||
return set;
|
||||
}
|
||||
|
||||
const struct criterion_test *criterion_current_test;
|
||||
const struct criterion_suite *criterion_current_suite;
|
||||
|
||||
void run_test_child(struct criterion_test *test,
|
||||
struct criterion_suite *suite) {
|
||||
|
||||
|
@ -166,19 +168,16 @@ void run_test_child(struct criterion_test *test,
|
|||
VALGRIND_ENABLE_ERROR_REPORTING;
|
||||
#endif
|
||||
|
||||
criterion_current_test = test;
|
||||
criterion_current_suite = suite;
|
||||
|
||||
if (suite->data && suite->data->timeout != 0 && test->data->timeout == 0)
|
||||
setup_timeout((uint64_t) (suite->data->timeout * 1e9));
|
||||
else if (test->data->timeout != 0)
|
||||
setup_timeout((uint64_t) (test->data->timeout * 1e9));
|
||||
|
||||
if (g_wrappers[test->data->lang_]) {
|
||||
g_wrappers[test->data->lang_](test, suite);
|
||||
} else {
|
||||
criterion_test_die(
|
||||
"The test is compiled in the %s programming language, but the \n"
|
||||
"criterion runner have been compiled without its language support.",
|
||||
cr_language_names[test->data->lang_]);
|
||||
}
|
||||
if (test->test)
|
||||
test->test();
|
||||
}
|
||||
|
||||
#define push_event(...) \
|
||||
|
|
|
@ -21,34 +21,42 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "criterion/internal/test.h"
|
||||
#include "core/abort.h"
|
||||
#include "core/stats.h"
|
||||
#include "core/worker.h"
|
||||
#include "core/report.h"
|
||||
#include "compat/time.h"
|
||||
#include "io/event.h"
|
||||
#include "wrap.h"
|
||||
|
||||
extern const struct criterion_test *criterion_current_test;
|
||||
extern const struct criterion_suite *criterion_current_suite;
|
||||
|
||||
static INLINE void nothing(void) {}
|
||||
|
||||
void c_wrap(struct criterion_test *test, struct criterion_suite *suite) {
|
||||
void criterion_internal_test_setup(void) {
|
||||
const struct criterion_suite *suite = criterion_current_suite;
|
||||
const struct criterion_test *test = criterion_current_test;
|
||||
|
||||
criterion_send_event(PRE_INIT, NULL, 0);
|
||||
if (suite->data)
|
||||
(suite->data->init ? suite->data->init : nothing)();
|
||||
(test->data->init ? test->data->init : nothing)();
|
||||
}
|
||||
|
||||
void criterion_internal_test_main(void (*fn)(void)) {
|
||||
const struct criterion_test *test = criterion_current_test;
|
||||
|
||||
criterion_send_event(PRE_TEST, NULL, 0);
|
||||
|
||||
struct timespec_compat ts;
|
||||
if (!setjmp(g_pre_test)) {
|
||||
timer_start(&ts);
|
||||
if (test->test) {
|
||||
if (!test->data->param_) {
|
||||
test->test();
|
||||
} else {
|
||||
void(*param_test_func)(void *) = (void(*)(void*)) test->test;
|
||||
param_test_func(g_worker_context.param->ptr);
|
||||
}
|
||||
if (!test->data->param_) {
|
||||
fn();
|
||||
} else {
|
||||
void(*param_test_func)(void *) = (void(*)(void*)) fn;
|
||||
param_test_func(g_worker_context.param->ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,9 +65,15 @@ void c_wrap(struct criterion_test *test, struct criterion_suite *suite) {
|
|||
elapsed_time = -1;
|
||||
|
||||
criterion_send_event(POST_TEST, &elapsed_time, sizeof(double));
|
||||
}
|
||||
|
||||
void criterion_internal_test_teardown(void) {
|
||||
const struct criterion_suite *suite = criterion_current_suite;
|
||||
const struct criterion_test *test = criterion_current_test;
|
||||
|
||||
(test->data->fini ? test->data->fini : nothing)();
|
||||
if (suite->data)
|
||||
(suite->data->fini ? suite->data->fini : nothing)();
|
||||
criterion_send_event(POST_FINI, NULL, 0);
|
||||
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2015 Franklin "Snaipe" Mathieu <http://snai.pe/>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#include <exception>
|
||||
#include "criterion/event.h"
|
||||
|
||||
#include "core/report.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "core/abort.h"
|
||||
#include "core/worker.h"
|
||||
#include "compat/time.h"
|
||||
#include "wrap.h"
|
||||
#include "common.h"
|
||||
|
||||
static INLINE void nothing(void) {}
|
||||
|
||||
void cxx_wrap(struct criterion_test *test, struct criterion_suite *suite);
|
||||
|
||||
}
|
||||
|
||||
void cxx_wrap(struct criterion_test *test, struct criterion_suite *suite) {
|
||||
|
||||
criterion_send_event(PRE_INIT, NULL, 0);
|
||||
try {
|
||||
if (suite->data)
|
||||
(suite->data->init ? suite->data->init : nothing)();
|
||||
(test->data->init ? test->data->init : nothing)();
|
||||
} catch (const std::exception &e) {
|
||||
criterion_test_die("Caught an unexpected exception during the test initialization: %s.", e.what());
|
||||
} catch (...) {
|
||||
criterion_test_die("Caught some unexpected exception during the test initialization.");
|
||||
}
|
||||
criterion_send_event(PRE_TEST, NULL, 0);
|
||||
|
||||
struct timespec_compat ts;
|
||||
if (!setjmp(g_pre_test)) {
|
||||
timer_start(&ts);
|
||||
if (test->test) {
|
||||
try {
|
||||
if (!test->data->param_) {
|
||||
test->test();
|
||||
} else {
|
||||
void(*param_test_func)(void *) = (void(*)(void*)) test->test;
|
||||
param_test_func(g_worker_context.param->ptr);
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
criterion_test_die("Caught an unexpected exception during the test execution: %s.", e.what());
|
||||
} catch (...) {
|
||||
criterion_test_die("Caught some unexpected exception during the test execution.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double elapsed_time;
|
||||
if (!timer_end(&elapsed_time, &ts))
|
||||
elapsed_time = -1;
|
||||
|
||||
criterion_send_event(POST_TEST, &elapsed_time, sizeof(double));
|
||||
try {
|
||||
(test->data->fini ? test->data->fini : nothing)();
|
||||
if (suite->data)
|
||||
(suite->data->fini ? suite->data->fini : nothing)();
|
||||
} catch (const std::exception &e) {
|
||||
criterion_test_die("Caught an unexpected exception during the test finalization: %s.", e.what());
|
||||
} catch (...) {
|
||||
criterion_test_die("Caught some unexpected exception during the test finalization.");
|
||||
}
|
||||
criterion_send_event(POST_FINI, NULL, 0);
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2015 Franklin "Snaipe" Mathieu <http://snai.pe/>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef WRAP_H_
|
||||
# define WRAP_H_
|
||||
|
||||
# include "criterion/types.h"
|
||||
# include "config.h"
|
||||
|
||||
typedef void (f_wrapper)(struct criterion_test *, struct criterion_suite *);
|
||||
|
||||
void c_wrap(struct criterion_test *test, struct criterion_suite *suite);
|
||||
|
||||
# ifdef CXX_BRIDGE
|
||||
void cxx_wrap(struct criterion_test *test, struct criterion_suite *suite);
|
||||
# endif
|
||||
|
||||
# ifdef OBJC_BRIDGE
|
||||
void objc_wrap(struct criterion_test *test, struct criterion_suite *suite);
|
||||
# endif
|
||||
|
||||
extern f_wrapper *g_wrappers[];
|
||||
|
||||
#endif /* !WRAP_H_ */
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2015 Franklin "Snaipe" Mathieu <http://snai.pe/>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "criterion/assert.h"
|
||||
#include "criterion/event.h"
|
||||
|
||||
#include "core/abort.h"
|
||||
#include "core/report.h"
|
||||
#include "core/worker.h"
|
||||
#include "compat/time.h"
|
||||
#include "wrap.h"
|
||||
#include "common.h"
|
||||
|
||||
static INLINE void nothing(void) {}
|
||||
|
||||
void objc_wrap(struct criterion_test *test, struct criterion_suite *suite) {
|
||||
|
||||
criterion_send_event(PRE_INIT, NULL, 0);
|
||||
@try {
|
||||
if (suite->data)
|
||||
(suite->data->init ? suite->data->init : nothing)();
|
||||
(test->data->init ? test->data->init : nothing)();
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
NSString *reason = [e reason];
|
||||
criterion_test_die("Caught an unexpected exception during the test initialization: %s.", [reason UTF8String]);
|
||||
}
|
||||
@catch (...) {
|
||||
criterion_test_die("Caught some unexpected exception during the test initialization.");
|
||||
}
|
||||
criterion_send_event(PRE_TEST, NULL, 0);
|
||||
|
||||
struct timespec_compat ts;
|
||||
if (!setjmp(g_pre_test)) {
|
||||
timer_start(&ts);
|
||||
if (test->test) {
|
||||
@try {
|
||||
if (!test->data->param_) {
|
||||
test->test();
|
||||
} else {
|
||||
void(*param_test_func)(void *) = (void(*)(void*)) test->test;
|
||||
param_test_func(g_worker_context.param->ptr);
|
||||
}
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
NSString *reason = [e reason];
|
||||
criterion_test_die("Caught an unexpected exception during the test execution: %s.", [reason UTF8String]);
|
||||
}
|
||||
@catch (...) {
|
||||
criterion_test_die("Caught some unexpected exception during the test execution.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double elapsed_time;
|
||||
if (!timer_end(&elapsed_time, &ts))
|
||||
elapsed_time = -1;
|
||||
|
||||
criterion_send_event(POST_TEST, &elapsed_time, sizeof(double));
|
||||
@try {
|
||||
(test->data->fini ? test->data->fini : nothing)();
|
||||
if (suite->data)
|
||||
(suite->data->fini ? suite->data->fini : nothing)();
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
NSString *reason = [e reason];
|
||||
criterion_test_die("Caught an unexpected exception during the test finalization: %s.", [reason UTF8String]);
|
||||
}
|
||||
@catch (...) {
|
||||
criterion_test_die("Caught some unexpected exception during the test finalization.");
|
||||
}
|
||||
criterion_send_event(POST_FINI, NULL, 0);
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright © 2015 Franklin "Snaipe" Mathieu <http://snai.pe/>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#include "wrap.h"
|
||||
|
||||
f_wrapper *g_wrappers[CR_LANG_SIZE_] = {
|
||||
[CR_LANG_C] = c_wrap,
|
||||
|
||||
#ifdef CXX_BRIDGE
|
||||
[CR_LANG_CXX] = cxx_wrap,
|
||||
#endif
|
||||
|
||||
#ifdef OBJC_BRIDGE
|
||||
[CR_LANG_OBJC] = objc_wrap,
|
||||
[CR_LANG_OBJCXX] = objc_wrap,
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *const cr_language_names[CR_LANG_SIZE_] = {
|
||||
[CR_LANG_C] = "C",
|
||||
[CR_LANG_CXX] = "C++",
|
||||
[CR_LANG_OBJC] = "Objective-C",
|
||||
[CR_LANG_OBJCXX] = "Objective-C++",
|
||||
};
|
||||
|
Loading…
Add table
Reference in a new issue