From: Peter Rabbitson Date: Thu, 2 Apr 2015 08:13:40 +0000 (+0200) Subject: (travis) Refactor the NUMTHREADS codepaths, rename variable (see next commit) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ac4a96d843a246b621d0e225cb693323f5d2227;p=dbsrgits%2FDBIx-Class.git (travis) Refactor the NUMTHREADS codepaths, rename variable (see next commit) --- diff --git a/.travis.yml b/.travis.yml index 9fe3eac..e7d1fa7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ # possible set of deps *without testing them*. This ensures we stay within # a reasonable build-time and still run as many of our tests as possible # -# * The perl builds and the DBIC tests run under NUMTHREADS number of threads. +# * The perl builds and the DBIC tests run under VCPU_USE number of threads. # The testing of dependencies under CLEANTEST runs single-threaded, at least # until we fix our entire dep-chain to safely pass under -j # @@ -75,7 +75,7 @@ perl: env: - CLEANTEST=false - - CLEANTEST=true NUMTHREADS=1 + - CLEANTEST=true VCPU_USE=1 matrix: fast_finish: true diff --git a/maint/travis-ci_scripts/10_before_install.bash b/maint/travis-ci_scripts/10_before_install.bash index 9f0e3e5..53ff95c 100755 --- a/maint/travis-ci_scripts/10_before_install.bash +++ b/maint/travis-ci_scripts/10_before_install.bash @@ -40,8 +40,10 @@ if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi # # We also divide the result by a factor, otherwise the travis VM gets # overloaded (the amount of available swap is just TOOOO damn small) -if [[ -z "$NUMTHREADS" ]] ; then - export NUMTHREADS="$(( ( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ) / 3 ))" +export VCPU_AVAILABLE="$(( ( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ) / 3 ))" + +if [[ -z "$VCPU_USE" ]] ; then + export VCPU_USE="$VCPU_AVAILABLE" fi export CACHE_DIR="/tmp/poormanscache" diff --git a/maint/travis-ci_scripts/20_install.bash b/maint/travis-ci_scripts/20_install.bash index 02e2041..279dafd 100755 --- a/maint/travis-ci_scripts/20_install.bash +++ b/maint/travis-ci_scripts/20_install.bash @@ -9,7 +9,7 @@ CPAN_MIRROR="http://cpan.metacpan.org/" PERL_CPANM_OPT="$PERL_CPANM_OPT --mirror $CPAN_MIRROR" # do not set PERLBREW_CPAN_MIRROR - not all backpan-like mirrors have the perl tarballs -export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 HARNESS_TIMER=1 MAKEFLAGS="-j$NUMTHREADS" +export PERL_MM_USE_DEFAULT=1 PERL_MM_NONINTERACTIVE=1 PERL_AUTOINSTALL_PREFER_CPAN=1 HARNESS_TIMER=1 MAKEFLAGS="-j$VCPU_USE" # try CPAN's latest offering if requested if [[ "$DEVREL_DEPS" == "true" ]] ; then @@ -25,7 +25,7 @@ if [[ -n "$BREWVER" ]] ; then # since perl 5.14 a perl can safely be built concurrently with -j$large # (according to brute force testing and my power bill) if [[ "$BREWVER" == "blead" ]] || perl -Mversion -e "exit !!(version->new(q($BREWVER)) < 5.014)" ; then - perlbrew_jopt="$NUMTHREADS" + perlbrew_jopt="$VCPU_USE" fi run_or_err "Compiling/installing Perl $BREWVER (without testing, using ${perlbrew_jopt:-1} threads, may take up to 5 minutes)" \ diff --git a/maint/travis-ci_scripts/40_script.bash b/maint/travis-ci_scripts/40_script.bash index 21a1d84..c95ce1f 100755 --- a/maint/travis-ci_scripts/40_script.bash +++ b/maint/travis-ci_scripts/40_script.bash @@ -6,7 +6,7 @@ source maint/travis-ci_scripts/common.bash if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi run_harness_tests() { - local -x HARNESS_OPTIONS=c:j$NUMTHREADS + local -x HARNESS_OPTIONS=c:j$VCPU_USE make test 2> >(tee "$TEST_STDERR_LOG") } @@ -16,7 +16,7 @@ if [[ "$CLEANTEST" = "true" ]] ; then run_or_err "Prepare blib" "make pure_all" run_harness_tests else - PROVECMD="prove -lrswj$NUMTHREADS xt t" + PROVECMD="prove -lrswj$VCPU_USE xt t" # FIXME - temporary, until Package::Stash is fixed if perl -M5.010 -e 1 &>/dev/null ; then diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index 6b9809a..0cb2e0e 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -155,7 +155,7 @@ parallel_installdeps_notest() { run_or_err "Installing (without testing) $(echo $MODLIST)" \ "echo \\ \"$MODLIST\" \\ - | xargs -d '\\n' -n 1 -P $NUMTHREADS bash -c \\ + | xargs -d '\\n' -n 1 -P $VCPU_USE bash -c \\ 'OUT=\$(maint/getstatus $TIMEOUT_CMD cpanm --notest \"\$@\" 2>&1 ) || (LASTEXIT=\$?; echo \"\$OUT\"; exit \$LASTEXIT)' \\ 'giant space monkey penises' " @@ -168,7 +168,7 @@ installdeps() { local -x HARNESS_OPTIONS - HARNESS_OPTIONS="j$NUMTHREADS" + HARNESS_OPTIONS="j$VCPU_USE" if ! run_or_err "Attempting install of $# modules under parallel ($HARNESS_OPTIONS) testing ($MODLIST)" "_dep_inst_with_test $MODLIST" quiet_fail ; then local errlog="failed after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/nopaste -q -s Shadowcat -d "Parallel testfail" <<< "$LASTOUT")"