aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml16
-rw-r--r--Makefile.in3
-rw-r--r--dist/ansi_color.sh17
-rwxr-xr-x[-rw-r--r--]dist/linux/buildtest.sh106
-rwxr-xr-x[-rw-r--r--]dist/linux/docker-buildtest.sh64
-rw-r--r--dist/linux/envs/fedora_llvm.sh2
-rw-r--r--dist/linux/envs/fedora_mcode.sh2
-rw-r--r--dist/linux/envs/ubuntu1204_llvm38.sh2
-rw-r--r--dist/linux/envs/ubuntu1404_llvm35.sh2
-rw-r--r--dist/linux/envs/ubuntu_mcode.sh2
-rwxr-xr-xdist/linux/travis-ci.sh71
-rwxr-xr-xlibraries/vendors/compile-altera.sh5
-rwxr-xr-xlibraries/vendors/compile-lattice.sh5
-rwxr-xr-xlibraries/vendors/compile-osvvm.sh5
-rw-r--r--libraries/vendors/compile-uvvm.sh5
-rwxr-xr-xlibraries/vendors/compile-vunit.sh5
-rwxr-xr-xlibraries/vendors/compile-xilinx-ise.sh5
-rwxr-xr-xlibraries/vendors/compile-xilinx-vivado.sh5
-rw-r--r--libraries/vendors/shared.sh9
-rwxr-xr-xtestsuite/gna/testsuite.sh24
-rw-r--r--testsuite/testenv.sh10
-rwxr-xr-xtestsuite/testsuite.sh60
-rwxr-xr-xtestsuite/vests/testsuite.sh125
23 files changed, 315 insertions, 235 deletions
diff --git a/.travis.yml b/.travis.yml
index 68646c20e..6c8888814 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,20 +8,8 @@ sudo: required
install: true
services: docker
-env:
- - THISENV="ubuntu1404_llvm35" && BUILDTHIS=
- - THISENV="ubuntu1204_llvm38" && BUILDTHIS=
- - THISENV="fedora_mcode" && BUILDTHIS=
- - THISENV="ubuntu_mcode" && BUILDTHIS=1
- - THISENV="fedora_llvm" && BUILDTHIS=1
-
-before_script:
- - DONTGRAB_SRCS=$CI
- - eval ". ./dist/linux/envs/$THISENV.sh"
- - . ./dist/linux/travis-ci.sh
-
script:
- - if [ -n "$BUILDTHIS" ]; then . ./dist/linux/docker-buildtest.sh; fi
+ - . ./dist/linux/travis-ci.sh
git:
depth: 10
@@ -34,7 +22,7 @@ deploy:
api_key:
secure: k1Idw3l/35mms1mESpO+5TmA2Kmf0UlMsxjgQiWikYu6va6icJjTzCHv6d3YjF6tzkouZZa74Gep22gg46uDWU6wtcBYq5X2IxEX1U3iRxi5CNXL77ZaYdj9Nn69cNImjGPqigJMJLOuIPi31ENlxgO83U07VYE1cV603+spvxw3a1TynrBIjdugiVMIFctrmt/zTIt/jBG1oQNLPdVTRFavnjpsFlnIcO5DvHvKxoDEpF3WwPcDr6h/bmnFZSfr8Sr2pptQU1S6qtHaLJPwg8w1f93nxr1LEK2MR8eVfS5XSEVC8nBZJHksdlwx/iiGyWEqEeXLXpoaHAO3aqkhjsMA1+mKbwtHjT7WBNWorKfmQP3ZTShhksPa+oBFitC33gXGCNCFMWSVdXrTIKIN8m//KSc3VTbxHL10afO9lCD955bZi1cpFZiE471BBXDxpN9Nv+1tV7RO7e6gm+94n9CYYkdCHcFK4hj0gGXDOQlUEEmZj4vAiwaDWfByfHxDNClT3rJ8tAm9BFjdDOI54NlA15/nyx+00Kw0FEZqvIemeMsCpz4Ril2bL8BZtwYm8e5sygqgdGODtRT5Q0hbHO2fuMpth4gvGGHraGlmH1Rez5BSnUsWVSQxV4Z+9/VZtQOK6HdfbbB8dd9SlOuEN1M9EqqEHBxdvHBkoMZy1uk=
file_glob: true
- file: "$PKG_FILE"
+ file: "ghdl-*.tgz"
on:
tags: true
all_branches: true
diff --git a/Makefile.in b/Makefile.in
index cb05b0269..3c25d7c08 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -424,6 +424,9 @@ install.vhdllib: install.dirs
$(INSTALL_DATA) -p \
$(LIBDST_DIR)/$$d/* $(DESTDIR)$(VHDL_LIB_DIR)/$$d; \
done
+ # ANSI color
+ $(INSTALL_DATA) -p \
+ $(srcdir)/dist/ansi_color.sh $(DESTDIR)$(VHDL_LIB_DIR)/;
# Vendors scripts
$(MKDIR) -p $(DESTDIR)$(VHDL_LIB_DIR)/vendors
$(INSTALL_DATA) -p \
diff --git a/dist/ansi_color.sh b/dist/ansi_color.sh
new file mode 100644
index 000000000..533e0e14b
--- /dev/null
+++ b/dist/ansi_color.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+enable_color() {
+ ENABLECOLOR='-c '
+ ANSI_RED="\033[31m"
+ ANSI_GREEN="\033[32m"
+ ANSI_YELLOW="\033[33m"
+ ANSI_BLUE="\033[34m"
+ ANSI_MAGENTA="\033[35m"
+ ANSI_CYAN="\033[36;1m"
+ ANSI_DARKCYAN="\033[36m"
+ ANSI_NOCOLOR="\033[0m"
+}
+
+disable_color() { unset ENABLECOLOR ANSI_RED ANSI_GREEN ANSI_YELLOW ANSI_BLUE ANSI_MAGENTA ANSI_CYAN ANSI_DARKCYAN ANSI_NOCOLOR; }
+
+enable_color \ No newline at end of file
diff --git a/dist/linux/buildtest.sh b/dist/linux/buildtest.sh
index 884a30cb8..f8347070d 100644..100755
--- a/dist/linux/buildtest.sh
+++ b/dist/linux/buildtest.sh
@@ -1,71 +1,99 @@
#! /bin/sh
-# This script is executed in the travis-ci environment.
+
+. dist/ansi_color.sh
+disable_color
# Stop in case of error
set -e
-while getopts ":b:f:" opt; do
+# Transform long options to short ones
+for arg in "$@"; do
+ shift
+ case "$arg" in
+ "--color"|"-color") set -- "$@" "-c";;
+ "--build"|"-build") set -- "$@" "-b";;
+ "--file"|"-file") set -- "$@" "-f";;
+ "--taskid"|"-taskid") set -- "$@" "-t";;
+ *) set -- "$@" "$arg"
+ esac
+done
+# Parse args
+while getopts ":b:f:t:c" opt; do
case $opt in
+ c) enable_color;;
b) BLD=$OPTARG ;;
f) PKG_FILE=$OPTARG;;
- \?) echo "Invalid option: -$OPTARG" >&2; exit 1 ;;
- :) echo "Option -$OPTARG requires an argument." >&2; exit 1 ;;
+ t) TASK=$OPTARG;;
+ \?) printf "$ANSI_RED[GHDL] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2; exit 1 ;;
+ :) printf "$ANSI_RED[GHDL] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2; exit 1 ;;
esac
done
-CDIR=$(pwd)
-
-# Display environment
-echo "Environment:"
-env
+#---
-# Prepare
+printf "$ANSI_BLUE[$TASK| GHDL] Prepare $(pwd) $ANSI_NOCOLOR\n"
+CDIR=$(pwd)
+mkdir logs
prefix="$CDIR/install-$BLD"
mkdir "$prefix"
mkdir "build-$BLD"
cd "build-$BLD"
-# Configure
+#---
+
+printf "$ANSI_BLUE[$TASK| GHDL] Environment $ANSI_NOCOLOR\n"
+env 1>> ../log.log 2>&1
+
+#---
+
+printf "$ANSI_BLUE[$TASK| GHDL - build] Configure $ANSI_NOCOLOR\n"
case "$BLD" in
mcode)
- ../configure --prefix="$prefix"
- MAKEOPTS=""
- ;;
+ ../configure "--prefix=$prefix" 1>> ../log.log 2>&1
+ ;;
llvm)
- ../configure --prefix="$prefix$" --with-llvm-config
- ;;
+ ../configure "--prefix=$prefix" "--with-llvm-config" 1>> ../log.log 2>&1
+ ;;
llvm-3.5)
- ../configure --prefix="$prefix" --with-llvm-config=llvm-config-3.5
- MAKEOPTS="CXX=clang++"
- ;;
+ ../configure "--prefix=$prefix" "--with-llvm-config=llvm-config-3.5" 1>> ../log.log 2>&1
+ MAKEOPTS="CXX=clang++"
+ ;;
llvm-3.8)
- ../configure --prefix="$prefix" --with-llvm-config=llvm-config-3.8
- MAKEOPTS="CXX=clang++-3.8"
- ;;
-
- docker) echo "Check docker container!"; exit 0;;
+ ../configure "--prefix=$prefix" "--with-llvm-config=llvm-config-3.8" 1>> ../log.log 2>&1
+ MAKEOPTS="CXX=clang++-3.8"
+ ;;
+
+ docker) printf "$ANSI_MAGENTA[$TASK| GHDL - build] Check docker container! $ANSI_NOCOLOR\n"; exit 0;;
- *)
- echo "unknown build $BLD"
- exit 1
- ;;
+ *) printf "$ANSI_RED[$TASK| GHDL - build] Unknown build $BLD $ANSI_NOCOLOR\n"
+ exit 1;;
esac
-# Build
-make $MAKEOPTS
-make install
+#---
+
+printf "$ANSI_BLUE[$TASK| GHDL - build] Make $ANSI_NOCOLOR\n"
+make $MAKEOPTS 1>> ../log.log 2>&1
+printf "$ANSI_BLUE[$TASK| GHDL - build] Install $ANSI_NOCOLOR\n"
+make install 1>> ../log.log 2>&1
cd ..
-# Package
-echo "creating $PKG_FILE"
-tar -zcvf "$PKG_FILE" -C "$prefix" .
+#---
+
+printf "$ANSI_BLUE[$TASK| GHDL] Create package $ANSI_DARKCYAN$PKG_FILE $ANSI_NOCOLOR\n"
+tar -zcvf "$PKG_FILE" -C "$prefix" . 1>> log.log 2>&1
-# Test
+#---
+
+export ENABLECOLOR="$ENABLECOLOR"
+export TASK="$TASK"
export GHDL="$CDIR/install-$BLD/bin/ghdl"
-cd testsuite
-gnatmake get_entities
-./testsuite.sh
-cd .. \ No newline at end of file
+cd testsuite && ./testsuite.sh
+cd ..
+
+#---
+
+# Do not remove this line, and don't write anything below, since it is used to identify successful builds
+echo "[$TASK|SUCCESSFUL]" 1>> log.log 2>&1 \ No newline at end of file
diff --git a/dist/linux/docker-buildtest.sh b/dist/linux/docker-buildtest.sh
index 5c921b18e..919a314d6 100644..100755
--- a/dist/linux/docker-buildtest.sh
+++ b/dist/linux/docker-buildtest.sh
@@ -1,22 +1,64 @@
-set -ev
+#! /bin/sh
-docker pull "$DOCKER_IMG"
+. dist/ansi_color.sh
+disable_color
-if [ -z "$DONTGRAB_SRCS" ]; then
+# Stop in case of error
+set -e
+# Transform long options to short ones
+for arg in "$@"; do
+ shift
+ case "$arg" in
+ "--color"|"-color") set -- "$@" "-c";;
+ "--grab"|"-grab") set -- "$@" "-g";;
+ "--image"|"-image") set -- "$@" "-i";;
+ "--build"|"-build") set -- "$@" "-b";;
+ "--file"|"-file") set -- "$@" "-f";;
+ "--taskid"|"-taskid") set -- "$@" "-t";;
+ *) set -- "$@" "$arg"
+ esac
+done
+# Parse args
+while getopts ":i:b:f:t:cg" opt; do
+ case $opt in
+ c) enable_color;;
+ g) GRAB_SRCS=1;;
+ i) DOCKER_IMG=$OPTARG;;
+ b) BLD=$OPTARG ;;
+ f) PKG_FILE=$OPTARG;;
+ t) TASK=$OPTARG;;
+ \?) printf "$ANSI_RED[BUILD] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2; exit 1 ;;
+ :) printf "$ANSI_RED[BUILD] Option -$OPTARG requires an argument $ANSI_NOCOLOR\n" >&2; exit 1 ;;
+ esac
+done
+
+#---
+
+printf "$ANSI_YELLOW[$TASK| BUILD] Docker pull $DOCKER_IMG $ANSI_NOCOLOR\n"
+docker pull "$DOCKER_IMG" > /dev/null 2>&1
+
+#---
+
+printf "$ANSI_YELLOW[$TASK| BUILD] Docker run $DOCKER_IMG $BLD $PKG_FILE $ANSI_NOCOLOR\n"
+
+if [ -n "$GRAB_SRCS" ]; then
+
+ printf "$ANSI_YELLOW[$TASK| BUILD] Grab sources$ANSI_NOCOLOR\n"
+
p="mkdir /work && cd /work"
p="$p && curl -L https://github.com/tgingold/ghdl/archive/master.tar.gz | tar xz"
p="$p && mv ghdl-master/* ./ && rm -rf ghdl-master"
-
- docker run --name ghdl_cmp -it "$DOCKER_IMG" sh -c "$p && sh ./dist/linux/buildtest.sh -b $DBLD -f $PKG_FILE"
+
+ set +e
+ docker run --name ghdl_cmp -t "$DOCKER_IMG" sh -c "$p &&./dist/linux/buildtest.sh $ENABLECOLOR-t $TASK -b $BLD -f $PKG_FILE"
+ docker cp "ghdl_cmp:/work/log.log" "./log.log"
+ set -e
docker cp "ghdl_cmp:/work/$PKG_FILE" ./
+ docker rm ghdl_cmp
else
- docker run --name ghdl_cmp -itv $(pwd):/work:Z "$DOCKER_IMG" sh -c "cd /work && sh ./dist/linux/buildtest.sh -b $DBLD -f $PKG_FILE"
-
-fi
-
-docker rm ghdl_cmp
-
+ docker run --rm -tv $(pwd):/work:Z -w="/work" "$DOCKER_IMG" sh -c "./dist/linux/buildtest.sh $ENABLECOLOR-t $TASK -b $BLD -f $PKG_FILE"
+fi \ No newline at end of file
diff --git a/dist/linux/envs/fedora_llvm.sh b/dist/linux/envs/fedora_llvm.sh
deleted file mode 100644
index c44857c51..000000000
--- a/dist/linux/envs/fedora_llvm.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-BLD=fed+llvm
-DOCKER_IMG="ghdl/ghdl-tools:fedora-llvm-mcode" \ No newline at end of file
diff --git a/dist/linux/envs/fedora_mcode.sh b/dist/linux/envs/fedora_mcode.sh
deleted file mode 100644
index 3ddb515bf..000000000
--- a/dist/linux/envs/fedora_mcode.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-BLD=fed+mcode
-DOCKER_IMG="ghdl/ghdl-tools:fedora-llvm-mcode" \ No newline at end of file
diff --git a/dist/linux/envs/ubuntu1204_llvm38.sh b/dist/linux/envs/ubuntu1204_llvm38.sh
deleted file mode 100644
index 5f68d2ab0..000000000
--- a/dist/linux/envs/ubuntu1204_llvm38.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-BLD=ubu1204+llvm-3.8
-DOCKER_IMG="ghdl/ghdl-tools:ubuntu1204-llvm" \ No newline at end of file
diff --git a/dist/linux/envs/ubuntu1404_llvm35.sh b/dist/linux/envs/ubuntu1404_llvm35.sh
deleted file mode 100644
index bf4baf236..000000000
--- a/dist/linux/envs/ubuntu1404_llvm35.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-BLD=ubu1404+llvm-3.5
-DOCKER_IMG="ghdl/ghdl-tools:ubuntu1404-llvm" \ No newline at end of file
diff --git a/dist/linux/envs/ubuntu_mcode.sh b/dist/linux/envs/ubuntu_mcode.sh
deleted file mode 100644
index e6f7c3232..000000000
--- a/dist/linux/envs/ubuntu_mcode.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-BLD=ubu+mcode
-DOCKER_IMG="ghdl/ghdl-tools:ubuntu-mcode" \ No newline at end of file
diff --git a/dist/linux/travis-ci.sh b/dist/linux/travis-ci.sh
index 1b683833c..e72e2540c 100755
--- a/dist/linux/travis-ci.sh
+++ b/dist/linux/travis-ci.sh
@@ -1,12 +1,69 @@
-IFS='+' read -ra REFS <<< "$BLD"
+#! /bin/sh
+# This script is executed in the travis-ci environment.
-DBLD=${REFS[1]}
-PKG_DTAG=${REFS[0]}
-PKG_SHORTCOMMIT="$(echo $TRAVIS_COMMIT | cut -c1-10)"
+images=("ghdl/ghdl-tools:ubuntu-mcode" "ghdl/ghdl-tools:ubuntu1404-llvm" "ghdl/ghdl-tools:ubuntu1204-llvm" "ghdl/ghdl-tools:fedora-llvm-mcode")
+
+#--- image + identifier + compiler
+
+regular="0+ubuntu+mcode 3+fedora+llvm"
+nightly="1+ubuntu1404+llvm-3.5 2+ubuntu1204+llvm-3.8 3+fedora+mcode"
+#release=()
+
+#---
+
+. dist/ansi_color.sh
+
+#disable_color
+
+thismatrix=regular
+
+#---
+
+task() {
+ printf "$ANSI_YELLOW[$1| BUILD] $2 $ANSI_NOCOLOR\n"
+
+ IFS='+' read -ra REFS <<< "$2"
+ DBLD=${REFS[2]}
+ thisworkdir="../wrk-$1"
+ cp -r ./ "$thisworkdir" && cd "$thisworkdir"
+ ./dist/linux/docker-buildtest.sh -i "${images[${REFS[0]}]}" $3-t "$1" -b "$DBLD" -f "ghdl-$PKG_VER-$DBLD-$PKG_TAG-${REFS[1]}-$PKG_SHORTCOMMIT.tgz"
+ cd "$cloned"
+ cp "$thisworkdir"/ghdl-*.tgz ./
+ cp "$thisworkdir"/log.log "./log_$1.log"
+}
+
+#---
+
+PKG_SHORTCOMMIT="$(printf $TRAVIS_COMMIT | cut -c1-10)"
PKG_VER=`grep Ghdl_Ver src/version.in | sed -e 's/.*"\(.*\)";/\1/'`
PKG_TAG="$TRAVIS_TAG"
-
-if [ -z "$BUILDTHIS" ]; then BUILDTHIS=$(echo "$TRAVIS_TAG"); fi
if [ -z "$TRAVIS_TAG" ]; then PKG_TAG=`date -u +%Y%m%d`; fi
-export PKG_FILE="ghdl-$PKG_VER-$DBLD-$PKG_TAG-$PKG_DTAG-$PKG_SHORTCOMMIT.tgz" \ No newline at end of file
+cloned=$(pwd)
+
+printf "$ANSI_YELLOW[TRAVIS] Running matrix $thismatrix $ANSI_NOCOLOR\n"
+eval blds='${'$thismatrix'}'
+t=0; for thisbuild in $blds; do
+ task "$t" "$thisbuild" "$ENABLECOLOR" &
+ t=$(($t+1));
+done
+
+printf "$ANSI_YELLOW[TRAVIS] Waiting... $ANSI_NOCOLOR\n"
+wait
+printf "$ANSI_YELLOW[TRAVIS] Done waiting. Show work dir content: $ANSI_NOCOLOR\n"
+ls -la
+printf "$ANSI_YELLOW[TRAVIS] Check results $ANSI_NOCOLOR\n"
+EXITCODE=0;
+t=0; for b in $blds; do
+ # Read the last line of the log
+ RESULT[$t]=$(awk '/./{line=$0} END{print line}' "log_$t.log")
+ # If it did not end with [$t|SUCCESSFUL], break the build
+ if [ "${RESULT[$t]}" != "[$t|SUCCESSFUL]" ]; then EXITCODE=$(($t+1)); fi
+ # Anyway, always print the full log
+ printf "$ANSI_YELLOW[TRAVIS] Print BUILD $t log $ANSI_NOCOLOR\n"
+ cat "log_$t.log"
+ t=$(($t+1));
+done
+
+# The exit code indicates the last broken build (1:bnum)
+exit $EXITCODE \ No newline at end of file
diff --git a/libraries/vendors/compile-altera.sh b/libraries/vendors/compile-altera.sh
index c3daf4d94..46cccfde1 100755
--- a/libraries/vendors/compile-altera.sh
+++ b/libraries/vendors/compile-altera.sh
@@ -44,8 +44,9 @@ ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/compile-lattice.sh b/libraries/vendors/compile-lattice.sh
index b32871d00..3a5478c42 100755
--- a/libraries/vendors/compile-lattice.sh
+++ b/libraries/vendors/compile-lattice.sh
@@ -48,8 +48,9 @@ ScriptDir="$($READLINK -f $ScriptDir)"
DeviceList="ec ecp ecp2 ecp3 ecp5u lptm lptm2 machxo machxo2 machxo3l sc scm xp xp2"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/compile-osvvm.sh b/libraries/vendors/compile-osvvm.sh
index 9d2070c59..1ff747804 100755
--- a/libraries/vendors/compile-osvvm.sh
+++ b/libraries/vendors/compile-osvvm.sh
@@ -43,8 +43,9 @@ ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/compile-uvvm.sh b/libraries/vendors/compile-uvvm.sh
index 94485421e..1a601df60 100644
--- a/libraries/vendors/compile-uvvm.sh
+++ b/libraries/vendors/compile-uvvm.sh
@@ -43,8 +43,9 @@ ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/compile-vunit.sh b/libraries/vendors/compile-vunit.sh
index 277ec47ef..ae567f1d7 100755
--- a/libraries/vendors/compile-vunit.sh
+++ b/libraries/vendors/compile-vunit.sh
@@ -43,8 +43,9 @@ ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/compile-xilinx-ise.sh b/libraries/vendors/compile-xilinx-ise.sh
index efe361b34..c53faa0ab 100755
--- a/libraries/vendors/compile-xilinx-ise.sh
+++ b/libraries/vendors/compile-xilinx-ise.sh
@@ -44,8 +44,9 @@ ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/compile-xilinx-vivado.sh b/libraries/vendors/compile-xilinx-vivado.sh
index 5d14e8110..784546a40 100755
--- a/libraries/vendors/compile-xilinx-vivado.sh
+++ b/libraries/vendors/compile-xilinx-vivado.sh
@@ -44,8 +44,9 @@ ScriptDir="$(dirname $0)"
ScriptDir="$($READLINK -f $ScriptDir)"
# source configuration file from GHDL's 'vendors' library directory
-source $ScriptDir/config.sh
-source $ScriptDir/shared.sh
+. $ScriptDir/../ansi_color.sh
+. $ScriptDir/config.sh
+. $ScriptDir/shared.sh
# command line argument processing
NO_COMMAND=1
diff --git a/libraries/vendors/shared.sh b/libraries/vendors/shared.sh
index 6b613ab17..6b77b2f5e 100644
--- a/libraries/vendors/shared.sh
+++ b/libraries/vendors/shared.sh
@@ -30,15 +30,6 @@
# 02111-1307, USA.
# ==============================================================================
-ANSI_RED="\e[31m"
-ANSI_GREEN="\e[32m"
-ANSI_YELLOW="\e[33m"
-ANSI_BLUE="\e[34m"
-ANSI_MAGENTA="\e[35m"
-ANSI_CYAN="\e[36;1m"
-ANSI_DARKCYAN="\e[36m"
-ANSI_NOCOLOR="\e[0m"
-
# red texts
COLORED_ERROR="$ANSI_RED[ERROR]$ANSI_NOCOLOR"
COLORED_FAILED="$ANSI_RED[FAILED]$ANSI_NOCOLOR"
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