Skip to content

Commit 6b7b635

Browse files
fix(bq_driver): Asan CI check fix
1 parent 7d6187d commit 6b7b635

4 files changed

Lines changed: 27 additions & 25 deletions

File tree

ci/cloudbuild/builds/integration-bq-driver-asan.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ git checkout "$VCPKG_VERSION"
4242
./bootstrap-vcpkg.sh -disableMetrics
4343

4444
cd "$WORKSPACE_DIR"
45-
4645
# This runs all the unit tests
4746
mapfile -t args < <(bazel::common_args)
4847
mapfile -t unit_tests_args < <(unit_tests::bazel_args)
@@ -56,6 +55,7 @@ mapfile -t cmake_args < <(cmake::common_args)
5655
BUILD_DIR="/opt/odbc-driver"
5756
# This is the name of DSN set in odbc.ini
5857
export ODBC_TESTS_DSN="SampleDSNGoogleDriver"
58+
export ASAN_OPTIONS="detect_container_overflow=0:detect_leaks=1"
5959
export LSAN_OPTIONS="use_tls=0:suppressions=/opt/odbc-driver/lsan.supp:print_suppressions=0"
6060

6161
export CPP_BIGQUERY_ODBC_TEST_TABLE_PREFIX=${TRIGGER_NAME//[-:;.,?]/_}_${BRANCH_NAME//[-:;.,?]/_}
@@ -84,8 +84,9 @@ io::run cmake -B "$BUILD_DIR" \
8484
-DODBC_EXAMPLES=ON \
8585
-DODBC_UNIT_TESTING=OFF \
8686
-DCLIENT_LIBRARY_INTEGRATION_TESTING=OFF
87-
8887
io::run cmake --build cmake-out
8988

89+
# Copy the roots.pem file to the .so directory to run test cases.
90+
cp /opt/odbc-driver/roots.pem "cmake-out/google/cloud/odbc/roots.pem"
9091
mapfile -t ctest_args < <(ctest::common_args)
9192
io::run env -C cmake-out ctest "${ctest_args[@]}"

ci/cloudbuild/dockerfiles/ubuntu-22.04-install.Dockerfile

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ RUN apt-get update && \
2222
build-essential \
2323
# Dependency for arrow
2424
bison \
25-
clang-12 \
26-
lld-12 \
25+
clang \
2726
cmake \
2827
curl \
2928
# Dependency for arrow
@@ -32,10 +31,8 @@ RUN apt-get update && \
3231
git \
3332
gcc \
3433
g++ \
35-
# Required by Ubsan in Ubuntu 22.04
36-
libunwind-12-dev \
37-
libc++-12-dev \
38-
libc++abi-12-dev \
34+
libc++-dev \
35+
libc++abi-dev \
3936
libcurl4-openssl-dev \
4037
# Needed to use autoreconf
4138
libltdl-dev \
@@ -61,28 +58,22 @@ RUN apt-get update && \
6158
apt-utils \
6259
ca-certificates \
6360
apt-transport-https \
64-
clang-tidy-12
61+
clang-tidy
62+
63+
# Set Clang 12 as default
64+
RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \
65+
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
66+
67+
# Set the compiler environment variables
68+
ENV CC=/usr/bin/clang
69+
ENV CXX=/usr/bin/clang++
6570

6671
# Needed for the existing driver v3.1.2.1004+
6772
RUN locale-gen en_US.UTF-8
6873
ENV LANG en_US.UTF-8
6974
ENV LANGUAGE en_US.UTF-8
7075
ENV LC_ALL en_US.UTF-8
7176

72-
# Set clang as default
73-
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 && \
74-
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100
75-
76-
ENV CC=clang
77-
ENV CXX=clang++
78-
79-
# Install modern CMake locally
80-
RUN mkdir -p /opt/cmake && \
81-
curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.30.1/cmake-3.30.1-linux-x86_64.tar.gz \
82-
| tar -xz --strip-components=1 -C /opt/cmake
83-
84-
ENV PATH=/opt/cmake/bin:$PATH
85-
8677
# clang-tidy-cache needs python
8778
RUN update-alternatives --install /usr/bin/python python $(which python3) 10
8879

ci/gha/builds/lib/lsan.supp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ leak:Diagnostics::AddStatusRecord
77
leak:StatusRecord
88
leak:std::__cxx11::basic_string
99
leak:_iodbcdm_SetConnectOption_init
10+
leak:ld-linux-x86-64.so.2
11+
leak:_dl_exception_create_format
12+
leak:libc.so.6
13+
leak:CRYPTO_zalloc
14+
leak:grpc_jwt_encode_and_sign
15+
leak:_iodbcdm_pushsqlerr

google/cloud/odbc/integration_tests/odbc_driver_tests/connection_test.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,9 +1175,13 @@ TEST(ConnectionTest, SQLBrowseConnect_InvalidConnectionAttribute) {
11751175
HasSubstr("Catalog:Catalog=?;OAuthMechanism:OAuthMechanism=?"));
11761176
#endif // _WIN32
11771177
}
1178-
// Pass `false` to indicate that the Driver Manager (DM) will automatically
1179-
// free the environment handle when the last connection handle is released.
1178+
// Pass `false` to indicate that the Driver Manager (DM) will automatically
1179+
// free the environment handle when the last connection handle is released.
1180+
#ifdef _WIN32
11801181
CleanupODBCHandles(*conn, false);
1182+
#else
1183+
CleanupODBCHandles(*conn);
1184+
#endif
11811185
}
11821186

11831187
TEST(ConnectionTest, SQLBrowseConnect_InvalidConnectionString) {

0 commit comments

Comments
 (0)