From: Peter Rabbitson Date: Wed, 16 Dec 2015 21:32:47 +0000 (+0100) Subject: (travis) Adjust test infrastructure for recent extensive TravisCI changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=36372426fcb6f197d34cdca70e629a3c0da5940f;p=dbsrgits%2FDBIx-Class-Historic.git (travis) Adjust test infrastructure for recent extensive TravisCI changes I mean who does that?!?! https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments This is an initial pass to get things moving again, one more overhaul needs to take place based on 7f6d73eb. For now just make sure we run under both sudo and non-sudo, and be explicit which platform are we running on. Read diff under -w --- diff --git a/.travis.yml b/.travis.yml index d6f2789..d1755c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,27 +6,8 @@ # # * Minimum perl officially supported by DBIC is 5.8.3. This *includes* the # basic depchain. On failure either attempt to fix it or bring it to the -# attention of ribasushi. *DO NOT* disable 5.8 testing - it is here for a -# reason -# -# * The matrix is built from two main modes - CLEANTEST = [true|false]. -# - In the first case we test with minimal deps available, and skip everything -# listed in DBIC::OptDesps. The modules are installed with classic CPAN -# invocations and are *fully tested*. In other words we simulate what would -# happen if a user tried to install on a just-compiled virgin perl -# - Without CLEANTEST we bring the armada of RDBMS and install the maximum -# 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 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 -# -# * The way .travis.yml is fed to the command controller is idiotic - it -# makes using multiline `bash -c` statements impossible. Therefore to -# aid readability (our travis logic is rather complex), the bulk of -# functionality is moved to scripts. More about the problem (and the -# WONTFIX "explanation") here: https://github.com/travis-ci/travis-ci/issues/497 +# attention of the maintainer. *DO NOT* disable 5.8 testing - it is here for +# a very good reason # # the entire run times out after 50 minutes, or after 5 minutes without # console output @@ -55,36 +36,61 @@ notifications: email: recipients: - ribasushi@cpan.org - # Temporary - if it proves to be too noisy, we'll shut it off - #- dbix-class-devel@lists.scsys.co.uk on_success: change on_failure: always -# FIXME - This stuff is not yet available for free OSS accounts, sadpanda -# First paragrah on http://about.travis-ci.org/docs/user/caching/ -#cache: -# apt: true -# directories: -# - /var/cache/apt/archives +addons: + apt: + packages: + - libapp-nopaste-perl + - net-tools +# This is probably a net-loss for setup etc - a bare 'C' will likely fare much better language: perl -perl: - - "5.8" - - "5.20-extras" +# Currently not trying osx: https://github.com/travis-ci/travis-ci/issues/2314 +os: linux -env: - - CLEANTEST=false - - CLEANTEST=true VCPU_USE=1 +# The defaults run under the more rapid container infra. The hardware is +# actually *much* slower, but the jobs start much faster, for more info see +# https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments +# Combined with 'fast_finish' this will result in an "uh-oh" email as early +# as possible +dist: precise +sudo: false +env: CLEANTEST=true -sudo: true +perl: + - "5.8" + - "5.22-extras" matrix: fast_finish: true + include: - # CLEANTEST of minimum supported with non-tracing poisoning - - perl: 5.8.3_nt_mb + + # Same as the "master matrix" above, frozen under older dist/infrastructure + # In genereal it is strongly recommended to keep things on the older + # version indefinitely - there is little value in-depth smoking on + # more recent software stacks + - perl: "5.8" + sudo: required + dist: precise + env: + - CLEANTEST=false + + - perl: "5.22-extras" + sudo: required + dist: precise env: + - CLEANTEST=false + + # CLEANTEST of minimum supported with non-tracing poisoning, single thread (hence the sudo) + - perl: "5.8.3_nt_mb" + sudo: required + dist: precise + env: + - VCPU_USE=1 - CLEANTEST=true - POISON_ENV=true - DBIC_TRACE_PROFILE=console_monochrome @@ -92,7 +98,11 @@ matrix: - BREWOPTS="-Dusemorebits" # Full Test of minimum supported without threads with plain poisoned trace - - perl: 5.8.3_nt + - perl: "5.8.3_nt" + sudo: required + dist: precise + # run these under legacy - great simulation of low memory env + group: legacy env: - CLEANTEST=false - POISON_ENV=true @@ -100,7 +110,11 @@ matrix: - BREWVER=5.8.3 # Full Test of minimum supported with threads with non-tracing poisoning - - perl: 5.8.5_thr + - perl: "5.8.5_thr" + sudo: required + dist: precise + # run these under legacy - great simulation of low memory env + group: legacy env: - CLEANTEST=false - POISON_ENV=true @@ -109,7 +123,9 @@ matrix: - BREWOPTS="-Duseithreads" # CLEANTEST of solaris-like perl with non-tracing poisoning - - perl: 5.8.4_nt + - perl: "5.8.4_nt" + sudo: false + dist: precise env: - CLEANTEST=true - POISON_ENV=true @@ -117,23 +133,30 @@ matrix: - BREWVER=5.8.4 # CLEANTEST: this particular perl is quite widespread - - perl: 5.8.8_thr + - perl: "5.8.8_thr" + sudo: false + dist: precise env: - CLEANTEST=true - BREWVER=5.8.8 - BREWOPTS="-Duseithreads" # CLEANTEST: this is the perl suse ships, with env poisoning - - perl: 5.10.0_thr_dbg + - perl: "5.10.0_thr_dbg" + sudo: false + dist: precise env: - CLEANTEST=true - POISON_ENV=true - BREWVER=5.10.0 - BREWOPTS="-DDEBUGGING -Duseithreads" - # CLEANTEST: this one is in a number of debian-based LTS (test a sane CPAN.pm) - - perl: 5.14.2_thr_mb + # CLEANTEST: this one is in a number of debian-based LTS (test a sane CPAN.pm, single thread) + - perl: "5.14.2_thr_mb" + sudo: required + dist: precise env: + - VCPU_USE=1 - CLEANTEST=true - BREWVER=5.14.2 - BREWOPTS="-Duseithreads -Dusemorebits" @@ -141,7 +164,9 @@ matrix: ### # some permutations of tracing and envvar poisoning - - perl: 5.12.3_thr + - perl: "5.12.3_thr" + sudo: false + dist: precise env: - CLEANTEST=true - POISON_ENV=true @@ -152,7 +177,9 @@ matrix: - BREWVER=5.12.3 - BREWOPTS="-Duseithreads" - - perl: 5.16.3_thr_mb + - perl: "5.16.3_thr_mb" + sudo: required + dist: precise env: - CLEANTEST=false - POISON_ENV=true @@ -160,7 +187,10 @@ matrix: - BREWVER=5.16.3 - BREWOPTS="-Duseithreads -Dusemorebits" - - perl: 5.18-extras + - perl: "5.18-extras" + sudo: required + # explicit new infra spec preparing for a future forced upgrade + dist: trusty env: - CLEANTEST=false - POISON_ENV=true @@ -173,7 +203,9 @@ matrix: # Start of the allow_failures block # threaded oldest possible with blead CPAN - - perl: devcpan_5.8.1_thr_mb + - perl: "devcpan_5.8.1_thr_mb" + sudo: false + dist: precise env: - CLEANTEST=true - DEVREL_DEPS=true @@ -181,7 +213,9 @@ matrix: - BREWOPTS="-Duseithreads -Dusemorebits" # oldest possible with blead CPAN with poisoning and plain trace - - perl: devcpan_5.8.1 + - perl: "devcpan_5.8.1" + sudo: false + dist: precise env: - CLEANTEST=true - DEVREL_DEPS=true @@ -191,7 +225,10 @@ matrix: - BREWVER=5.8.1 # 5.8.3 with blead CPAN - - perl: devcpan_5.8.3_mb + - perl: "devcpan_5.8.3_mb" + sudo: required + # explicit new infra spec preparing for a future forced upgrade + dist: trusty env: - CLEANTEST=false - DEVREL_DEPS=true @@ -199,7 +236,9 @@ matrix: - BREWOPTS="-Dusemorebits" # 5.8.7 threaded with blead CPAN with non-tracing poisoning - - perl: devcpan_5.8.7_thr + - perl: "devcpan_5.8.7_thr" + sudo: false + dist: precise env: - CLEANTEST=true - DEVREL_DEPS=true @@ -208,7 +247,9 @@ matrix: - BREWOPTS="-Duseithreads" # 5.8.8 threaded MB (exercises P5#72210) - - perl: devcpan_5.8.8_thr_mb + - perl: "devcpan_5.8.8_thr_mb" + sudo: false + dist: precise env: - CLEANTEST=true - DBICTEST_VERSION_WARNS_INDISCRIMINATELY=1 @@ -217,7 +258,9 @@ matrix: - BREWOPTS="-Duseithreads -Dusemorebits" # 5.10.0 threaded with blead CPAN - - perl: devcpan_5.10.0_thr_mb + - perl: "devcpan_5.10.0_thr_mb" + sudo: false + dist: precise env: - CLEANTEST=true - DEVREL_DEPS=true @@ -225,22 +268,29 @@ matrix: - BREWOPTS="-Duseithreads -Dusemorebits" # 5.12.1 with blead CPAN - - perl: devcpan_5.12.1_thr + - perl: "devcpan_5.12.1_thr" + sudo: false + dist: precise env: - CLEANTEST=true - DEVREL_DEPS=true - BREWVER=5.12.1 - BREWOPTS="-Duseithreads" - # bleadperl with stock CPAN, full depchain test with non-tracing poisoning - - perl: bleadperl + # bleadperl with stock CPAN, full depchain test with non-tracing poisoning, single thread + - perl: "bleadperl" + sudo: required + dist: precise env: + - VCPU_USE=1 - CLEANTEST=true - POISON_ENV=true - BREWVER=blead # bleadperl with blead CPAN - - perl: devcpan_bleadperl_thr_mb + - perl: "devcpan_bleadperl_thr_mb" + sudo: required + # explicitly do not specify dist - see what the default does env: - CLEANTEST=false - DEVREL_DEPS=true @@ -248,7 +298,9 @@ matrix: - BREWOPTS="-Duseithreads -Dusemorebits" # CLEANTEST of http://schplog.schmorp.de/2015-06-06-a-stable-perl.html with non-tracing poisoning - - perl: schmorp_stableperl_thr_mb + - perl: "schmorp_stableperl_thr_mb" + sudo: false + dist: precise env: - CLEANTEST=true - POISON_ENV=true diff --git a/maint/travis-ci_scripts/10_before_install.bash b/maint/travis-ci_scripts/10_before_install.bash index 774ac41..9c54ce3 100755 --- a/maint/travis-ci_scripts/10_before_install.bash +++ b/maint/travis-ci_scripts/10_before_install.bash @@ -2,17 +2,23 @@ export SHORT_CIRCUIT_SMOKE -# Stop pre-started RDBMS, move their data back to disk (save RAM) -# sync for some settle time -run_or_err "Stopping MySQL" "sudo /etc/init.d/mysql stop" -run_or_err "Stopping PostgreSQL" "sudo /etc/init.d/postgresql stop || /bin/true" -/bin/sync - -for d in mysql postgresql ; do - sudo rm -rf /var/lib/$d - sudo mv /var/ramfs/$d /var/lib/ - sudo ln -s /var/lib/$d /var/ramfs/$d -done +if have_sudo ; then + + # Stop pre-started RDBMS, move their data back to disk (save RAM) + # sync for some settle time (not available on all platforms) + for d in mysql postgresql ; do + # maybe not even running + run_or_err "Stopping $d" "sudo /etc/init.d/$d stop || /bin/true" + + # no longer available on newer build systems + if [[ -d /var/ramfs/$d ]] ; then + sudo rm -rf /var/lib/$d + sudo mv /var/ramfs/$d /var/lib/ + sudo ln -s /var/lib/$d /var/ramfs/$d + fi + done + /bin/sync +fi # Sanity check VM before continuing echo " @@ -49,33 +55,23 @@ fi if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi -# Different boxes we run on may have different amount of hw threads -# Hence why we need to query -# Originally we used to read /sys/devices/system/cpu/online -# but it is not available these days (odd). Thus we fall to -# the alwas-present /proc/cpuinfo -# The oneliner is a tad convoluted - basicaly what we do is -# slurp the entire file and get the index off the last -# `processor : XX` line -# -# We also divide the result by a factor, otherwise the travis VM gets -# overloaded (the amount of available swap is just TOOOO damn small) -export VCPU_AVAILABLE="$(( ( $(perl -0777 -n -e 'print (/ (?: .+ ^ processor \s+ : \s+ (\d+) ) (?! ^ processor ) /smx)' < /proc/cpuinfo) + 1 ) / 3 ))" +# Previously we were going off the OpenVZ vcpu count and dividing by 3 +# With the new infrastructure, somply go with "something high" +export VCPU_AVAILABLE=10 if [[ -z "$VCPU_USE" ]] ; then export VCPU_USE="$VCPU_AVAILABLE" fi -export CACHE_DIR="/tmp/poormanscache" -# these will be installed no matter what, also some extras unless CLEANTEST -common_packages="libapp-nopaste-perl" +if [[ "$CLEANTEST" != "true" ]]; then -if [[ "$CLEANTEST" = "true" ]]; then - - apt_install $common_packages + if [[ -z "$(tail -n +2 /proc/swaps)" ]] ; then + run_or_err "Configuring swap (for Oracle)" \ + "sudo bash -c 'dd if=/dev/zero of=/swap.img bs=256M count=5 && chmod 600 /swap.img && mkswap /swap.img && swapon /swap.img'" + fi -else + export CACHE_DIR="/tmp/poormanscache" # # FIXME these debconf lines should automate the firebird config but do not :((( @@ -85,11 +81,26 @@ else # these APT sources do not mean anything to us anyway sudo rm -rf /etc/apt/sources.list.d/* + # never installed, this looks like trusty + if [[ ! -d /var/lib/mysql ]] ; then + sudo dpkg --add-architecture i386 + extra_debs="postgresql mysql-server" + fi + run_or_err "Updating APT sources" "sudo apt-get update" - apt_install $common_packages libmysqlclient-dev memcached firebird2.5-super firebird2.5-dev unixodbc-dev expect - run_or_err "Cloning poor man's cache from github" "git clone --depth=1 --single-branch --branch=oracle/10.2.0 https://github.com/poortravis/poormanscache.git $CACHE_DIR && $CACHE_DIR/reassemble" - run_or_err "Installing OracleXE manually from deb" "sudo dpkg -i $CACHE_DIR/apt_cache/oracle-xe_10.2.0.1-1.1_i386.deb || sudo bash -c 'source maint/travis-ci_scripts/common.bash && apt_install -f'" + apt_install $extra_debs libmysqlclient-dev memcached firebird2.5-super firebird2.5-dev unixodbc-dev expect + + # need to stop them again + if [[ -n "$extra_debs" ]] ; then + for d in mysql postgresql ; do + sudo /etc/init.d/$d stop || /bin/true + done + fi + + run_or_err "Cloning poor man's cache from github" "git clone --depth=1 --single-branch --branch=oracle/10.2.0 https://github.com/poormanscache/poormanscache.git $CACHE_DIR && $CACHE_DIR/reassemble" + run_or_err "Installing OracleXE manually from deb" \ + "sudo dpkg -i $CACHE_DIR/apt_cache/bc-multiarch-travis_1.0_all.deb $CACHE_DIR/apt_cache/oracle-xe_10.2.0.1-1.1_i386.deb || sudo bash -c 'source maint/travis-ci_scripts/common.bash && apt_install -f'" ### config memcached run_or_err "Starting memcached" "sudo /etc/init.d/memcached start" @@ -103,7 +114,7 @@ else " run_or_err "Starting MySQL" "sudo /etc/init.d/mysql start" - run_or_err "Creating MySQL TestDB" "mysql -e 'create database dbic_test;'" + run_or_err "Creating MySQL TestDB" "mysql -u root -e 'create database dbic_test;'" export DBICTEST_MYSQL_DSN='dbi:mysql:database=dbic_test;host=127.0.0.1' export DBICTEST_MYSQL_USER=root @@ -246,10 +257,3 @@ FileUsage = 1 export ORACLE_HOME="$CACHE_DIR/ora_instaclient/x86-64/oracle_instaclient_10.2.0.5.0" fi - -# The debian package is oddly broken - uses a /bin/env based shebang -# so nothing works under a brew, fixed in libapp-nopaste-perl 0.92-3 -# http://changelogs.ubuntu.com/changelogs/pool/universe/liba/libapp-nopaste-perl/libapp-nopaste-perl_0.96-1/changelog -# -# Since the vm runs an old version of umbongo fix things ourselves -sudo /usr/bin/perl -p -i -e 's|#!/usr/bin/env perl|#!/usr/bin/perl|' $(which nopaste) diff --git a/maint/travis-ci_scripts/40_script.bash b/maint/travis-ci_scripts/40_script.bash index 3b8b110..5f4d57c 100755 --- a/maint/travis-ci_scripts/40_script.bash +++ b/maint/travis-ci_scripts/40_script.bash @@ -7,11 +7,14 @@ if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi run_harness_tests() { local -x HARNESS_OPTIONS=c:j$VCPU_USE - if [[ "$VCPU_USE" == 1 ]]; then + # if we run under docker (! have_sudo) the logic below won't work + # it seems as if ulimit acts globally, across the entire OS + # and is thus not served properly by a localised `ps xH` + if [[ "$VCPU_USE" == 1 ]] && have_sudo ; then ulim=$(( ( $(ps xH | wc -l) - 3 ) + 4 )) # (real count excluding header + ps + wc) + space for ( make + tee + harness + ) echo_err "$(tstamp) Setting process/thread limit to $ulim" ulimit -u $ulim - sleep 10 # needed to settle things down a bit + sleep 5 # needed to settle things down a bit fi make test 2> >(tee "$TEST_STDERR_LOG") } @@ -63,6 +66,6 @@ echo "${POSTMORTEM:- \o/ No notable smoke run issues \o/ }" echo echo "$(tstamp) Testing took a total of $(( $TEST_T1 - $TEST_T0 ))s" if [[ -n "$INSTALLDEPS_OUT" ]] ; then - echo "$(tstamp) Full dep install log at $(/usr/bin/nopaste -q -s Shadowcat -d DepInstall <<< "$INSTALLDEPS_OUT")" + echo "$(tstamp) Full dep install log at $(/usr/bin/perl /usr/bin/nopaste -q -s Shadowcat -d DepInstall <<< "$INSTALLDEPS_OUT")" fi echo diff --git a/maint/travis-ci_scripts/50_after_failure.bash b/maint/travis-ci_scripts/50_after_failure.bash index f087d6f..b155fab 100755 --- a/maint/travis-ci_scripts/50_after_failure.bash +++ b/maint/travis-ci_scripts/50_after_failure.bash @@ -8,5 +8,4 @@ if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then exit 0 ; fi echo_err " $(ci_vm_state_text) -=== dmesg ringbuffer -$(sudo dmesg)" +$( [[ "$(dmesg)" =~ $( echo "\\bOOM\\b" ) ]] && echo "=== dmesg ringbuffer" && dmesg )" diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index a630a86..689e5af 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -26,7 +26,7 @@ $(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo) $(free -m -t) = Diskinfo -$(sudo df -h) +$(df -h) $(mount | grep '^/') @@ -37,10 +37,10 @@ $(uname -a) $(ip addr) = Network Sockets Status -$(sudo netstat -an46p | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s') +$( (sudo netstat -an46p || netstat -an46p) | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s') = Processlist -$(sudo ps fuxa) +$(ps fuxa) = Environment $(env | grep -P 'TEST|HARNESS|MAKE|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v) @@ -171,7 +171,7 @@ installdeps() { 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")" + local errlog="failed after ${DELTA_TIME}s Exit:$LASTEXIT Log:$(/usr/bin/perl /usr/bin/nopaste -q -s Shadowcat -d "Parallel testfail" <<< "$LASTOUT")" echo "$errlog" POSTMORTEM="$POSTMORTEM$( @@ -320,3 +320,5 @@ purge_sitelib() { CPAN_is_sane() { perl -MCPAN\ 1.94_56 -e 1 &>/dev/null ; } CPAN_supports_BUILDPL() { perl -MCPAN\ 1.9205 -e1 &>/dev/null; } + +have_sudo() { sudo /bin/true &>/dev/null ; }