Skip to content

Commit 509d0dd

Browse files
committed
fix: resolve CI configuration and static analysis issues
Summary: - Upgraded CI actions to v4. - Added explicit sanitizer flags for linker to resolve ThreadSanitizer issues. - Fixed potential null socket dereference in tests/cloudSQL_tests.cpp.
1 parent fbc8625 commit 509d0dd

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ jobs:
4949
mkdir build
5050
cd build
5151
export CCACHE_DIR=~/.ccache
52-
# Use matrix sanitizer. ThreadSanitizer requires specialized flags.
5352
if [ "${{ matrix.sanitizer }}" == "thread" ]; then
5453
SAN_FLAGS="-fsanitize=thread"
5554
else
@@ -60,6 +59,8 @@ jobs:
6059
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
6160
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
6261
-DCMAKE_CXX_FLAGS="$SAN_FLAGS" \
62+
-DCMAKE_EXE_LINKER_FLAGS="$SAN_FLAGS" \
63+
-DCMAKE_SHARED_LINKER_FLAGS="$SAN_FLAGS" \
6364
-DBUILD_TESTS=ON \
6465
-DBUILD_COVERAGE=${{ matrix.sanitizer == 'address' && 'ON' || 'OFF' }}
6566

tests/cloudSQL_tests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ TEST(NetworkTest_Handshake) {
379379
std::this_thread::sleep_for(std::chrono::milliseconds(200));
380380

381381
int sock = socket(AF_INET, SOCK_STREAM, 0);
382+
if (sock < 0) {
383+
throw std::runtime_error("Failed to create socket in NetworkTest_Handshake");
384+
}
382385
struct sockaddr_in addr;
383386
addr.sin_family = AF_INET;
384387
addr.sin_port = htons(port);

0 commit comments

Comments
 (0)