Skip to content

Commit 7f8e92e

Browse files
swolchokDannyYuyang-quic
authored andcommitted
Use -fsanitize=address,undefined in debug builds on CI (pytorch#9397)
These sanitizers help catch bugs. AIUI, they only affect a few unittest jobs.
1 parent a6e77b1 commit 7f8e92e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.ci/scripts/utils.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,14 @@ build_executorch_runner_cmake() {
9292
mkdir "${CMAKE_OUTPUT_DIR}"
9393

9494
pushd "${CMAKE_OUTPUT_DIR}" || return
95+
if [[ $1 == "Debug" ]]; then
96+
CXXFLAGS="-fsanitize=address,undefined"
97+
else
98+
CXXFLAGS=""
99+
fi
95100
# This command uses buck2 to gather source files and buck2 could crash flakily
96101
# on MacOS
97-
retry cmake -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE="${1:-Release}" ..
102+
CXXFLAGS="$CXXFLAGS" retry cmake -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" -DCMAKE_BUILD_TYPE="${1:-Release}" ..
98103
popd || return
99104

100105
if [ "$(uname)" == "Darwin" ]; then

0 commit comments

Comments
 (0)