Limit compiler jobs if the machine has lower than 4gb/thread (#22704)
This commit is contained in:
@ -21,15 +21,16 @@ export RUST_BACKTRACE=1
|
|||||||
export RUSTFLAGS="-D warnings"
|
export RUSTFLAGS="-D warnings"
|
||||||
source scripts/ulimit-n.sh
|
source scripts/ulimit-n.sh
|
||||||
|
|
||||||
# Limit compiler jobs to reduce memory usage
|
# limit jobs to 4gb/thread
|
||||||
# on machines with 2gb/thread of memory
|
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
|
||||||
NPROC=$(nproc)
|
NPROC=$(nproc)
|
||||||
NPROC=$((NPROC>14 ? 14 : NPROC))
|
JOBS=$((JOBS>NPROC ? NPROC : JOBS))
|
||||||
|
|
||||||
|
|
||||||
echo "Executing $testName"
|
echo "Executing $testName"
|
||||||
case $testName in
|
case $testName in
|
||||||
test-stable)
|
test-stable)
|
||||||
_ "$cargo" stable test --jobs "$NPROC" --all --exclude solana-local-cluster ${V:+--verbose} -- --nocapture
|
_ "$cargo" stable test --jobs "$JOBS" --all --exclude solana-local-cluster ${V:+--verbose} -- --nocapture
|
||||||
;;
|
;;
|
||||||
test-stable-bpf)
|
test-stable-bpf)
|
||||||
# Clear the C dependency files, if dependency moves these files are not regenerated
|
# Clear the C dependency files, if dependency moves these files are not regenerated
|
||||||
|
@ -68,8 +68,13 @@ if [[ -n $CI || -z $1 ]]; then
|
|||||||
$(git grep -l "proc-macro.*true" :**/Cargo.toml | sed 's|Cargo.toml|src/lib.rs|')
|
$(git grep -l "proc-macro.*true" :**/Cargo.toml | sed 's|Cargo.toml|src/lib.rs|')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUST_LOG=solana=trace _ "$cargo" nightly test --target-dir target/cov --no-run "${packages[@]}"
|
# limit jobs to 4gb/thread
|
||||||
if RUST_LOG=solana=trace _ "$cargo" nightly test --target-dir target/cov "${packages[@]}" 2> target/cov/coverage-stderr.log; then
|
JOBS=$(grep MemTotal /proc/meminfo | awk '{printf "%.0f", ($2 / (4 * 1024 * 1024))}')
|
||||||
|
NPROC=$(nproc)
|
||||||
|
JOBS=$((JOBS>NPROC ? NPROC : JOBS))
|
||||||
|
|
||||||
|
RUST_LOG=solana=trace _ "$cargo" nightly test --jobs "$JOBS" --target-dir target/cov --no-run "${packages[@]}"
|
||||||
|
if RUST_LOG=solana=trace _ "$cargo" nightly test --jobs "$JOBS" --target-dir target/cov "${packages[@]}" 2> target/cov/coverage-stderr.log; then
|
||||||
test_status=0
|
test_status=0
|
||||||
else
|
else
|
||||||
test_status=$?
|
test_status=$?
|
||||||
|
Reference in New Issue
Block a user