Travis: Add OS X build (#2440)

This commit is contained in:
Geza Lore 2020-06-22 10:13:54 +01:00 committed by GitHub
parent f13fd4478c
commit 5a4cc333fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 137 additions and 99 deletions

View File

@ -70,6 +70,8 @@ jobs:
- {stage: build, os: linux, dist: focal, compiler: clang, workspaces: {create: {name: focal-clang, paths: .}}} - {stage: build, os: linux, dist: focal, compiler: clang, workspaces: {create: {name: focal-clang, paths: .}}}
# Coverage build # Coverage build
- {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
- {stage: build, if: type = cron, os: osx, osx_image: xcode11.6, compiler: clang, workspaces: {create: {name: osx-xcode11.6, paths: .}}}
############################################################################ ############################################################################
# Jobs in the 'test' stage # Jobs in the 'test' stage
############################################################################ ############################################################################
@ -109,6 +111,11 @@ jobs:
- {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-1} - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-1}
- {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-2} - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-2}
- {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-3} - {stage: test, if: type = cron, os: linux, dist: focal, compiler: gcc, workspaces: {use: coverage}, git: {clone: false}, env: TESTS=coverage-vltmt-3}
# OS X tests
- {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-0}
- {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-1}
notifications: notifications:
email: email:

View File

@ -39,12 +39,15 @@ if [ "$TRAVIS_BUILD_STAGE_NAME" = "build" ]; then
# build Verilator # build Verilator
if [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ "$TRAVIS_OS_NAME" = "linux" ]; then
time sudo apt-get update sudo apt-get update
sudo apt-get install libfl-dev sudo apt-get install libfl-dev
sudo apt-get install libgoogle-perftools-dev sudo apt-get install libgoogle-perftools-dev
if [ "$COVERAGE" = 1 ]; then if [ "$COVERAGE" = 1 ]; then
yes yes | sudo cpan -fi Unix::Processors Parallel::Forker yes yes | sudo cpan -fi Unix::Processors Parallel::Forker
fi fi
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew update
brew install ccache perl gperftools
else else
fatal "Unknown os: '$TRAVIS_OS_NAME'" fatal "Unknown os: '$TRAVIS_OS_NAME'"
fi fi
@ -62,6 +65,12 @@ elif [ "$TRAVIS_BUILD_STAGE_NAME" = "test" ]; then
yes yes | sudo cpan -fi Unix::Processors Parallel::Forker yes yes | sudo cpan -fi Unix::Processors Parallel::Forker
# Not listing Bit::Vector as slow to install, and only skips one test # Not listing Bit::Vector as slow to install, and only skips one test
install-vcddiff install-vcddiff
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
brew update
# brew cask install gtkwave # fst2vcd hangs at launch, so don't bother
brew install ccache perl
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

View File

