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

use ubuntu-latest for tsan CI #2267

Merged
merged 10 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ jobs:

bazel_tsan:
name: Bazel tsan config
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe
std::atomic<bool> is_setup_{false};
std::atomic<bool> is_running_{false};
std::vector<HTTP_SERVER_NS::HttpRequest> received_requests_;
std::mutex cv_mtx_requests;
std::mutex mtx_requests;
std::condition_variable cv_got_events;
std::mutex cv_m;
Expand Down Expand Up @@ -142,15 +143,14 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe
int response_status = 404;
if (request.uri == "/get/")
{

std::unique_lock<std::mutex> lk(mtx_requests);
std::unique_lock<std::mutex> lk1(mtx_requests);
received_requests_.push_back(request);
response.headers["Content-Type"] = "text/plain";
response_status = 200;
}
else if (request.uri == "/post/")
{
std::unique_lock<std::mutex> lk(mtx_requests);
std::unique_lock<std::mutex> lk1(mtx_requests);
received_requests_.push_back(request);
response.headers["Content-Type"] = "application/json";
response.body = "{'k1':'v1', 'k2':'v2', 'k3':'v3'}";
Expand All @@ -164,7 +164,7 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe

bool waitForRequests(unsigned timeOutSec, unsigned expected_count = 1)
{
std::unique_lock<std::mutex> lk(mtx_requests);
std::unique_lock<std::mutex> lk(cv_mtx_requests);
if (cv_got_events.wait_for(lk, std::chrono::milliseconds(1000 * timeOutSec), [&] {
//
Copy link
Member

@owent owent Aug 18, 2023

Choose a reason for hiding this comment

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

Do we need std::unique_lock<std::mutex> lk1(mtx_requests); here?(In callback of cv_got_events.wait_for)

return received_requests_.size() >= expected_count;
Expand Down