Commit 97294718 authored by Ben Huber's avatar Ben Huber

REQUIRE_TEST marking via macro without 'deprecated' misuse. changed CC CI to use clang++ again

parent 8a0fa1dc
#================================================================================================= #=================================================================================================
# Compiler Options # Compiler Options
#================================================================================================= #=================================================================================================
CXX = g++ CXX = clang++
COMPATIBILITY = -std=c++14 COMPATIBILITY = -std=c++14
DEBUG_OPTIMIZATION = TRUE DEBUG_OPTIMIZATION = TRUE
......
...@@ -297,7 +297,7 @@ ifdef BROCKEN_CI ...@@ -297,7 +297,7 @@ ifdef BROCKEN_CI
test: test:
mkdir -p build mkdir -p build
make $(TEST_NAME) make $(TEST_NAME)
@cat build/build_output.txt | grep "‘EnumMarker’ is deprecated" > build/required_tests.txt @cat build/build_output.txt | grep "REQUIRE_TEST @" > build/required_tests.txt
./$(TEST_NAME) all ./$(TEST_NAME) all
else else
...@@ -307,7 +307,7 @@ JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$ ...@@ -307,7 +307,7 @@ JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$
test: test:
mkdir -p build mkdir -p build
make $(TEST_NAME) $(JOB_FLAG) &> build/build_output.txt || cat build/build_output.txt make $(TEST_NAME) $(JOB_FLAG) &> build/build_output.txt || cat build/build_output.txt
@cat build/build_output.txt | grep "‘EnumMarker’ is deprecated" > build/required_tests.txt @cat build/build_output.txt | grep "REQUIRE_TEST @" > build/required_tests.txt
./$(TEST_NAME) all ./$(TEST_NAME) all
endif endif
else else
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
#ifdef XERUS_TEST_COVERAGE #ifdef XERUS_TEST_COVERAGE
#define S1(x) #x #define XERUS_S1(x) #x
#define S2(x) S1(x) #define XERUS_S2(x) XERUS_S1(x)
#define LOCATION __FILE__ ":" S2(__LINE__) #define XERUS_LOCATION __FILE__ ":" XERUS_S2(__LINE__)
#define LOCATION_MARKED "@" LOCATION "@" #define XERUS_LOCATION_MARKED "@" XERUS_LOCATION "@"
#define XERUS_CC_MARK_WARNING enum [[deprecated(LOCATION_MARKED)]] EnumMarker {}; [[maybe_unused]] EnumMarker trigger;
#define XERUS_DO_PRAGMA(x) _Pragma (#x)
#define XERUS_CC_MARK(msg) XERUS_DO_PRAGMA(message ("REQUIRE_TEST @" msg "@"))
/** /**
* @def XERUS_REQUIRE_TEST * @def XERUS_REQUIRE_TEST
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
*/ */
#define XERUS_REQUIRE_TEST \ #define XERUS_REQUIRE_TEST \
do { \ do { \
static const char * const xerusCCLocalFunctionLocation = LOCATION;\ static const char * const xerusCCLocalFunctionLocation = XERUS_LOCATION;\
static const char * const xerusCCLocalFunctionName = __PRETTY_FUNCTION__;\ static const char * const xerusCCLocalFunctionName = __PRETTY_FUNCTION__;\
__asm__( \ __asm__( \
".pushsection .cc_loc, \"a\", @progbits" "\n" \ ".pushsection .cc_loc, \"a\", @progbits" "\n" \
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
); \ ); \
xerus::misc::CodeCoverage::covered(xerusCCLocalFunctionLocation, xerusCCLocalFunctionName); \ xerus::misc::CodeCoverage::covered(xerusCCLocalFunctionLocation, xerusCCLocalFunctionName); \
\ \
XERUS_CC_MARK_WARNING \ XERUS_CC_MARK(XERUS_LOCATION) \
} while(false) } while(false)
#else #else
......
...@@ -85,8 +85,12 @@ namespace xerus { namespace misc { namespace CodeCoverage { ...@@ -85,8 +85,12 @@ namespace xerus { namespace misc { namespace CodeCoverage {
const auto testLines = xerus::misc::explode(xerus::misc::read_file("build/required_tests.txt"), '\n'); const auto testLines = xerus::misc::explode(xerus::misc::read_file("build/required_tests.txt"), '\n');
for(const auto& line : testLines) { for(const auto& line : testLines) {
if (line.find("note: #pragma message: REQUIRE_TEST @")==line.npos // gcc
&& line.find("warning: REQUIRE_TEST @")==line.npos // clang
) {
continue;
}
const auto lineParts = xerus::misc::explode(line, '@'); const auto lineParts = xerus::misc::explode(line, '@');
REQUIRE(lineParts.size() == 3, "Error parsing the required tests.");
const auto locationParts = misc::explode(lineParts[1], ':'); const auto locationParts = misc::explode(lineParts[1], ':');
REQUIRE(locationParts.size() == 2, "Error parsing the required tests."); REQUIRE(locationParts.size() == 2, "Error parsing the required tests.");
const auto file = xerus::misc::normalize_pathname(locationParts[0]); const auto file = xerus::misc::normalize_pathname(locationParts[0]);
......
...@@ -130,8 +130,6 @@ namespace xerus { namespace misc { ...@@ -130,8 +130,6 @@ namespace xerus { namespace misc {
#undef main #undef main
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
using required_test_t = void (*)();
// signal(SIGINT, xerus::misc::internal::catch_signals); // users ctrl+c should actually terminate the program // signal(SIGINT, xerus::misc::internal::catch_signals); // users ctrl+c should actually terminate the program
// signal(SIGTERM, xerus::misc::internal::catch_signals); // signal(SIGTERM, xerus::misc::internal::catch_signals);
// signal(SIGHUP, xerus::misc::internal::catch_signals); // signal(SIGHUP, xerus::misc::internal::catch_signals);
...@@ -143,19 +141,6 @@ int main(int argc, char* argv[]) { ...@@ -143,19 +141,6 @@ int main(int argc, char* argv[]) {
// Prevent swap usage // Prevent swap usage
mlockall(MCL_CURRENT | MCL_FUTURE); mlockall(MCL_CURRENT | MCL_FUTURE);
// TODO Is this code useful?
// perform required_test initializations
// pass address of xerus::misc::internal::catch_signals as the address of main cannot be taken as by ISO c++...
std::pair<uintptr_t, uintptr_t> requiredTestRange = xerus::misc::get_range_of_section(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(&xerus::misc::internal::catch_signals)), "required_tests");
for (required_test_t* p = reinterpret_cast<required_test_t*>(requiredTestRange.first); p < reinterpret_cast<required_test_t*>(requiredTestRange.second); p += 1) {
try {
(*p)();
} catch (...) {
std::cout << "Required test initialization failed. Required test listing will be wrong." << std::endl;
break;
}
}
//Calculate complete time //Calculate complete time
std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now(); std::chrono::high_resolution_clock::time_point startTime = std::chrono::high_resolution_clock::now();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment