Travis: Add FreeBSD build + portability fixes
This commit is contained in:
parent
98b5417e04
commit
378d947702
11
.travis.yml
11
.travis.yml
|
|
@ -17,6 +17,8 @@ cache:
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- VERILATOR_ROOT=$TRAVIS_BUILD_DIR
|
- VERILATOR_ROOT=$TRAVIS_BUILD_DIR
|
||||||
|
# Hack around debug mode issues on FreeBSD
|
||||||
|
- ENV_HACK=$([ ! -e $TRAVIS_BUILD_DIR/ci/travis-env-hack.bash ] || $TRAVIS_BUILD_DIR/ci/travis-env-hack.bash)
|
||||||
|
|
||||||
# The list and order of build stages
|
# The list and order of build stages
|
||||||
stages:
|
stages:
|
||||||
|
|
@ -41,6 +43,8 @@ install:
|
||||||
before_script:
|
before_script:
|
||||||
# ccache maintenance
|
# ccache maintenance
|
||||||
- ./ci/travis-ccache-maint.bash
|
- ./ci/travis-ccache-maint.bash
|
||||||
|
# Don't produce core dumps (esp. on FreeBSD)
|
||||||
|
- ulimit -c 0
|
||||||
# On Focal, set the SystemC installation location
|
# On Focal, set the SystemC installation location
|
||||||
- |
|
- |
|
||||||
if [ "$TRAVIS_DIST" = "focal" ]; then
|
if [ "$TRAVIS_DIST" = "focal" ]; then
|
||||||
|
|
@ -72,6 +76,8 @@ jobs:
|
||||||
- {stage: build, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {create: {name: coverage, paths: .}}, env: COVERAGE=1}
|
- {stage: build, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {create: {name: coverage, paths: .}}, env: COVERAGE=1}
|
||||||
# OS X build
|
# OS X build
|
||||||
- {stage: build, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {create: {name: osx-xcode11.6, paths: .}}}
|
- {stage: build, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {create: {name: osx-xcode11.6, paths: .}}}
|
||||||
|
# FreeBSD build
|
||||||
|
- {stage: build, if: type = cron, os: freebsd, compiler: clang, workspaces: {create: {name: freebsd, paths: .}}}
|
||||||
############################################################################
|
############################################################################
|
||||||
# Jobs in the 'test' stage
|
# Jobs in the 'test' stage
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
@ -116,6 +122,11 @@ jobs:
|
||||||
- {stage: test, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {use: osx-xcode11.6}, git: {clone: false}, env: TESTS=dist-vlt-1}
|
- {stage: test, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {use: osx-xcode11.6}, git: {clone: false}, env: TESTS=dist-vlt-1}
|
||||||
- {stage: test, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {use: osx-xcode11.6}, git: {clone: false}, env: TESTS=vltmt-0}
|
- {stage: test, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {use: osx-xcode11.6}, git: {clone: false}, env: TESTS=vltmt-0}
|
||||||
- {stage: test, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {use: osx-xcode11.6}, git: {clone: false}, env: TESTS=vltmt-1}
|
- {stage: test, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {use: osx-xcode11.6}, git: {clone: false}, env: TESTS=vltmt-1}
|
||||||
|
# FreeBSD tests - Note these need the git clone in order to pick up the ENV_HACK
|
||||||
|
- {stage: test, if: type = cron, os: freebsd, compiler: clang, workspaces: {use: freebsd}, git: {clone: true}, env: TESTS=dist-vlt-0}
|
||||||
|
- {stage: test, if: type = cron, os: freebsd, compiler: clang, workspaces: {use: freebsd}, git: {clone: true}, env: TESTS=dist-vlt-1}
|
||||||
|
- {stage: test, if: type = cron, os: freebsd, compiler: clang, workspaces: {use: freebsd}, git: {clone: true}, env: TESTS=vltmt-0}
|
||||||
|
- {stage: test, if: type = cron, os: freebsd, compiler: clang, workspaces: {use: freebsd}, git: {clone: true}, env: TESTS=vltmt-1}
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# DESCRIPTION: Verilator: Travis CI early platform workaround
|
||||||
|
#
|
||||||
|
# Copyright 2020 by Geza Lore. 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.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# This script runs very early by setting an env variable to $(<this script>)
|
||||||
|
# This is to work around travis-ci issues
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [ "$TRAVIS_OS_NAME" = "freebsd" ]; then
|
||||||
|
# Needs bash in bin for non-portable #! in scripts
|
||||||
|
sudo ln -s "$(which bash)" /bin/bash
|
||||||
|
# Needs tmate for debug mode (the one in pkg is too old, so build from source)
|
||||||
|
sudo pkg install -y libevent
|
||||||
|
sudo pkg install -y msgpack
|
||||||
|
sudo pkg install -y libssh
|
||||||
|
git clone https://github.com/tmate-io/tmate.git /tmp/tmate-build
|
||||||
|
pushd /tmp/tmate-build
|
||||||
|
git checkout 2.4.0
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
make -j$(sysctl -n hw.ncpu)
|
||||||
|
sudo make install
|
||||||
|
popd
|
||||||
|
# Travis debug scripts also require this to be in /usr/bin rather than
|
||||||
|
# /usr/local/bin whre the abote puts it
|
||||||
|
sudo ln -s "$(which tmate)" /usr/bin/tmate
|
||||||
|
fi
|
||||||
|
|
@ -25,11 +25,21 @@ fatal() {
|
||||||
echo "ERROR: $(basename "$0"): $1" >&2; exit 1;
|
echo "ERROR: $(basename "$0"): $1" >&2; exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||||
|
MAKE=make
|
||||||
|
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
|
MAKE=make
|
||||||
|
elif [ "$TRAVIS_OS_NAME" = "freebsd" ]; then
|
||||||
|
MAKE=gmake
|
||||||
|
else
|
||||||
|
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
||||||
|
fi
|
||||||
|
|
||||||
install-vcddiff() {
|
install-vcddiff() {
|
||||||
TMP_DIR="$(mktemp -d)"
|
TMP_DIR="$(mktemp -d)"
|
||||||
git clone https://github.com/veripool/vcddiff "$TMP_DIR"
|
git clone https://github.com/veripool/vcddiff "$TMP_DIR"
|
||||||
git -C "${TMP_DIR}" checkout 5112f88b7ba8818dce9dfb72619e64a1fc19542c
|
git -C "${TMP_DIR}" checkout 5112f88b7ba8818dce9dfb72619e64a1fc19542c
|
||||||
make -C "${TMP_DIR}"
|
"$MAKE" -C "${TMP_DIR}"
|
||||||
sudo cp "${TMP_DIR}/vcddiff" /usr/local/bin
|
sudo cp "${TMP_DIR}/vcddiff" /usr/local/bin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +58,8 @@ if [ "$TRAVIS_BUILD_STAGE_NAME" = "build" ]; then
|
||||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
brew update
|
brew update
|
||||||
brew install ccache perl gperftools
|
brew install ccache perl gperftools
|
||||||
|
elif [ "$TRAVIS_OS_NAME" = "freebsd" ]; then
|
||||||
|
sudo pkg install -y autoconf bison ccache gmake perl5
|
||||||
else
|
else
|
||||||
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
||||||
fi
|
fi
|
||||||
|
|
@ -71,6 +83,11 @@ elif [ "$TRAVIS_BUILD_STAGE_NAME" = "test" ]; then
|
||||||
brew install ccache perl
|
brew install ccache perl
|
||||||
yes yes | sudo cpan -fi Unix::Processors Parallel::Forker
|
yes yes | sudo cpan -fi Unix::Processors Parallel::Forker
|
||||||
install-vcddiff
|
install-vcddiff
|
||||||
|
elif [ "$TRAVIS_OS_NAME" = "freebsd" ]; then
|
||||||
|
# fst2vcd fails with "Could not open '<input file>', exiting."
|
||||||
|
sudo pkg install -y ccache gmake perl5 python3
|
||||||
|
yes yes | sudo cpan -fi Unix::Processors Parallel::Forker
|
||||||
|
install-vcddiff
|
||||||
else
|
else
|
||||||
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,14 @@ fatal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
|
||||||
|
export MAKE=make
|
||||||
NPROC=$(nproc)
|
NPROC=$(nproc)
|
||||||
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
|
export MAKE=make
|
||||||
NPROC=$(sysctl -n hw.logicalcpu)
|
NPROC=$(sysctl -n hw.logicalcpu)
|
||||||
|
elif [ "$TRAVIS_OS_NAME" = "freebsd" ]; then
|
||||||
|
export MAKE=gmake
|
||||||
|
NPROC=$(sysctl -n hw.ncpu)
|
||||||
else
|
else
|
||||||
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
fatal "Unknown os: '$TRAVIS_OS_NAME'"
|
||||||
fi
|
fi
|
||||||
|
|
@ -37,7 +42,7 @@ if [ "$TRAVIS_BUILD_STAGE_NAME" = "build" ]; then
|
||||||
if [ "$COVERAGE" != 1 ]; then
|
if [ "$COVERAGE" != 1 ]; then
|
||||||
autoconf
|
autoconf
|
||||||
./configure --enable-longtests --enable-ccwarn
|
./configure --enable-longtests --enable-ccwarn
|
||||||
make -j "$NPROC"
|
"$MAKE" -j "$NPROC"
|
||||||
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
file bin/verilator_bin
|
file bin/verilator_bin
|
||||||
file bin/verilator_bin_dbg
|
file bin/verilator_bin_dbg
|
||||||
|
|
@ -67,22 +72,25 @@ elif [ "$TRAVIS_BUILD_STAGE_NAME" = "test" ]; then
|
||||||
# it as data rather than a Mach-O). Unclear if this is an OS X issue or
|
# it as data rather than a Mach-O). Unclear if this is an OS X issue or
|
||||||
# one for Travis. Remove the file and re-link...
|
# one for Travis. Remove the file and re-link...
|
||||||
rm bin/verilator_bin_dbg
|
rm bin/verilator_bin_dbg
|
||||||
make -j "$NPROC"
|
"$MAKE" -j "$NPROC"
|
||||||
|
elif [ "$TRAVIS_OS_NAME" = "freebsd" ]; then
|
||||||
|
export VERILATOR_TEST_NO_GDB=1 # Disable for now, ideally should run
|
||||||
|
export VERILATOR_TEST_NO_GPROF=1 # gprof is a bit different on FreeBSD, disable
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the specified test
|
# Run the specified test
|
||||||
case $TESTS in
|
case $TESTS in
|
||||||
dist-vlt-0)
|
dist-vlt-0)
|
||||||
make -C test_regress SCENARIOS="--dist --vlt" DRIVER_HASHSET=--hashset=0/2
|
"$MAKE" -C test_regress SCENARIOS="--dist --vlt" DRIVER_HASHSET=--hashset=0/2
|
||||||
;;
|
;;
|
||||||
dist-vlt-1)
|
dist-vlt-1)
|
||||||
make -C test_regress SCENARIOS="--dist --vlt" DRIVER_HASHSET=--hashset=1/2
|
"$MAKE" -C test_regress SCENARIOS="--dist --vlt" DRIVER_HASHSET=--hashset=1/2
|
||||||
;;
|
;;
|
||||||
vltmt-0)
|
vltmt-0)
|
||||||
make -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=0/2
|
"$MAKE" -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=0/2
|
||||||
;;
|
;;
|
||||||
vltmt-1)
|
vltmt-1)
|
||||||
make -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=1/2
|
"$MAKE" -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=1/2
|
||||||
;;
|
;;
|
||||||
coverage-dist)
|
coverage-dist)
|
||||||
nodist/code_coverage --stages 3- --scenarios=--dist
|
nodist/code_coverage --stages 3- --scenarios=--dist
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
|
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||||
#if !defined(__MINGW32__)
|
#if !defined(__MINGW32__) && !defined(__FreeBSD__)
|
||||||
# define HAVE_ALLOCA_H 1
|
# define HAVE_ALLOCA_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,6 @@ void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstV
|
||||||
|
|
||||||
VerilatedTrace<VerilatedFst>::declCode(code, bits, false);
|
VerilatedTrace<VerilatedFst>::declCode(code, bits, false);
|
||||||
|
|
||||||
std::pair<Code2SymbolType::iterator, bool> p
|
|
||||||
= m_code2symbol.insert(std::make_pair(code, static_cast<fstHandle>(NULL)));
|
|
||||||
std::istringstream nameiss(name);
|
std::istringstream nameiss(name);
|
||||||
std::istream_iterator<std::string> beg(nameiss);
|
std::istream_iterator<std::string> beg(nameiss);
|
||||||
std::istream_iterator<std::string> end;
|
std::istream_iterator<std::string> end;
|
||||||
|
|
@ -174,11 +172,13 @@ void VerilatedFst::declare(vluint32_t code, const char* name, int dtypenum, fstV
|
||||||
fstEnumHandle enumNum = m_local2fstdtype[dtypenum];
|
fstEnumHandle enumNum = m_local2fstdtype[dtypenum];
|
||||||
fstWriterEmitEnumTableRef(m_fst, enumNum);
|
fstWriterEmitEnumTableRef(m_fst, enumNum);
|
||||||
}
|
}
|
||||||
if (p.second) { // New
|
|
||||||
p.first->second = fstWriterCreateVar(m_fst, vartype, vardir, bits, name_str.c_str(), 0);
|
Code2SymbolType::const_iterator it = m_code2symbol.find(code);
|
||||||
assert(p.first->second);
|
if (it == m_code2symbol.end()) { // New
|
||||||
|
m_code2symbol[code]
|
||||||
|
= fstWriterCreateVar(m_fst, vartype, vardir, bits, name_str.c_str(), 0);
|
||||||
} else { // Alias
|
} else { // Alias
|
||||||
fstWriterCreateVar(m_fst, vartype, vardir, bits, name_str.c_str(), p.first->second);
|
fstWriterCreateVar(m_fst, vartype, vardir, bits, name_str.c_str(), it->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#include "V3Os.h"
|
#include "V3Os.h"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <climits> // PATH_MAX (especially on FreeBSD)
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
|
||||||
|
|
@ -1075,6 +1075,15 @@ sub compile {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($^O eq "freebsd") {
|
||||||
|
my $flags = join(' ', $self->compile_vlt_flags(%param));
|
||||||
|
if ($flags =~ /--trace-fst/ && $flags =~ /--trace-threads/) {
|
||||||
|
# See https://github.com/gtkwave/gtkwave/issues/24
|
||||||
|
$self->skip("Known fstapi.c threading issue on FreeBSD");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$param{fails} && $param{make_main}) {
|
if (!$param{fails} && $param{make_main}) {
|
||||||
$self->_make_main();
|
$self->_make_main();
|
||||||
}
|
}
|
||||||
|
|
@ -2193,12 +2202,12 @@ sub fst2vcd {
|
||||||
my $fn1 = shift;
|
my $fn1 = shift;
|
||||||
my $fn2 = shift;
|
my $fn2 = shift;
|
||||||
if (!-r $fn1) { $self->error("File does not exist $fn1\n"); return 0; }
|
if (!-r $fn1) { $self->error("File does not exist $fn1\n"); return 0; }
|
||||||
my $cmd = qq{fst2vcd --help};
|
my $cmd = qq{fst2vcd -h};
|
||||||
print "\t$cmd\n" if $::Debug;
|
print "\t$cmd\n" if $::Debug;
|
||||||
my $out = `$cmd`;
|
my $out = `$cmd`;
|
||||||
if (!$out || $out !~ /Usage:/) { $self->skip("No fst2vcd installed\n"); return 1; }
|
if (!$out || $out !~ /Usage:/) { $self->skip("No fst2vcd installed\n"); return 1; }
|
||||||
|
|
||||||
$cmd = qq{fst2vcd -e "$fn1" -o "$fn2"};
|
$cmd = qq{fst2vcd -e -f "$fn1" -o "$fn2"};
|
||||||
print "\t$cmd\n"; # Always print to help debug race cases
|
print "\t$cmd\n"; # Always print to help debug race cases
|
||||||
$out = `$cmd`;
|
$out = `$cmd`;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -2208,6 +2217,7 @@ sub fst_identical {
|
||||||
my $self = (ref $_[0]? shift : $Self);
|
my $self = (ref $_[0]? shift : $Self);
|
||||||
my $fn1 = shift;
|
my $fn1 = shift;
|
||||||
my $fn2 = shift;
|
my $fn2 = shift;
|
||||||
|
return 0 if $self->errors || $self->skips || $self->unsupporteds;
|
||||||
my $tmp = $fn1.".vcd";
|
my $tmp = $fn1.".vcd";
|
||||||
fst2vcd($fn1, $tmp);
|
fst2vcd($fn1, $tmp);
|
||||||
return vcd_identical($tmp, $fn2);
|
return vcd_identical($tmp, $fn2);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue