@@ -5,35 +5,39 @@ mkdir -p ~/.gradle/init.d && cp -v $WORKSPACE/.ci/init.gradle ~/.gradle/init.d
55
66MAX_WORKERS=4
77
8- # Don't run this stuff on Windows
9- if ! uname -a | grep -q MING; then
10- # drop page cache and kernel slab objects on linux
11- [[ -x /usr/local/sbin/drop-caches ]] && sudo /usr/local/sbin/drop-caches
8+ if [ -z " $MAX_WORKER_ENV " ]; then
9+ # Don't run this stuff on Windows
10+ if ! uname -a | grep -q MING; then
11+ # drop page cache and kernel slab objects on linux
12+ [[ -x /usr/local/sbin/drop-caches ]] && sudo /usr/local/sbin/drop-caches
1213
13- if [ " $( uname -m) " = " arm64" ] || [ " $( uname -m) " = " aarch64" ]; then
14- MAX_WORKERS=16
15- elif [ -f /proc/cpuinfo ]; then
16- MAX_WORKERS=` grep ' ^cpu\scores' /proc/cpuinfo | uniq | sed ' s/\s\+//g' | cut -d' :' -f 2`
17- else
18- if [[ " $OSTYPE " == " darwin" * ]]; then
19- MAX_WORKERS=` sysctl -n hw.physicalcpu | sed ' s/\s\+//g' `
20- else
21- echo " Unsupported OS Type: $OSTYPE "
22- exit 1
23- fi
24- fi
25- if pwd | grep -v -q ^/dev/shm ; then
26- echo " Not running on a ramdisk, reducing number of workers"
27- MAX_WORKERS=$(( $MAX_WORKERS * 2 / 3 ))
28- fi
14+ if [ " $( uname -m) " = " arm64" ] || [ " $( uname -m) " = " aarch64" ]; then
15+ MAX_WORKERS=16
16+ elif [ -f /proc/cpuinfo ]; then
17+ MAX_WORKERS=` grep ' ^cpu\scores' /proc/cpuinfo | uniq | sed ' s/\s\+//g' | cut -d' :' -f 2`
18+ else
19+ if [[ " $OSTYPE " == " darwin" * ]]; then
20+ MAX_WORKERS=` sysctl -n hw.physicalcpu | sed ' s/\s\+//g' `
21+ else
22+ echo " Unsupported OS Type: $OSTYPE "
23+ exit 1
24+ fi
25+ fi
26+ if pwd | grep -v -q ^/dev/shm ; then
27+ echo " Not running on a ramdisk, reducing number of workers"
28+ MAX_WORKERS=$(( $MAX_WORKERS * 2 / 3 ))
29+ fi
2930
30- # Export glibc version as environment variable since some BWC tests are incompatible with later versions
31- export GLIBC_VERSION=$( ldd --version | grep ' ^ldd' | sed ' s/.* \([1-9]\.[0-9]*\).*/\1/' )
32- fi
31+ # Export glibc version as environment variable since some BWC tests are incompatible with later versions
32+ export GLIBC_VERSION=$( ldd --version | grep ' ^ldd' | sed ' s/.* \([1-9]\.[0-9]*\).*/\1/' )
33+ fi
3334
34- # Running on 2-core machines without ramdisk can make this value be 0
35- if [[ " $MAX_WORKERS " == " 0" ]]; then
36- MAX_WORKERS=1
35+ # Running on 2-core machines without ramdisk can make this value be 0
36+ if [[ " $MAX_WORKERS " == " 0" ]]; then
37+ MAX_WORKERS=1
38+ fi
39+ else
40+ MAX_WORKERS=$MAX_WORKER_ENV
3741fi
3842
3943set -e
0 commit comments