From 026756a36dcdaee3e49147eaefb2bd71ff6f50fa Mon Sep 17 00:00:00 2001 From: Michael Kazakov Date: Fri, 12 Jan 2024 22:53:19 +0000 Subject: [PATCH] Setting up ASAN builds of unit tests --- .github/workflows/build.yml | 2 +- Scripts/run_all_unit_tests.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f90d61002..8862d3714 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: CCACHE_MAXSIZE: "400M" strategy: matrix: - configuration: ["Debug", "Release"] + configuration: ["Debug", "Release", "ASAN"] steps: - name: Select latest Xcode run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app" diff --git a/Scripts/run_all_unit_tests.sh b/Scripts/run_all_unit_tests.sh index 596b3c9b0..fbf5a679a 100755 --- a/Scripts/run_all_unit_tests.sh +++ b/Scripts/run_all_unit_tests.sh @@ -1,4 +1,5 @@ #!/bin/sh +# Usage: ./run_all_unit_tests.sh [Debug|Release|ASAN] set -e set -o pipefail @@ -36,6 +37,13 @@ build_target() TARGET=$1 CONFIGURATION=$2 echo building ${TARGET} - ${CONFIGURATION} + + asan_flags="" + if [ "$CONFIGURATION" == "ASAN" ]; then + CONFIGURATION="Release" + asan_flags="-enableAddressSanitizer YES" + fi + XC="xcodebuild \ -project ${XCODEPROJ} \ -scheme ${TARGET} \ @@ -43,6 +51,7 @@ build_target() SYMROOT=${BUILD_DIR} \ OBJROOT=${BUILD_DIR} \ -parallelizeTargets \ + ${asan_flags} \ OTHER_CFLAGS=\"-fdebug-prefix-map=${ROOT_DIR}=.\"" BINARY_DIR=$($XC -showBuildSettings | grep " BUILT_PRODUCTS_DIR =" | sed -e 's/.*= *//') BINARY_NAME=$($XC -showBuildSettings | grep " FULL_PRODUCT_NAME =" | sed -e 's/.*= *//')