Skip to content

Commit

Permalink
Merge branch 'refactor/legacy_api' into 'master'
Browse files Browse the repository at this point in the history
refactor: remove support for legacy builds as not necessary anymore

See merge request multicore/drace!62
  • Loading branch information
fmoessbauer committed Sep 17, 2019
2 parents 15fdeb4 + 9f69171 commit 2e250b4
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 62 deletions.
22 changes: 0 additions & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ cmake:
artifacts:
paths:
- build-tsan-dr791
- build-legacy-tsan-dr791

compile:
<<: *globals
Expand All @@ -43,7 +42,6 @@ compile:
artifacts:
paths:
- build-tsan-dr791
- build-legacy-tsan-dr791
dependencies:
- cmake

Expand All @@ -52,7 +50,6 @@ cppcheck:
stage: validate
script:
- cd build-tsan-dr791; C:\opt\Cppcheck\cppcheck.exe --project=compile_commands.json --enable=all --inline-suppr --suppressions-list=suppressions.txt --error-exitcode=1 --quiet
- cd ../build-legacy-tsan-dr791; C:\opt\Cppcheck\cppcheck.exe --project=compile_commands.json --enable=all --inline-suppr --suppressions-list=suppressions.txt --error-exitcode=1 --quiet
dependencies:
- cmake

Expand All @@ -75,23 +72,6 @@ test-tsan-dr791:
dependencies:
- compile


test-tsan-dr791-legacy:
<<: *globals
<<: *testing
stage: test
script:
- cd build-legacy-tsan-dr791
- echo "Use DR 7.91.x (LEGACY build)"
- .\test\drace-tests.exe --dr $env:DRRUN_EXE --gtest_output="xml:test-results.xml" --gtest_filter="-DrIntegration*.DotnetClr*"
artifacts:
reports:
junit:
- build-legacy-tsan-dr791\test-results.xml
dependencies:
- compile


gui-test:
stage: test
tags:
Expand All @@ -113,10 +93,8 @@ bundle:
- echo "Generate Changelog"
- npx generate-changelog
- Copy-Item "CHANGELOG.md" -Destination "build-tsan-dr791/package/doc/"
- Copy-Item "CHANGELOG.md" -Destination "build-legacy-tsan-dr791/package/doc/"
dependencies:
- compile
artifacts:
paths:
- build-tsan-dr791/package
- build-legacy-tsan-dr791/package
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ set(DRACE_DETECTOR "tsan" CACHE STRING "Detector to be used")
set(DRACE_CPPCHECK_BIN "C:/Program Files/Cppcheck/cppcheck.exe" CACHE STRING "path to cppcheck binary")
set(DRACE_XML_EXPORTER ON CACHE BOOL "Build with Valkyrie compatible XML exporter")
set(DRACE_LOGLEVEL "2" CACHE STRING "Set loglevel of DRace (0: error, 1: warning, ... 4: trace)")
set(DRACE_USE_LEGACY_API OFF CACHE BOOL "Build a Windows 7 compatible version")

# install targets
set(DRACE_INSTALL_TESTS OFF CACHE BOOL "Install test target")
Expand All @@ -30,10 +29,6 @@ set(DRACE_INSTALL_DOCS ON CACHE BOOL "Install documentation")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if(${DRACE_USE_LEGACY_API})
set(DRACE_XML_EXPORTER OFF CACHE BOOL "Build with Valkyrie compatible XML exporter" FORCE)
endif()

if(${DRACE_ENABLE_CPPCHECK})
if(CMAKE_VERSION VERSION_GREATER 3.10.0)
if(EXISTS "${DRACE_CPPCHECK_BIN}")
Expand Down
2 changes: 1 addition & 1 deletion bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ set(SOURCES "main" "detector" "containers")
add_executable("${PROJECT_NAME}-bench" ${SOURCES})
set_target_properties("${PROJECT_NAME}-bench" PROPERTIES CXX_STANDARD 14)

target_link_libraries("${PROJECT_NAME}-bench" benchmark "drace-detector" "drace-common")
target_link_libraries("${PROJECT_NAME}-bench" benchmark "drace.detector.tsan" "drace-common")

add_subdirectory(apps)
7 changes: 0 additions & 7 deletions contrib/build-ci.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,3 @@ cd build-tsan-dr791
cmake --build .
cmake --build . --target install
cd ..

echo "=== Build drace-LEGACY-TSAN DR 7.91.x ==="
cd build-legacy-tsan-dr791
cmake --build .
cmake --build . --target install
cd ..

7 changes: 0 additions & 7 deletions contrib/generate-ci.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,3 @@ mkdir build-tsan-dr791
cd build-tsan-dr791
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDRACE_XML_EXPORTER=1 -DDRACE_ENABLE_TESTING=1 -DDRACE_ENABLE_BENCH=1 -DDynamoRIO_DIR=C:/opt/DynamoRIO-Windows-7.91.18081-0/cmake -DDRACE_DETECTOR=tsan -DCMAKE_INSTALL_PREFIX:PATH=package ..
cd ..

echo "=== Generate drace-LEGACY-TSAN DR 7.91.x ==="
mkdir build-legacy-tsan-dr791
cd build-legacy-tsan-dr791
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDRACE_USE_LEGACY_API=1 -DDRACE_ENABLE_TESTING=1 -DDRACE_ENABLE_BENCH=0 -DDynamoRIO_DIR=C:/opt/DynamoRIO-Windows-7.91.18081-0/cmake -DDRACE_DETECTOR=tsan -DCMAKE_INSTALL_PREFIX:PATH=package ..
cd ..

