From 08264571869e92cb7e6dcee5facfedbf0bedce68 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Sun, 26 Feb 2017 22:59:38 +0100 Subject: Use single VM in .travis.yml to speed-up launching builds. Container are launched in parallel threads. The output of each thread is saved to a log. All of them are printed in order, after all the threads have finished. Shared ANSI color codes between libraries/vendors and dist/linux. The common file to be sourced is dist/ansi_color.sh --- testsuite/gna/testsuite.sh | 24 ++++----- testsuite/testenv.sh | 10 +++- testsuite/testsuite.sh | 60 +++++++-------------- testsuite/vests/testsuite.sh | 125 ++++++++++++++++--------------------------- 4 files changed, 88 insertions(+), 131 deletions(-) (limited to 'testsuite') diff --git a/testsuite/gna/testsuite.sh b/testsuite/gna/testsuite.sh index 8fcd7059d..7e39e8f04 100755 --- a/testsuite/gna/testsuite.sh +++ b/testsuite/gna/testsuite.sh @@ -32,27 +32,27 @@ for opt; do esac done -for i in $dirs; do - echo "GNA dir $i:" - cd $i +singlerun() { + echo "" + echo "GNA dir $1:" + cd $1 if ! ./testsuite.sh; then echo "#################################################################" - echo "######### FAILURE: $i" + echo "######### FAILURE: $1" echo "#################################################################" - if [ $full = "y" ]; then - failures="$failures $i" + if [ $2 = "y" ]; then + failures="$failures $1" else exit 1; fi fi cd .. -done +} + +for i in $dirs; do singlerun $i $full; done if [ x"$failures" = x"" ]; then - echo "GNA tests are successful" - exit 0 + echo "GNA tests are successful" && exit 0 else - echo "GNA test failed ($failures)" - exit 1 + echo "GNA test failed ($failures)" && exit 1 fi - diff --git a/testsuite/testenv.sh b/testsuite/testenv.sh index 9af5f115d..e77fbc4bd 100644 --- a/testsuite/testenv.sh +++ b/testsuite/testenv.sh @@ -1,6 +1,6 @@ # Testsuite environment # -# This file defines the shell functions to analyse a file, elaborat or run +# This file defines the shell functions to analyse a file, elaborate or run # a design. There are version for expected success and expected failure. # # Every test should source and use this file. @@ -22,6 +22,14 @@ GET_ENTITIES=../get_entities # Exit in case of failure in shell scripts. set -e +# Define colors +ANSI_NOCOLOR="\033[0m" +ANSI_RED="\033[31m" +ANSI_BLUE="\033[34m" +ANSI_GREEN="\033[32m" +# Optionally disable colors +if [ -z "$ENABLECOLOR" ]; then unset ANSI_NOCOLOR ANSI_RED ANSI_BLUE ANSI_GREEN; fi + if [ x"$GHDL" = x ]; then echo "error: GHDL environment variable is not defined" exit 4 diff --git a/testsuite/testsuite.sh b/testsuite/testsuite.sh index 48e99ed5d..bb4d6e81e 100755 --- a/testsuite/testsuite.sh +++ b/testsuite/testsuite.sh @@ -1,63 +1,43 @@ #! /bin/sh -# Stop in case of error. +# Stop in case of error set -e -# Source the testsuite environment . ./testenv.sh +printf "$ANSI_BLUE[$TASK| GHDL - test] Sourced the testsuite environment $ANSI_NOCOLOR\n" -# The GNA testsuite: -# regression testsuite using reports/issues from gna.org -do_gna () -{ - echo "**** GNA ****" - echo "*************" - cd gna - ./testsuite.sh +# The GNA testsuite: regression testsuite using reports/issues from gna.org +do_gna() { + cd gna && ./testsuite.sh 1>> ../../log.log 2>&1 cd .. } -# The VESTS testsuite: -# compliance testsuite, from: https://github.com/nickg/vests.git 388250486a -do_vests () -{ - echo "**** VESTS ****" - echo "***************" - gnatmake get_entities - cd vests - ./testsuite.sh +# The VESTS testsuite: compliance testsuite, from: https://github.com/nickg/vests.git 388250486a +do_vests() { + gnatmake get_entities 1>> ../log.log 2>&1 + cd vests && ./testsuite.sh cd .. } # Run a testsuite -do_test () -{ +do_test() { + printf "$ANSI_BLUE[$TASK| GHDL - test] $1 $ANSI_NOCOLOR\n" case $1 in - gna) - do_gna;; - vests) - do_vests;; + gna) do_gna;; + vests) do_vests;; *) - echo "$0: test name '$1' is unknown" + printf *e "$ANSI_RED$0: test name '$1' is unknown $ANSI_NOCOLOR" exit 1;; esac } -all_list="gna vests" +printf "$ANSI_BLUE[$TASK| GHDL - test] GHDL is: $GHDL $ANSI_NOCOLOR\n" -echo "GHDL is: $GHDL" +if [ $# -eq 0 ]; then tests="gna vests"; +else tests=$("$@"); fi -if [ $# -eq 0 ]; then - for t in $all_list; do - do_test $t - done -else - for t; do - do_test $t - done -fi +for t in $tests; do do_test $t; done -echo -echo "$0: Success ($GHDL)" -$GHDL --version +printf "$ANSI_BLUE[$TASK| GHDL - test] $0: $cGREENSuccess$ANSI_BLUE [$GHDL] $ANSI_NOCOLOR\n" +$GHDL --version 1>> ../log.log 2>&1 exit 0 diff --git a/testsuite/vests/testsuite.sh b/testsuite/vests/testsuite.sh index a897c3a77..cb432d093 100755 --- a/testsuite/vests/testsuite.sh +++ b/testsuite/vests/testsuite.sh @@ -3,40 +3,18 @@ . ../testenv.sh common_args="--std=93c $GHDL_FLAGS" - # Test number. test_num="1" - do_inter_clean="no" # Functions used by tests. -setup_test_group () -{ - echo "Test: $1 $2" -} - -end_test_group () -{ - delete_lib work - echo "*** End of tests" -} - -create_lib () -{ - echo "create library: $1" -} - -delete_lib () -{ - echo "delete library: $1" - cmd="$GHDL --remove $common_args --work=$1" - echo $cmd - eval $cmd -} +setup_test_group() { echo "Test: $1 $2"; } +end_test_group() { delete_lib work; echo "*** End of tests"; } +create_lib() { echo "create library: $1"; } +delete_lib() { echo "delete library: $1" && cmd="$GHDL --remove $common_args --work=$1" && echo $cmd && eval $cmd; } # Usage: handle_test MODE FILE options... -handle_test () -{ +handle_test() { mode=$1 shift file=$1 @@ -135,26 +113,10 @@ handle_test () test_num=`expr $test_num + 1` } -build_compliant_test () -{ - handle_test compile $@ -} - -run_non_compliant_test () -{ - handle_test ana_err $@ -} - -run_compliant_test () -{ - handle_test run $@ -} - -run_err_non_compliant_test () -{ - handle_test run_err $@ -} - +build_compliant_test () { handle_test compile $@; } +run_non_compliant_test () { handle_test ana_err $@; } +run_compliant_test () { handle_test run $@; } +run_err_non_compliant_test () { handle_test run_err $@; } # Decode options. skip=0 @@ -172,48 +134,55 @@ do shift; done -# Test group +# Test groups -delete_lib work - -dir=vhdl-93/clifton-labs/compliant -. $dir/compliant1.exp - -# ashenden compliant -# OK -dir=vhdl-93/ashenden/compliant -. $dir/compliant.exp +test_ashenden() { + delete_lib work -# OK -dir=vhdl-93/ashenden/non_compliant -. $dir/non_compliant.exp + dir=vhdl-93/clifton-labs/compliant + . $dir/compliant1.exp + # ashenden compliant + # OK + dir=vhdl-93/ashenden/compliant + . $dir/compliant.exp -# Clean frequently the work library. -do_inter_clean="yes" - -# OK. -dir=vhdl-93/billowitch/compliant -. $dir/compliant.exp + # OK + dir=vhdl-93/ashenden/non_compliant + . $dir/non_compliant.exp +} +test_billowitch() { + # OK. + dir=vhdl-93/billowitch/compliant + . $dir/compliant.exp -# OK but FIXMEs -dir=vhdl-93/billowitch/non_compliant/analyzer_failure -. $dir/non_compliant.exp + # OK but FIXMEs + dir=vhdl-93/billowitch/non_compliant/analyzer_failure + . $dir/non_compliant.exp -run_non_compliant_test () -{ - handle_test run_err $@ + run_non_compliant_test() { handle_test run_err $@; } + + dir=vhdl-93/billowitch/non_compliant/simulator_failure + . $dir/non_compliant.exp } -dir=vhdl-93/billowitch/non_compliant/simulator_failure -. $dir/non_compliant.exp +deletelibs() { + delete_lib project + delete_lib random + delete_lib utilities +} -delete_lib project -delete_lib random -delete_lib utilities +printf "$ANSI_BLUE[$TASK| GHDL - test] vests: ashenden $ANSI_NOCOLOR\n" +test_ashenden 1>> ../../log.log 2>&1 +# Clean frequently the work library. +do_inter_clean="yes" +printf "$ANSI_BLUE[$TASK| GHDL - test] vests: billowitch $ANSI_NOCOLOR\n" +test_billowitch 1>> ../../log.log 2>&1 +printf "$ANSI_BLUE[$TASK| GHDL - test] vests: delete libs $ANSI_NOCOLOR\n" +deletelibs 1>> ../../log.log 2>&1 # Remove io files created by tests rm -f iofile.* *.file fopen*.out -echo "Vests tests successful" +echo "Vests tests successful" 1>> ../../log.log 2>&1 -- cgit v1.2.3