mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Refactor Verilator building in Travis, bug1547.
This commit is contained in:
parent
8700564197
commit
46ab907f6a
238
.travis.yml
238
.travis.yml
@ -6,106 +6,156 @@
|
||||
|
||||
language: cpp
|
||||
|
||||
matrix:
|
||||
include:
|
||||
# Non-cron build will just run on whatever linux flavor we get
|
||||
- if: type != cron
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--dist
|
||||
- if: type != cron
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--vlt
|
||||
- if: type != cron
|
||||
os: linux
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--vltmt
|
||||
# Cron builds try different OS/compiler combinations
|
||||
- if: type = cron
|
||||
dist: xenial
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--dist
|
||||
- if: type = cron
|
||||
dist: xenial
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--vlt
|
||||
- if: type = cron
|
||||
dist: xenial
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--vltmt
|
||||
- if: type = cron
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
env:
|
||||
- SCENARIOS=--dist
|
||||
- if: type = cron
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
env:
|
||||
- SCENARIOS=--vlt
|
||||
- if: type = cron
|
||||
dist: xenial
|
||||
compiler: clang
|
||||
env:
|
||||
- SCENARIOS=--vltmt
|
||||
# - if: type = cron
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# env:
|
||||
# - SCENARIOS=--dist
|
||||
# - if: type = cron
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# env:
|
||||
# - SCENARIOS=--vlt
|
||||
# - if: type = cron
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# env:
|
||||
# - SCENARIOS=--vltmt
|
||||
- if: type = cron
|
||||
dist: trusty
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--dist
|
||||
- if: type = cron
|
||||
dist: trusty
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--vlt
|
||||
- if: type = cron
|
||||
dist: trusty
|
||||
compiler: gcc
|
||||
env:
|
||||
- SCENARIOS=--vltmt
|
||||
|
||||
cache: ccache
|
||||
|
||||
# Some tests require gdb
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gdb
|
||||
env:
|
||||
global:
|
||||
- VERILATOR_CACHE=$HOME/verilator_cache
|
||||
- VERILATOR_ROOT=$PWD
|
||||
- VERILATOR_NUM_JOBS=$((`nproc` + 1))
|
||||
- VERILATOR_CONFIG_FLAGS="--enable-maintainer-mode --enable-longtests"
|
||||
- OBJCACHE=ccache
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $VERILATOR_CACHE
|
||||
|
||||
before_install:
|
||||
# Perl modules needed for testing
|
||||
- yes yes | sudo cpan -fi Unix::Processors Parallel::Forker Bit::Vector
|
||||
- sudo apt-get install gdb
|
||||
before_script:
|
||||
- export VLT_JOBS=$((`nproc` + 1))
|
||||
- export OBJCACHE=ccache
|
||||
- export VERILATOR_ROOT=`pwd`
|
||||
- autoconf
|
||||
script:
|
||||
- >
|
||||
./configure --enable-maintainer-mode --enable-longtests &&
|
||||
make -j $VLT_JOBS &&
|
||||
make test_regress DRIVER_FLAGS="-j 0 --quiet --rerun"
|
||||
- bash -x ci/build_verilator.sh
|
||||
after_script:
|
||||
- ccache -s
|
||||
|
||||
stages:
|
||||
- "Build Verilator"
|
||||
- test
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- if: type != cron
|
||||
stage: "Build Verilator"
|
||||
name: Build Verilator
|
||||
os: linux
|
||||
compiler: gcc
|
||||
script: echo "Done building Verilator"
|
||||
# Non-cron build will just run on whatever linux flavor we get
|
||||
- if: type != cron
|
||||
stage: test
|
||||
name: Dist test
|
||||
os: linux
|
||||
compiler: gcc
|
||||
script: ci/test.sh dist
|
||||
- if: type != cron
|
||||
stage: test
|
||||
name: Vlt test
|
||||
os: linux
|
||||
compiler: gcc
|
||||
script: ci/test.sh vlt
|
||||
- if: type != cron
|
||||
stage: test
|
||||
name: Vltmt test
|
||||
os: linux
|
||||
compiler: gcc
|
||||
script: ci/test.sh vltmt
|
||||
# Cron builds try different OS/compiler combinations
|
||||
- if: type = cron
|
||||
stage: "Build Verilator"
|
||||
name: Build xenial gcc Verilator
|
||||
os: xenial
|
||||
compiler: gcc
|
||||
script: echo "Done building Verilator"
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Xenail gcc dist test
|
||||
os: xenial
|
||||
compiler: gcc
|
||||
script: ci/test.sh dist
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Xenail gcc vlt test
|
||||
os: xenial
|
||||
compiler: gcc
|
||||
script: ci/test.sh vlt
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Xenail gcc vltmt test
|
||||
os: xenial
|
||||
compiler: gcc
|
||||
script: ci/test.sh vltmt
|
||||
- if: type = cron
|
||||
stage: "Build Verilator"
|
||||
name: Build xenial clang Verilator
|
||||
os: xenial
|
||||
compiler: clang
|
||||
script: echo "Done building Verilator"
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Xenail clang dist test
|
||||
os: xenial
|
||||
compiler: clang
|
||||
script: ci/test.sh dist
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Xenail clang vlt test
|
||||
os: xenial
|
||||
compiler: clang
|
||||
script: ci/test.sh vlt
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Xenail clang vltmt test
|
||||
os: xenial
|
||||
compiler: clang
|
||||
script: ci/test.sh vltmt
|
||||
# - if: type = cron
|
||||
# stage: "Build Verilator"
|
||||
# name: Build OSX gcc Verilator
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# script: echo "Done building Verilator"
|
||||
# - if: type = cron
|
||||
# stage: test
|
||||
# name: OSX gcc dist test
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# script: ci/test.sh dist
|
||||
# - if: type = cron
|
||||
# stage: test
|
||||
# name: OSX gcc vlt test
|
||||
# os: osx
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# script: ci/test.sh vlt
|
||||
# - if: type = cron
|
||||
# stage: test
|
||||
# name: OSX gcc vltmt test
|
||||
# os: osx
|
||||
# os: osx
|
||||
# compiler: gcc
|
||||
# script: ci/test.sh vltmt
|
||||
- if: type = cron
|
||||
stage: "Build Verilator"
|
||||
name: Build trusty gcc Verilator
|
||||
os: trusty
|
||||
compiler: gcc
|
||||
script: echo "Done building Verilator"
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Trusty gcc dist test
|
||||
os: trusty
|
||||
compiler: gcc
|
||||
script: ci/test.sh dist
|
||||
- if: type = cron
|
||||
stage: test
|
||||
name: Trusty gcc vlt test
|
||||
os: trusty
|
||||
compiler: gcc
|
||||
script: ci/test.sh vlt
|
||||
- if: type = cron
|
||||
stage: test
|
||||
os: trusty
|
||||
name: Trusty gcc vltmt test
|
||||
compiler: gcc
|
||||
script: ci/test.sh vltmt
|
||||
|
@ -46,6 +46,7 @@ verilator_coverage_bin.*
|
||||
ncverilog.history
|
||||
autom4te\.cache/
|
||||
nodist/
|
||||
ci/
|
||||
/simv$
|
||||
/simv.daidir/
|
||||
/vc_hdrs.h$
|
||||
|
64
ci/build_verilator.sh
Executable file
64
ci/build_verilator.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
# DESCRIPTION: Verilator: Travis CI build script
|
||||
#
|
||||
# Copyright 2019 by Todd Strader. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
#
|
||||
# This script builds and caches the Verilator binaries for Travis CI
|
||||
# (and possibly other CI platforms). The Verilator CI system uses this
|
||||
# script, but other CI systems that depend on Verilator may also use
|
||||
# the script.
|
||||
# see: https://github.com/verilator/verilator_ext_tests/blob/master/.travis.yml
|
||||
# To use this script, either checkout Verilator as part of the CI build
|
||||
# process or add Verilator as a Git submodule. Verilator tarballs can
|
||||
# not be used as the script relies on Git revisions for caching.
|
||||
set -e
|
||||
|
||||
if [ -z ${VERILATOR_NUM_JOBS} ]; then
|
||||
VERILATOR_NUM_JOBS=$(nproc)
|
||||
fi
|
||||
|
||||
# Caching would be simpler if we installed without VERILATOR_ROOT, but
|
||||
# it's needed for driver.pl outside of the repo
|
||||
if [ -z ${VERILATOR_ROOT} ]; then
|
||||
echo "VERILATOR_ROOT not set"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
if [ -z ${VERILATOR_CACHE} ]; then
|
||||
echo "VERILATOR_CACHE not set"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
VERILATOR_REV=$(cd ${VERILATOR_ROOT} && git rev-parse HEAD)
|
||||
echo "Found Verilator rev ${VERILATOR_REV}"
|
||||
|
||||
CACHED_REV_FILE=${VERILATOR_CACHE}/.rev.txt
|
||||
|
||||
if [[ ! -f ${CACHED_REV_FILE} || \
|
||||
$(< ${CACHED_REV_FILE}) != ${VERILATOR_REV} ]]; then
|
||||
echo "Building Verilator"
|
||||
|
||||
# Unsure why Travis monkies with the capitalization of the stage name, but it does
|
||||
if [[ -n ${TRAVIS_BUILD_STAGE_NAME} && \
|
||||
${TRAVIS_BUILD_STAGE_NAME} != "Build verilator" ]]; then
|
||||
echo "WARNING: Building Verilator in Travis build stage other than \"Build verilator\": ${TRAVIS_BUILD_STAGE_NAME}"
|
||||
fi
|
||||
|
||||
cd ${VERILATOR_ROOT}
|
||||
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS} && make -j ${VERILATOR_NUM_JOBS}
|
||||
# Copy the Verilator build artifacts
|
||||
mkdir -p ${VERILATOR_CACHE}
|
||||
rm -rf ${VERILATOR_CACHE}/*
|
||||
cp bin/*bin* ${VERILATOR_CACHE}
|
||||
# Remember the Git revision
|
||||
echo ${VERILATOR_REV} > ${CACHED_REV_FILE}
|
||||
else
|
||||
echo "Using cached Verilator"
|
||||
cd ${VERILATOR_ROOT}
|
||||
# Create include/verilated_config.h and maybe other things
|
||||
autoconf && ./configure ${VERILATOR_CONFIG_FLAGS}
|
||||
cp ${VERILATOR_CACHE}/* bin
|
||||
fi
|
26
ci/test.sh
Executable file
26
ci/test.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# DESCRIPTION: Verilator: Travis CI test script
|
||||
#
|
||||
# Copyright 2019 by Todd Strader. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
set -e
|
||||
|
||||
export DRIVER_FLAGS='-j 0 --quiet --rerun'
|
||||
|
||||
case $1 in
|
||||
dist)
|
||||
make -C test_regress SCENARIOS=--dist
|
||||
;;
|
||||
vlt)
|
||||
make -C test_regress SCENARIOS=--vlt
|
||||
;;
|
||||
vltmt)
|
||||
make -C test_regress SCENARIOS=--vltmt
|
||||
;;
|
||||
*)
|
||||
echo "Usage: test.sh (dist|vlt|vltmt)"
|
||||
exit -1
|
||||
;;
|
||||
esac
|
@ -35,7 +35,7 @@ endif
|
||||
|
||||
# Run tests in parallel. Requires Parallel::Forker to be installed.
|
||||
ifeq ($(CFG_WITH_LONGTESTS),yes)
|
||||
DRIVER_FLAGS += -j 0 --quiet --rerun
|
||||
DRIVER_FLAGS ?= -j 0 --quiet --rerun
|
||||
endif
|
||||
|
||||
.SUFFIXES:
|
||||
|
Loading…
Reference in New Issue
Block a user