From 85e64d3b4cc5383e3a4b98f7107ff346d534340f Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Wed, 10 Jul 2019 06:32:47 +0200 Subject: Add synth testsuite to CI (#862) * add synth testsuite to CI * update travis jobs to fedora29 * travis: add 'dummy' image name to man job * travis: update Debian from Stretch to Buster * update travis jobs to fedora30 --- .travis.yml | 19 +++++++++---------- dist/travis/build.sh | 8 +++++++- dist/travis/test.sh | 32 +++++++++++++++++++++++++------- dist/travis/travis-ci.sh | 12 +----------- dist/travis/utils.sh | 34 +++++++++++++++++++++++++++++----- 5 files changed, 71 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e9cf90e4..9b3293958 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,22 +3,21 @@ dist: xenial services: docker language: minimal install: skip -script: "./dist/travis/travis-ci.sh" +script: ./dist/travis/travis-ci.sh # For each linux build, a different job/instance (with the constraints # above) is executed in parallel in stage 'test'. env: matrix: - - IMAGE=stretch+mcode - - IMAGE=stretch+mcode+gpl -# - IMAGE=buster+mcode -# - IMAGE=buster+mcode+gpl + - IMAGE=buster+mcode + - IMAGE=buster+mcode + EXTRA=gpl + - IMAGE=buster+mcode + EXTRA=synth - IMAGE=ubuntu14+mcode - IMAGE=ubuntu14+llvm-3.8 -# - IMAGE=ubuntu18+mcode -# - IMAGE=ubuntu18+llvm-5.0 - - IMAGE=fedora28+mcode - - IMAGE=fedora28+llvm + - IMAGE=fedora30+mcode + - IMAGE=fedora30+llvm deploy: - &deploy-docker @@ -49,7 +48,7 @@ jobs: # Optionally, more macos jobs can be added. See list of available versions at https://docs.travis-ci.com/user/reference/osx/#macos-version # - <<: *osx # osx_image: xcode10 - - env: IMAGE="" + - env: IMAGE="man" script: ./dist/travis/man.sh deploy: - <<: *deploy-docker diff --git a/dist/travis/build.sh b/dist/travis/build.sh index 58e8bfbfa..59438ff56 100755 --- a/dist/travis/build.sh +++ b/dist/travis/build.sh @@ -18,16 +18,18 @@ for arg in "$@"; do "--build"|"-build") set -- "$@" "-b";; "--pkg"|"-pkg") set -- "$@" "-p";; "--gpl"|"-gpl") set -- "$@" "-g";; + "--synth"|"-synth") set -- "$@" "-s";; *) set -- "$@" "$arg" esac done # Parse args -while getopts ":b:p:cg" opt; do +while getopts ":b:p:cgs" opt; do case $opt in c) enable_color;; b) BLD=$OPTARG ;; p) PKG_NAME=$OPTARG;; g) ISGPL=true;; + s) ISSYNTH=true;; \?) printf "$ANSI_RED[GHDL - build] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 exit 1 ;; :) printf "$ANSI_RED[GHDL - build] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 @@ -66,6 +68,10 @@ mkdir "$prefix" mkdir "build-$BLD" cd "build-$BLD" +if [ "x$ISSYNTH" = "xtrue" ]; then + CONFIG_OPTS+=" --enable-synth" +fi + case "$BLD" in gcc*) travis_start "get_gcc" "$ANSI_YELLOW[GHDL] Get gcc sources $ANSI_NOCOLOR" diff --git a/dist/travis/test.sh b/dist/travis/test.sh index b57d190d0..07326a235 100755 --- a/dist/travis/test.sh +++ b/dist/travis/test.sh @@ -18,14 +18,16 @@ for arg in "$@"; do case "$arg" in "--color"|"-color") set -- "$@" "-c";; "--gpl"|"-gpl") set -- "$@" "-g";; + "--synth"|"-synth") set -- "$@" "-s";; *) set -- "$@" "$arg" esac done # Parse args -while getopts ":b:p:cg" opt; do +while getopts ":b:p:cgs" opt; do case $opt in c) enable_color;; g) ISGPL=true;; + s) ISSYNTH=true;; \?) printf "$ANSI_RED[GHDL - test] Invalid option: -$OPTARG $ANSI_NOCOLOR\n" >&2 exit 1 ;; :) printf "$ANSI_RED[GHDL - test] Option -$OPTARG requires an argument. $ANSI_NOCOLOR\n" >&2 @@ -36,7 +38,7 @@ done rm -f test_ok export ENABLECOLOR -if [ "$GHDL" = "" ]; then +if [ "x$GHDL" = "x" ]; then export GHDL="$prefix/bin/ghdl" fi cd testsuite @@ -50,7 +52,7 @@ for d in [0-9]*; do echo "sanity $d: ok" # Don't disp log else - echo "${ANSI_RED}sanity $d: failed${ANSI_NOCOLOR}" + printf "${ANSI_RED}sanity $d: failed${ANSI_NOCOLOR}\n" cat test.log failures="$failures $d" fi @@ -62,7 +64,7 @@ cd .. travis_finish "tests.sanity" [ "$failures" = "" ] || exit 1 -if [ "$ISGPL" != "true" ]; then +if [ "x$ISGPL" != "xtrue" ]; then travis_start "tests.gna" "$ANSI_YELLOW[GHDL - test] gna $ANSI_NOCOLOR" cd gna dirs=`./testsuite.sh --list-tests` @@ -72,7 +74,7 @@ if [ "$ISGPL" != "true" ]; then echo "gna $d: ok" # Don't disp log else - echo "${ANSI_RED}gna $d: failed${ANSI_NOCOLOR}" + printf "${ANSI_RED}gna $d: failed${ANSI_NOCOLOR}\n" cat test.log failures="$failures $d" fi @@ -88,17 +90,33 @@ fi travis_start "tests.vests" "$ANSI_YELLOW[GHDL - test] vests $ANSI_NOCOLOR" cd vests if ./testsuite.sh > vests.log 2>&1 ; then - echo "${ANSI_GREEN}Vests is OK$ANSI_NOCOLOR" + printf "${ANSI_GREEN}Vests is OK$ANSI_NOCOLOR\n" wc -l vests.log else cat vests.log - echo "${ANSI_RED}Vests failure$ANSI_NOCOLOR" + printf "${ANSI_RED}Vests failure$ANSI_NOCOLOR\n" failures=vests fi cd .. travis_finish "tests.vests" [ "$failures" = "" ] || exit 1 +if [ "x$ISSYNTH" = "xtrue" ]; then + travis_start "tests.synth" "$ANSI_YELLOW[GHDL - test] synth $ANSI_NOCOLOR" + cd synth + if ./testsuite.sh > synth.log 2>&1 ; then + printf "${ANSI_GREEN}Synth is OK$ANSI_NOCOLOR\n" + wc -l synth.log + else + cat synth.log + printf "${ANSI_RED}Synth failure$ANSI_NOCOLOR\n" + failures="synth" + fi + cd .. + travis_finish "tests.synth" + [ "$failures" = "" ] || exit 1 +fi + $GHDL --version cd .. diff --git a/dist/travis/travis-ci.sh b/dist/travis/travis-ci.sh index 44ca82569..60c557572 100755 --- a/dist/travis/travis-ci.sh +++ b/dist/travis/travis-ci.sh @@ -49,7 +49,7 @@ fi # Get build command options travis_start "opts" "$ANSI_YELLOW[GHDL - build] Get build command options $ANSI_NOCOLOR" -buildCmdOpts +buildCmdOpts "$EXTRA" echo "build cmd: $BUILD_CMD_OPTS" travis_finish "opts" @@ -71,16 +71,6 @@ else cp version.tmp src/version.in travis_finish "version" - GHDL_IMAGE_TAG=`echo $IMAGE | sed -e 's/+/-/g'` - - case $IMAGE in - *gcc*) - BUILD_IMAGE_TAG="$(echo $IMAGE | sed 's#\(.*\)+gcc.*#\1-gcc#g')" - ;; - *) - BUILD_IMAGE_TAG="$GHDL_IMAGE_TAG" - ;; - esac travis_start "pull" "$ANSI_YELLOW[GHDL - build] Docker pull ghdl/build:$BUILD_IMAGE_TAG $ANSI_NOCOLOR" docker pull ghdl/build:$BUILD_IMAGE_TAG diff --git a/dist/travis/utils.sh b/dist/travis/utils.sh index 7987c762b..5cbf186d7 100644 --- a/dist/travis/utils.sh +++ b/dist/travis/utils.sh @@ -48,6 +48,12 @@ fi #-- buildCmdOpts () { + # Extract from IMAGE (defined in .travis.yml) + BUILD_ARG="$IMAGE" + if [ "x$1" != "x" ]; then + BUILD_ARG="$IMAGE+$1" + fi + # Compute package name PKG_SHORTCOMMIT="$(printf $TRAVIS_COMMIT | cut -c1-10)" PKG_VER=`grep "ghdl_version=" configure | sed -e 's/.*"\(.*\)";/\1/'` @@ -62,19 +68,37 @@ buildCmdOpts () { PKG_TAG="$TRAVIS_TAG" fi - # Extract from IMAGE (defined in .travis.yml) - IFS='+' read -ra REFS <<< "$IMAGE" + # Extract from BUILD_ARG + IFS='+' read -ra REFS <<< "$BUILD_ARG" DDIST=${REFS[0]} # Linux distro (eg: ubuntuXX, fedoraXX) DBLD=${REFS[1]} # Build/backend (eg: mcode, llvm) - DGPL=${REFS[2]} # GPL or not + DEXT=${REFS[2]} # Extra constraints: GPL, synth PKG_NAME="ghdl-${PKG_TAG}-${DDIST}-${DBLD}" BUILD_CMD_OPTS="$ENABLECOLOR -b $DBLD" - if [ "$DGPL" = "gpl" ]; then + + if [ "x$DEXT" = "xgpl" ]; then BUILD_CMD_OPTS="$BUILD_CMD_OPTS --gpl" - PKG_NAME="ghdl-gpl-${PKG_TAG}" + PKG_NAME="ghdl-$DEXT-${PKG_TAG}" + fi + if [ "x$DEXT" = "xsynth" ]; then + BUILD_CMD_OPTS="$BUILD_CMD_OPTS --synth" + PKG_NAME="ghdl-$DEXT-${PKG_TAG}" fi export BUILD_CMD_OPTS="${BUILD_CMD_OPTS} -p $PKG_NAME" + + GHDL_IMAGE_TAG="`echo $IMAGE | sed -e 's/+/-/g'`" + BUILD_IMAGE_TAG="$GHDL_IMAGE_TAG" + + case $BUILD_ARG in + *gcc*) + BUILD_IMAGE_TAG="`echo $GHDL_IMAGE_TAG | sed 's#\(.*\)-gcc.*#\1-gcc#g'`" + ;; + esac + + if [ "x$DEXT" != "x" ]; then + GHDL_IMAGE_TAG="$GHDL_IMAGE_TAG-$DEXT" + fi } #-- -- cgit v1.2.3