@ -22,26 +22,37 @@ fatal() {
echo "ERROR: $(basename "$0"): $1" >&2; exit 1; echo "ERROR: $(basename "$0"): $1" >&2; exit 1;
} }
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
NPROC=$(nproc)
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
NPROC=$(sysctl -n hw.logicalcpu)
else
fatal "Unknown os: '$TRAVIS_OS_NAME'"
fi
if [ "$TRAVIS_BUILD_STAGE_NAME" = "build" ]; then if [ "$TRAVIS_BUILD_STAGE_NAME" = "build" ]; then
############################################################################## ##############################################################################
# Build verilator # Build verilator
if [ "$TRAVIS_OS_NAME" = "linux" ]; 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"
file bin/verilator_bin
file bin/verilator_bin_dbg
else else
nodist/code_coverage --stages 1-2 nodist/code_coverage --stages 1-2
fi fi
else
fatal "Unknown os: '$TRAVIS_OS_NAME'"
fi
elif [ "$TRAVIS_BUILD_STAGE_NAME" = "test" ]; then elif [ "$TRAVIS_BUILD_STAGE_NAME" = "test" ]; then
############################################################################## ##############################################################################
# Run tests # Run tests
if [ "$TRAVIS_OS_NAME" = "linux" ]; then if [ "$TRAVIS_OS_NAME" = "osx" ]; then
export VERILATOR_TEST_NO_GDB=1 # Pain to get GDB to work on OS X
export VERILATOR_TEST_NO_GPROF=1 # Apple Clang has no -pg
# export PATH="/Applications/gtkwave.app/Contents/Resources/bin:$PATH" # fst2vcd
fi
# Run the specified test # Run the specified test
case $TESTS in case $TESTS in
dist-vlt-0) dist-vlt-0)
@ -91,9 +102,6 @@ elif [ "$TRAVIS_BUILD_STAGE_NAME" = "test" ]; then
if [[ $TESTS == coverage-* ]]; then if [[ $TESTS == coverage-* ]]; then
bash <(curl -s https://codecov.io/bash) -f nodist/obj_dir/coverage/app_total.info bash <(curl -s https://codecov.io/bash) -f nodist/obj_dir/coverage/app_total.info
fi fi
else
fatal "Unknown os: '$TRAVIS_OS_NAME'"
fi
else else
############################################################################## ##############################################################################
# Unknown build stage # Unknown build stage

View File

@ -128,12 +128,6 @@ AC_ARG_ENABLE([prec11],
AC_SUBST(CFG_WITH_PREC11) AC_SUBST(CFG_WITH_PREC11)
AC_MSG_RESULT($CFG_WITH_PREC11) AC_MSG_RESULT($CFG_WITH_PREC11)
# Compiler flags
CFLAGS+=" -I${includedir}"
CPPFLAGS+=" -I${includedir}"
CXXFLAGS+=" -I${includedir}"
LDFLAGS+=" -L${libdir}"
# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX

View File

@ -68,7 +68,7 @@ run:
@echo " library (libverilated_secret.a) generated from the previous" @echo " library (libverilated_secret.a) generated from the previous"
@echo " step" @echo " step"
@echo "---------------------------------------------------------------" @echo "---------------------------------------------------------------"
$(VERILATOR) $(TOP_VERILATOR_FLAGS) --exe -LDFLAGS '-L../obj_dir_secret -lverilated_secret -static' top.v obj_dir_secret/verilated_secret.sv sim_main.cpp $(VERILATOR) $(TOP_VERILATOR_FLAGS) --exe -LDFLAGS '../obj_dir_secret/libverilated_secret.a' top.v obj_dir_secret/verilated_secret.sv sim_main.cpp
@echo @echo
@echo "-- COMPILE entire design --------------------------------------" @echo "-- COMPILE entire design --------------------------------------"

View File

@ -278,7 +278,6 @@ V3__CONCAT.cpp: $(addsuffix .cpp, $(basename $(RAW_OBJS)))
$(TGT): $(PREDEP_H) $(OBJS) $(TGT): $(PREDEP_H) $(OBJS)
@echo " Linking $@..." @echo " Linking $@..."
-rm -rf $@ $@.exe
${LINK} ${LDFLAGS} -o $@ $(OBJS) $(CCMALLOC) ${LIBS} ${LINK} ${LDFLAGS} -o $@ $(OBJS) $(CCMALLOC) ${LIBS}
V3Number_test: V3Number_test.o V3Number_test: V3Number_test.o

View File

@ -9,9 +9,17 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(vlt_all => 1); scenarios(vlt_all => 1);
top_filename("t/t_case_huge.v"); top_filename("t/t_case_huge.v");
if ($ENV{VERILATOR_TEST_NO_GPROF}) {
skip("Skipping due to VERILATOR_TEST_NO_GPROF");
} else {
dotest();
}
ok(1);
sub dotest {
compile( compile(
verilator_flags2 => ["--stats --prof-cfuncs -CFLAGS '-pg' -LDFLAGS '-pg'"], verilator_flags2 => ["--stats --prof-cfuncs -CFLAGS '-pg' -LDFLAGS '-pg'"],
); );
@ -38,6 +46,6 @@ run(cmd => ["cd $Self->{obj_dir} && $ENV{VERILATOR_ROOT}/bin/verilator_profcfunc
check_finished => 0); check_finished => 0);
file_grep("$Self->{obj_dir}/cfuncs.out", qr/Overall summary by/); file_grep("$Self->{obj_dir}/cfuncs.out", qr/Overall summary by/);
}
ok(1);
1; 1;

View File

@ -28,6 +28,19 @@ compile(
"t_flag_ldflags_so.so",], "t_flag_ldflags_so.so",],
); );
# On OS X, LD_LIBRARY_PATH is ignored, so set rpath of the exe to find the .so
if ($^O eq "darwin") {
run(cmd => ["cd $Self->{obj_dir}"
." && install_name_tool -add_rpath \@executable_path/."
." $Self->{VM_PREFIX}"],
check_finished => 0);
run(cmd => ["cd $Self->{obj_dir}"
." && install_name_tool -change t_flag_ldflags_so.so"
." \@rpath/t_flag_ldflags_so.so $Self->{VM_PREFIX}"],
check_finished => 0);
}
execute( execute(
check_finished => 1, check_finished => 1,
run_env => "LD_LIBRARY_PATH=$Self->{obj_dir}", run_env => "LD_LIBRARY_PATH=$Self->{obj_dir}",

View File

@ -51,7 +51,7 @@ while (1) {
compile( compile(
verilator_flags2 => ["$secret_dir/secret.sv", verilator_flags2 => ["$secret_dir/secret.sv",
"-LDFLAGS", "-LDFLAGS",
"'-L$secret_prefix -lsecret -static'"], "$secret_prefix/libsecret.a"],
xsim_flags2 => ["$secret_dir/secret.sv"], xsim_flags2 => ["$secret_dir/secret.sv"],
); );

View File

@ -54,7 +54,7 @@ while (1) {
verilator_flags2 => ["$secret_dir/secret.sv", verilator_flags2 => ["$secret_dir/secret.sv",
"-GGATED_CLK=1", "-GGATED_CLK=1",
"-LDFLAGS", "-LDFLAGS",
"'-L$secret_prefix -lsecret -static'"], "$secret_prefix/libsecret.a"],
xsim_flags2 => ["$secret_dir/secret.sv"], xsim_flags2 => ["$secret_dir/secret.sv"],
); );