6 changes: 1 addition & 5 deletions drace-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ target_compile_options("drace-client" PRIVATE -EHsc)
# TinyXML2
if(${DRACE_XML_EXPORTER})
target_link_libraries("drace-client" "tinyxml2")
target_compile_definitions("drace-client" PRIVATE -DXML_EXPORTER)
endif()

if(${DRACE_USE_LEGACY_API})
target_compile_definitions("drace-client" PRIVATE -DDRACE_USE_LEGACY_API)
target_compile_definitions("drace-client" PRIVATE -DDRACE_XML_EXPORTER)
endif()

# Copy settings ini to root dir
Expand Down
17 changes: 7 additions & 10 deletions drace-client/src/drace-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "util/DrModuleLoader.h"

#include "sink/hr-text.h"
#ifdef XML_EXPORTER
#ifdef DRACE_XML_EXPORTER
#include "sink/valkyrie.h"
#endif
#include "MSR.h"
Expand Down Expand Up @@ -151,7 +151,7 @@ namespace drace {

// when using direct lookup, we stream the races
if (!params.delayed_sym_lookup) {
#ifdef XML_EXPORTER
#ifdef DRACE_XML_EXPORTER
if (params.xml_file != "") {
auto target = std::make_shared<DrFile>(params.xml_file, DR_FILE_WRITE_OVERWRITE);
if (target->good()) {
Expand Down Expand Up @@ -277,7 +277,7 @@ namespace drace {
clipp::option("--delay-syms").set(params.delayed_sym_lookup) % "perform symbol lookup after application shutdown",
(clipp::option("--suplevel") & clipp::integer("level", params.suppression_level)) % "suppress similar races (0=detector-default, 1=unique top-of-callstack entry, default: 1)",
(
#ifndef DRACE_USE_LEGACY_API
#ifdef DRACE_XML_EXPORTER
(clipp::option("--xml-file", "-x") & clipp::value("filename", params.xml_file)) % "log races in valkyries xml format in this file",
#endif
(clipp::option("--out-file", "-o") & clipp::value("filename", params.out_file)) % "log races in human readable format in this file"
Expand All @@ -291,9 +291,6 @@ namespace drace {
dr_printf("DRace, a dynamic data race detector\nVersion: %s\nHash: %s\n",
DRACE_BUILD_VERSION,
DRACE_BUILD_HASH);
#ifdef DRACE_USE_LEGACY_API
dr_printf("Note: Windows 7 compatible build with limited feature set\n");
#endif
dr_abort(); }) % "display version information"),
clipp::option("-h", "--usage").set(display_help) % "display help"
);
Expand Down Expand Up @@ -360,10 +357,10 @@ namespace drace {
params.delayed_sym_lookup ? "ON" : "OFF",
params.config_file.c_str(),
params.out_file != "" ? params.out_file.c_str() : "OFF",
#ifdef DRACE_USE_LEGACY_API
"Unsupported (legacy build)",
#else
#ifdef DRACE_XML_EXPORTER
params.xml_file != "" ? params.xml_file.c_str() : "OFF",
#else
"Unsupported (build without XML exporter)",
#endif
params.stack_size,
params.extctrl ? "ON" : "OFF",
Expand All @@ -389,7 +386,7 @@ namespace drace {
LOG_ERROR(-1, "Could not open race-report file: %c", params.out_file.c_str());
}
}
#ifdef XML_EXPORTER
#ifdef DRACE_XML_EXPORTER
// Write XML output
if (params.xml_file != "") {
auto race_xml_report = std::make_shared<DrFile>(params.xml_file, DR_FILE_WRITE_OVERWRITE);
Expand Down
2 changes: 0 additions & 2 deletions drace-client/src/memory-tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ namespace drace {
data->stats = (Statistics*) dr_thread_alloc(drcontext, sizeof(Statistics));
new (data->stats) Statistics(data->tid);

#ifndef DRACE_USE_LEGACY_API
// TODO: emulate this for windows 7
// determin stack range of this thread
if (runtime_tid.load(std::memory_order_relaxed) != data->tid) {
Expand All @@ -247,7 +246,6 @@ namespace drace {
// TODO: this lookup cannot be performed on master thread, as state is not valid. See drmem#xxx
LOG_NOTICE(data->tid, "stack range cannot be detected");
}
#endif
}

void MemoryTracker::event_thread_exit(void *drcontext)
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ add_custom_target(copy_files_testing ALL
)

if(${DRACE_XML_EXPORTER})
target_compile_definitions(${TEST_TARGET} PRIVATE -DXML_EXPORTER)
target_compile_definitions(${TEST_TARGET} PRIVATE -DDRACE_XML_EXPORTER)
target_link_libraries(${TEST_TARGET} "tinyxml2")
add_custom_command(TARGET copy_files_testing POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
Expand Down
4 changes: 2 additions & 2 deletions test/src/IntegrationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <string>
#include <future>

#ifdef XML_EXPORTER
#ifdef DRACE_XML_EXPORTER
#include <tinyxml2.h>
#include <cstdio>
#endif
Expand Down Expand Up @@ -92,7 +92,7 @@ TEST_P(DR, DotnetClrMutex) {
msr_task.join();
}

#ifdef XML_EXPORTER
#ifdef DRACE_XML_EXPORTER
TEST_P(DR, ReportXML) {
std::string filename("reportXML.xml");
run(std::string(GetParam()) + " --xml-file " + filename, "mini-apps/concurrent-inc/gp-concurrent-inc.exe", 1, 10);
Expand Down

0 comments on commit 2e250b4

Please sign in to comment.