From: Dagfinn Ilmari Mannsåker Date: Tue, 20 Jan 2015 13:46:48 +0000 (+0000) Subject: Nick Travis script improvements from DBIC X-Git-Tag: 0.07043~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a61771df2487b674cc036f4647ebe532e6f1f471;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Nick Travis script improvements from DBIC --- diff --git a/.travis.yml b/.travis.yml index c83f52a..52f1eaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -235,42 +235,57 @@ matrix: # console output before_install: + # common functions for all run phases below + # + # this is an exporter - sourcing it is crucial + # among other things it also sets -e + # + - source maint/travis-ci_scripts/common.bash + # Sets global envvars, downloads/configures debs based on CLEANTEST # Sets extra DBICTEST_* envvars # + # this is an exporter - sourcing it is crucial + # - source maint/travis-ci_scripts/10_before_install.bash install: # Build and switch to a custom perl if requested # Configure the perl env, preinstall some generic toolchain parts # + # this is an exporter - sourcing it is crucial + # - source maint/travis-ci_scripts/20_install.bash +### +### From this point on -e is *unset*, rely on travis' error handling +### + - set +e + before_script: # Preinstall/install deps based on envvars/CLEANTEST # - - source maint/travis-ci_scripts/30_before_script.bash + # need to invoke the after_failure script manually + # because 'after_failure' runs only after 'script' fails + # + - maint/getstatus maint/travis-ci_scripts/30_before_script.bash || ( maint/travis-ci_scripts/50_after_failure.bash && /bin/false ) script: # Run actual tests # - - source maint/travis-ci_scripts/40_script.bash + - maint/getstatus maint/travis-ci_scripts/40_script.bash after_success: - # Check if we can assemble a dist properly if not in CLEANTEST - # skipped for now - # - source maint/travis-ci_scripts/50_after_success.bash + # No tasks yet + # + # - maint/getstatus maint/travis-ci_scripts/50_after_success.bash after_failure: - # No tasks yet + # Final sysinfo printout on fail # - #- source maint/travis-ci_scripts/50_after_failure.bash + - maint/getstatus maint/travis-ci_scripts/50_after_failure.bash after_script: # No tasks yet # - #- source maint/travis-ci_scripts/60_after_script.bash - - # if we do not unset this before we terminate the travis teardown will - # mark the entire job as failed - - set +e + #- maint/getstatus maint/travis-ci_scripts/60_after_script.bash diff --git a/maint/getstatus b/maint/getstatus new file mode 100755 index 0000000..f49c410 --- /dev/null +++ b/maint/getstatus @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Config; +use Term::ANSIColor ':constants'; +my $CRST = RESET; +my $CCODE = BOLD; +my $CSTAT = BOLD . GREEN; +my $CCORE = BOLD . CYAN; +my $CSIG = CYAN; + +if (@ARGV) { + my $code = system (@ARGV); + + if ($code < 0) { + exit 127; + } + elsif ($code > 0) { + + my $status = $code >> 8; + my $signum = $code & 127; + my $core = $code & 128; + + my %sig_idx; + @sig_idx{split /\s+/, $Config{sig_num}} = split /\s/, $Config{sig_name}; + + printf STDERR ( +<req_list_for("dist_dir")}') - run_or_err "Attempt to build a dist with all prereqs present" "make dist" - echo "Contents of the resulting dist tarball:" - echo "===========================================" - tar -vzxf DBIx-Class-*.tar.gz - echo "===========================================" - run_or_err 'Attempt to configure from re-extracted distdir' \ - 'bash -c "cd \$(find DBIx-Class-* -maxdepth 0 -type d | head -n 1) && perl Makefile.PL"' -fi +echo_err "Nothing to do" + +return 0 diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index da6ce33..2588621 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -14,6 +14,41 @@ fi tstamp() { echo -n "[$(date '+%H:%M:%S')]" ; } +ci_vm_state_text() { + echo " +========================== CI System information ============================ + += CPUinfo +$(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo) + += Meminfo +$(free -m -t) + += Diskinfo +$(sudo df -h) + +$(mount | grep '^/') + += Kernel info +$(uname -a) + += Network Configuration +$(ip addr) + += Network Sockets Status +$(sudo netstat -an46p | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s') + += Processlist +$(sudo ps fuxa) + += Environment +$(env | grep -P 'TEST|HARNESS|MAKE|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v) + += Perl in use +$(perl -V) +=============================================================================" +} + run_or_err() { echo_err -n "$(tstamp) $1 ... " @@ -51,9 +86,6 @@ apt_install() { # flatten pkgs="$@" - # Need to do this at every step, the sources list may very well have changed - run_or_err "Updating APT available package list" "sudo apt-get update" - run_or_err "Installing Debian APT packages: $pkgs" "sudo apt-get install --allow-unauthenticated --no-install-recommends -y $pkgs" } diff --git a/maint/travis-ci_scripts/configs/minimal_mysql_travis.cnf b/maint/travis-ci_scripts/configs/minimal_mysql_travis.cnf new file mode 100644 index 0000000..770effa --- /dev/null +++ b/maint/travis-ci_scripts/configs/minimal_mysql_travis.cnf @@ -0,0 +1,23 @@ +[mysqld] + +thread_cache_size = 0 + +# mysql >= 5.5.16 +#thread_pool_size = 1 + +bulk_insert_buffer_size = 0 +read_buffer_size = 32K +join_buffer_size = 128K +sort_buffer_size = 128K +table_definition_cache = 400 + +performance_schema = 0 + +query_cache_type = 0 +query_cache_size = 0 + +innodb_use_sys_malloc = 1 +innodb_buffer_pool_size = 1M + +key_buffer_size = 64K +myisam_sort_buffer_size = 128K