Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add thread sanitizer to CI #78

Merged
merged 4 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/Check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
- development

jobs:
clang:
clang-asan:
name: Clang ASAN, UBSAN
runs-on: ubuntu-18.04

Expand All @@ -34,7 +34,22 @@ jobs:
- name: Requirements install
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-8-dev libc++abi-8-dev
- name: Configure
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined,fuzzer-no-link" ../
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined" ../
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was the previously present fuzzer-no-link redundant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the flag is only needed when compiling fuzzer...

- name: Build
run: cd build && cmake --build .
- name: Test
run: cd build/bin && ./server_test && ./library_test

clang-tsan:
name: Clang TSAN
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v1
- name: Requirements install
run: sudo apt-get update && sudo apt-get install uuid-dev ninja-build libc++-8-dev libc++abi-8-dev
- name: Configure
run: mkdir build && cd build && cmake -G Ninja -DBUILD_VSIX=Off -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_CXX_FLAGS="-fsanitize=thread" ../
- name: Build
run: cd build && cmake --build .
- name: Test
Expand Down
30 changes: 30 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,36 @@
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
},
{
"name": "WSL-Clang-Release-TSAN",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeExecutable": "/usr/bin/cmake",
"cmakeCommandArgs": "-DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_FLAGS=\"-fsanitize=thread\"",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
},
{
"name": "WSL-Clang-Debug-TSAN",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\install\\${name}",
"cmakeExecutable": "/usr/bin/cmake",
"cmakeCommandArgs": "-DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_FLAGS=\"-fsanitize=thread\"",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"addressSanitizerRuntimeFlags": "detect_leaks=0",
"variables": []
},
{
"name": "WSL-Clang-Fuzzer",
"generator": "Ninja",
Expand Down
6 changes: 5 additions & 1 deletion language_server/src/request_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ void request_manager::end_worker()
worker_.join();
}

bool request_manager::is_running() const { return !requests_.empty(); }
bool request_manager::is_running()
{
std::unique_lock<std::mutex> lock(q_mtx_);
return !requests_.empty();
}

void request_manager::handle_request_(const std::atomic<bool>* end_loop)
{
Expand Down
2 changes: 1 addition & 1 deletion language_server/src/request_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class request_manager
void add_request(server* server, json message);
void finish_server_requests(server* server);
void end_worker();
bool is_running() const;
bool is_running();

private:
std::atomic<bool> end_worker_;
Expand Down
1 change: 1 addition & 0 deletions language_server/test/dap/feature_launch_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ TEST_F(feature_launch_test, step)

methods["continue"]("47"_json, json());
resp_provider.wait_for_exited();
ws_mngr.disconnect();
}

std::string file_breakpoint = R"( LR 1,1
Expand Down
2 changes: 1 addition & 1 deletion parser_library/src/workspace_manager_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ class workspace_manager::impl : public diagnosable_impl, public debugging::debug

private:
debugging::debug_config debug_cfg_;
std::unique_ptr<debugging::debugger> debugger_;
std::set<debug_event_consumer*> debug_event_consumers_;
std::unique_ptr<debugging::debug_lib_provider> debug_lib_provider_;
std::unique_ptr<debugging::debugger> debugger_;

// Inherited via debug_event_consumer_s
virtual void stopped(const std::string& reason, const std::string& addtl_info) override
Expand Down