Skip to content

Commit 931208c

Browse files
committed
test: fix acceptance tests on Apple Silicon Macs
We observed sporadic compilation or bytecode issues on Apple Silicon Macs. According to golang/go#42774, the env variable `GODEBUG=asyncpreemptoff=1` works around the issue by disabling asynchronous preemption of goroutines. This might impact garbage collection performance, but restores the same level of reliability to locally running tests as when run in Docker on an Intel based Mac. The `GODEBUG=asyncpreemptoff=1` variable is set when creating the Docker container for running tests locally, and applies to all Go code, including `go vet`, for which we also observed sporadic issues.
1 parent 41b9b92 commit 931208c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/create-docker-container.bash

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,24 @@ else
3434
ARGS="${*}"
3535
fi
3636

37+
# disable asyncpreempt on MacOS ARM64 (Apple Silicon) as it may cause sporadic errors in emulation
38+
# see: https://github.com/golang/go/issues/42774
39+
DISABLE_ASYNC_PREEMPT=
40+
if [ "$(uname -sm)" == "Darwin arm64" ]; then
41+
DISABLE_ASYNC_PREEMPT='--env GODEBUG=asyncpreemptoff=1'
42+
fi
43+
3744
docker pull "${IMAGE}"
3845
docker rm -f $CONTAINER_NAME
3946
docker run -it \
4047
--env "DB=${DB}" \
4148
--env "REPO_NAME=$REPO_NAME" \
4249
--env "REPO_PATH=/repo" \
50+
$DISABLE_ASYNC_PREEMPT \
4351
--rm \
4452
--name "$CONTAINER_NAME" \
4553
-v "${REPO_PATH}:/repo" \
4654
-v "${CI}:/ci" \
4755
${ARGS} \
4856
"${IMAGE}" \
4957
/bin/bash
50-

0 commit comments

Comments
 (0)