summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-01-21 11:58:37 -0800
committer Colin Cross <ccross@android.com> 2025-01-21 11:59:51 -0800
commit8ca51c6fd89555ebadb418617933dfc730ccf864 (patch)
treedd7be98c996b74637c3cf2db8a863c936775859c
parent41692ce4861588107d0db45dae059f53c6405c01 (diff)
Make go test -race more hermetic
Pass the same --sysroot, -B and -L flags to go test -race as Soong does for hermetic host builds. Test: OUT_DIR=/tmp/out ./run-soong-tests-with-go-tools.sh Change-Id: I2a47894c21610c219b48cd380ed44e3e11a236a2
-rwxr-xr-xscripts/run-soong-tests-with-go-tools.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/run-soong-tests-with-go-tools.sh b/scripts/run-soong-tests-with-go-tools.sh
index 1fbb1fc77..82efaa0eb 100755
--- a/scripts/run-soong-tests-with-go-tools.sh
+++ b/scripts/run-soong-tests-with-go-tools.sh
@@ -38,6 +38,11 @@ if [[ ${OS} = linux ]]; then
CLANG_VERSION=$(build/soong/scripts/get_clang_version.py)
export CC="${TOP}/prebuilts/clang/host/${OS}-x86/${CLANG_VERSION}/bin/clang"
export CXX="${TOP}/prebuilts/clang/host/${OS}-x86/${CLANG_VERSION}/bin/clang++"
+ glibc_dir="${TOP}/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8"
+ export CGO_CFLAGS="--sysroot ${glibc_dir}/sysroot/"
+ export CGO_CPPFLAGS="--sysroot ${glibc_dir}/sysroot/"
+ export CGO_CXXFLAGS="--sysroot ${glibc_dir}/sysroot/"
+ export CGO_LDFLAGS="--sysroot ${glibc_dir}/sysroot/ -B ${glibc_dir}/lib/gcc/x86_64-linux/4.8.3 -L ${glibc_dir}/lib/gcc/x86_64-linux/4.8.3 -L ${glibc_dir}/x86_64-linux/lib64"
fi
# androidmk_test.go gets confused if ANDROID_BUILD_TOP is set.