Skip to content

build-script: Throttle the number of parallel tests run acording to -j. #25798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -754,14 +754,12 @@ function set_build_options_for_host() {
-DSWIFT_HOST_VARIANT_ARCH="${SWIFT_HOST_VARIANT_ARCH}"
)

if [[ "${LLVM_LIT_ARGS}" ]]; then
llvm_cmake_options+=(
-DLLVM_LIT_ARGS="${LLVM_LIT_ARGS}"
)
swift_cmake_options+=(
-DLLVM_LIT_ARGS="${LLVM_LIT_ARGS}"
)
fi
llvm_cmake_options+=(
-DLLVM_LIT_ARGS="${LLVM_LIT_ARGS} -j ${BUILD_JOBS}"
)
swift_cmake_options+=(
-DLLVM_LIT_ARGS="${LLVM_LIT_ARGS} -j ${BUILD_JOBS}"
)

if [[ "${CLANG_PROFILE_INSTR_USE}" ]]; then
llvm_cmake_options+=(
Expand Down Expand Up @@ -3140,7 +3138,7 @@ for host in "${ALL_HOSTS[@]}"; do

if [[ "${ENABLE_ASAN}" ]] ; then
# Limit the number of parallel tests
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} --threads=$(sysctl hw.physicalcpu | awk '{ print $2 }')"
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} -j $(sysctl hw.physicalcpu | awk -v N=${BUILD_JOBS} '{ print (N < $2) ? N : $2 }')"
fi

if [[ "$(true_false ${LLDB_TEST_SWIFT_ONLY})" == "TRUE" ]]; then
Expand All @@ -3151,9 +3149,9 @@ for host in "${ALL_HOSTS[@]}"; do
LLVM_LIT_ARGS="${LLVM_LIT_ARGS} -v --time-tests"
if [[ "$using_xcodebuild" == "FALSE" ]] ; then
with_pushd ${lldb_build_dir} \
call ${NINJA_BIN} unittests/LLDBUnitTests
call ${NINJA_BIN} -j ${BUILD_JOBS} unittests/LLDBUnitTests
with_pushd ${lldb_build_dir} \
call ${NINJA_BIN} lldb-test-deps
call ${NINJA_BIN} -j ${BUILD_JOBS} lldb-test-deps
with_pushd ${results_dir} \
call "${llvm_build_dir}/bin/llvm-lit" \
"${lldb_build_dir}/lit" \
Expand Down