Skip to content

Commit 269fac4

Browse files
fix(bq_driver): Asan CI check fix
1 parent 0ebda22 commit 269fac4

15 files changed

Lines changed: 43 additions & 98 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 & 78 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

@@ -91,63 +82,6 @@ WORKDIR /var/tmp/downloads
9182
RUN if [ $(ls /var/tmp/ci/requirements.txt | grep -c requirements.txt) -eq 0 ] ; \
9283
then echo 'Unable to find requirements.txt for python...' ; exit 1 ; fi
9384
RUN pip3 install --require-hashes --no-deps -r /var/tmp/ci/requirements.txt
94-
95-
# Install all the direct (and indirect) dependencies for cpp-bigquery-odbc.
96-
# Use a different directory for each build, and remove the downloaded
97-
# files and any temporary artifacts after a successful build to keep the
98-
# image smaller (and with fewer layers)
99-
100-
WORKDIR /var/tmp/build/abseil-cpp
101-
RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20240722.0.tar.gz | \
102-
tar -xzf - --strip-components=1 && \
103-
cmake \
104-
-DCMAKE_BUILD_TYPE="Release" \
105-
-DCMAKE_CXX_STANDARD=17 \
106-
-DABSL_BUILD_TESTING=OFF \
107-
-DABSL_PROPAGATE_CXX_STD=ON \
108-
-DBUILD_SHARED_LIBS=yes \
109-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
110-
-S . -B cmake-out -GNinja && \
111-
cmake --build cmake-out --target install && \
112-
ldconfig && \
113-
cd /var/tmp && rm -fr build
114-
115-
WORKDIR /var/tmp/build/googletest
116-
RUN curl -fsSL https://github.com/google/googletest/archive/v1.15.2.tar.gz | \
117-
tar -xzf - --strip-components=1 && \
118-
cmake \
119-
-DCMAKE_BUILD_TYPE="Release" \
120-
-DBUILD_SHARED_LIBS=yes \
121-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
122-
-S . -B cmake-out -GNinja && \
123-
cmake --build cmake-out --target install && \
124-
ldconfig && \
125-
cd /var/tmp && rm -fr build
126-
127-
# Install ctcache to speed up our clang-tidy build
128-
WORKDIR /var/tmp/build
129-
RUN curl -fsSL https://github.com/matus-chochlik/ctcache/archive/0ad2e227e8a981a9c1a6060ee6c8ec144bb976c6.tar.gz | \
130-
tar -xzf - --strip-components=1 && \
131-
cp clang-tidy /usr/local/bin/clang-tidy-wrapper && \
132-
cp clang-tidy-cache /usr/local/bin/clang-tidy-cache && \
133-
cd /var/tmp && rm -fr build
134-
135-
# Install sccache from https://github.com/mozilla/sccache
136-
WORKDIR /var/tmp/sccache
137-
RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-v0.5.4-x86_64-unknown-linux-musl.tar.gz | \
138-
tar -zxf - --strip-components=1 && \
139-
mkdir -p /usr/local/bin && \
140-
mv sccache /usr/local/bin/sccache && \
141-
chmod +x /usr/local/bin/sccache
142-
143-
# Needed to use autoreconf
144-
WORKDIR /var/tmp/m4
145-
RUN curl -fsSL https://ftp.gnu.org/gnu/m4/m4-1.4.1.tar.gz | \
146-
tar -zxf - --strip-components=1 && \
147-
./configure --enable-gui=no && \
148-
make && \
149-
make install -j "$(nproc)"
150-
15185
# Install the Cloud SDK
15286
COPY ./dependencies/cloud-sdk.sh /var/tmp/ci/dependencies/cloud-sdk.sh
15387
WORKDIR /var/tmp/downloads

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/bq_client_interface/datasets.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "google/cloud/odbc/bq_client_interface/datasets.h"
1616
#include "google/cloud/odbc/internal/status_record_or.h"
1717
#include "google/cloud/bigquery/v2/minimal/internal/dataset_client.h"
18-
#include <absl/log/log.h>
18+
#include "absl/log/log.h"
1919

2020
namespace google::cloud::odbc_bigquery_client_interface {
2121

google/cloud/odbc/bq_client_interface/jobs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "google/cloud/odbc/internal/status_record_or.h"
1919
#include "google/cloud/bigquery/v2/minimal/internal/job_client.h"
2020
#include "google/cloud/bigquery/v2/minimal/internal/job_request.h"
21-
#include <absl/log/log.h>
21+
#include "absl/log/log.h"
2222
#include <thread>
2323

2424
namespace google::cloud::odbc_bigquery_client_interface {

google/cloud/odbc/bq_client_interface/odbc_authentication.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "google/cloud/internal/getenv.h"
2121
#include "google/cloud/oauth2/access_token_generator.h"
2222
#include "google/cloud/status_or.h"
23-
#include <absl/log/log.h>
23+
#include "absl/log/log.h"
2424
#include <fstream>
2525
#include <iterator>
2626
namespace google::cloud::odbc_bigquery_client_interface {

google/cloud/odbc/bq_client_interface/odbc_bq_client.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "google/cloud/credentials.h"
2626
#include "google/cloud/grpc_options.h"
2727
#include "google/cloud/universe_domain_options.h"
28-
#include <absl/log/log.h>
28+
#include "absl/log/log.h"
2929
#include <grpcpp/security/tls_credentials_options.h>
3030
#include <algorithm>
3131

google/cloud/odbc/bq_client_interface/projects.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "google/cloud/odbc/bq_client_interface/datasets.h"
1717
#include "google/cloud/odbc/internal/sql_state_constants.h"
1818
#include "google/cloud/odbc/internal/status_record_or.h"
19+
#include "absl/log/log.h"
1920
#include <google/cloud/resourcemanager/v3/projects.pb.h>
20-
#include <absl/log/log.h>
2121

2222
namespace google::cloud::odbc_bigquery_client_interface {
2323

google/cloud/odbc/bq_client_interface/storage.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#include "google/cloud/odbc/internal/status_record_or.h"
1616
#include "google/cloud/bigquery/storage/v1/bigquery_read_client.h"
17-
#include <absl/log/log.h>
17+
#include "absl/log/log.h"
1818

1919
namespace google::cloud::odbc_bigquery_client_interface {
2020

google/cloud/odbc/bq_client_interface/tables.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "google/cloud/odbc/bq_client_interface/utils.h"
1818
#include "google/cloud/odbc/internal/status_record_or.h"
1919
#include "google/cloud/bigquery/v2/minimal/internal/table_client.h"
20-
#include <absl/log/log.h>
20+
#include "absl/log/log.h"
2121

2222
namespace google::cloud::odbc_bigquery_client_interface {
2323

0 commit comments

Comments
 (0)