···75 }
76 ''
77 # Bazel needs a real home for self-extraction and internal cache
78- export HOME=$(mktemp -d)
07980 ${# Concurrent bazel invocations have the same workspace path.
81- # On darwin, for some reason, it means they access and corrupt the same execroot.
82- # Having a different workspace path ensures we use different execroots.
83- # A different user seems to be enough for a different bazel cache root.
84 lib.optionalString isDarwin ''
85- export USER=$(basename $HOME)
86- # cd $(mktemp --tmpdir=. -d)
87 ''
88 }
89 ${# Speed-up tests by caching bazel extraction.
···75 }
76 ''
77 # Bazel needs a real home for self-extraction and internal cache
78+ mkdir bazel_home
79+ export HOME=$PWD/bazel_home
8081 ${# Concurrent bazel invocations have the same workspace path.
82+ # On darwin, for some reason, it means they access and corrupt the
83+ # same outputRoot, outputUserRoot and outputBase
84+ # Ensure they use build-local outputRoot by setting TEST_TMPDIR
85 lib.optionalString isDarwin ''
86+ export TEST_TMPDIR=$HOME/.cache/bazel
087 ''
88 }
89 ${# Speed-up tests by caching bazel extraction.