diff --git a/ci/cloudbuild/builds/integration-bq-driver-asan.sh b/ci/cloudbuild/builds/integration-bq-driver-asan.sh index 54bf4fd821..be73a7c737 100755 --- a/ci/cloudbuild/builds/integration-bq-driver-asan.sh +++ b/ci/cloudbuild/builds/integration-bq-driver-asan.sh @@ -42,7 +42,6 @@ git checkout "$VCPKG_VERSION" ./bootstrap-vcpkg.sh -disableMetrics cd "$WORKSPACE_DIR" - # This runs all the unit tests mapfile -t args < <(bazel::common_args) mapfile -t unit_tests_args < <(unit_tests::bazel_args) @@ -56,6 +55,7 @@ mapfile -t cmake_args < <(cmake::common_args) BUILD_DIR="/opt/odbc-driver" # This is the name of DSN set in odbc.ini export ODBC_TESTS_DSN="SampleDSNGoogleDriver" +export ASAN_OPTIONS="detect_container_overflow=0:detect_leaks=1" export LSAN_OPTIONS="use_tls=0:suppressions=/opt/odbc-driver/lsan.supp:print_suppressions=0" export CPP_BIGQUERY_ODBC_TEST_TABLE_PREFIX=${TRIGGER_NAME//[-:;.,?]/_}_${BRANCH_NAME//[-:;.,?]/_} @@ -84,8 +84,9 @@ io::run cmake -B "$BUILD_DIR" \ -DODBC_EXAMPLES=ON \ -DODBC_UNIT_TESTING=OFF \ -DCLIENT_LIBRARY_INTEGRATION_TESTING=OFF - io::run cmake --build cmake-out +# Copy the roots.pem file to the .so directory to run test cases. +cp /opt/odbc-driver/roots.pem "cmake-out/google/cloud/odbc/roots.pem" mapfile -t ctest_args < <(ctest::common_args) io::run env -C cmake-out ctest "${ctest_args[@]}" diff --git a/ci/cloudbuild/dockerfiles/ubuntu-22.04-install.Dockerfile b/ci/cloudbuild/dockerfiles/ubuntu-22.04-install.Dockerfile index 33e5f46c3f..13ba73141e 100644 --- a/ci/cloudbuild/dockerfiles/ubuntu-22.04-install.Dockerfile +++ b/ci/cloudbuild/dockerfiles/ubuntu-22.04-install.Dockerfile @@ -22,8 +22,7 @@ RUN apt-get update && \ build-essential \ # Dependency for arrow bison \ - clang-12 \ - lld-12 \ + clang \ cmake \ curl \ # Dependency for arrow @@ -32,10 +31,8 @@ RUN apt-get update && \ git \ gcc \ g++ \ - # Required by Ubsan in Ubuntu 22.04 - libunwind-12-dev \ - libc++-12-dev \ - libc++abi-12-dev \ + libc++-dev \ + libc++abi-dev \ libcurl4-openssl-dev \ # Needed to use autoreconf libltdl-dev \ @@ -61,7 +58,15 @@ RUN apt-get update && \ apt-utils \ ca-certificates \ apt-transport-https \ - clang-tidy-12 + clang-tidy + +# Set Clang 12 as default +RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \ + update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 + +# Set the compiler environment variables +ENV CC=/usr/bin/clang +ENV CXX=/usr/bin/clang++ # Needed for the existing driver v3.1.2.1004+ RUN locale-gen en_US.UTF-8 @@ -69,20 +74,6 @@ ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 -# Set clang as default -RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 100 && \ - update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 100 - -ENV CC=clang -ENV CXX=clang++ - -# Install modern CMake locally -RUN mkdir -p /opt/cmake && \ - curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.30.1/cmake-3.30.1-linux-x86_64.tar.gz \ - | tar -xz --strip-components=1 -C /opt/cmake - -ENV PATH=/opt/cmake/bin:$PATH - # clang-tidy-cache needs python RUN update-alternatives --install /usr/bin/python python $(which python3) 10 diff --git a/ci/gha/builds/lib/lsan.supp b/ci/gha/builds/lib/lsan.supp index 37afd5d2a3..c60d360db1 100644 --- a/ci/gha/builds/lib/lsan.supp +++ b/ci/gha/builds/lib/lsan.supp @@ -7,3 +7,9 @@ leak:Diagnostics::AddStatusRecord leak:StatusRecord leak:std::__cxx11::basic_string leak:_iodbcdm_SetConnectOption_init +leak:ld-linux-x86-64.so.2 +leak:_dl_exception_create_format +leak:libc.so.6 +leak:CRYPTO_zalloc +leak:grpc_jwt_encode_and_sign +leak:_iodbcdm_pushsqlerr diff --git a/google/cloud/odbc/integration_tests/odbc_driver_tests/connection_test.cc b/google/cloud/odbc/integration_tests/odbc_driver_tests/connection_test.cc index c531537a57..2701247505 100644 --- a/google/cloud/odbc/integration_tests/odbc_driver_tests/connection_test.cc +++ b/google/cloud/odbc/integration_tests/odbc_driver_tests/connection_test.cc @@ -1175,9 +1175,13 @@ TEST(ConnectionTest, SQLBrowseConnect_InvalidConnectionAttribute) { HasSubstr("Catalog:Catalog=?;OAuthMechanism:OAuthMechanism=?")); #endif // _WIN32 } - // Pass `false` to indicate that the Driver Manager (DM) will automatically - // free the environment handle when the last connection handle is released. +// Pass `false` to indicate that the Driver Manager (DM) will automatically +// free the environment handle when the last connection handle is released. +#ifdef _WIN32 CleanupODBCHandles(*conn, false); +#else + CleanupODBCHandles(*conn); +#endif } TEST(ConnectionTest, SQLBrowseConnect_InvalidConnectionString) {