Make installation relocatable, and the installation testable (#4927)

Fixes #4893
This commit is contained in:
Geza Lore 2024-03-01 00:08:28 +00:00 committed by GitHub
parent 3af0eb7fa0
commit f56f318217
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 496 additions and 354 deletions

View File

@ -17,6 +17,8 @@ env:
CCACHE_COMPRESS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_LIMIT_MULTIPLE: 0.95
INSTALL_DIR: ${{ github.workspace }}/install
RELOC_DIR: ${{ github.workspace }}/relloc
defaults:
run:
@ -94,6 +96,7 @@ jobs:
compiler:
- { cc: clang, cxx: clang++ }
- { cc: gcc, cxx: g++ }
reloc: [0]
suite: [dist-vlt-0, dist-vlt-1, dist-vlt-2, vltmt-0, vltmt-1]
include:
# Test with GCC 10 on ubuntu-20.04
@ -102,14 +105,21 @@ jobs:
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, suite: dist-vlt-2}
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, suite: vltmt-0}
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, suite: vltmt-1}
# Test relocated installation - on most common platform only
- {os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ }, reloc: 1, suite: dist-vlt-0}
- {os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ }, reloc: 1, suite: dist-vlt-1}
- {os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ }, reloc: 1, suite: dist-vlt-2}
- {os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ }, reloc: 1, suite: vltmt-0}
- {os: ubuntu-22.04, compiler: { cc: gcc, cxx: g++ }, reloc: 1, suite: vltmt-1}
runs-on: ${{ matrix.os }}
name: Test | ${{ matrix.os }} | ${{ matrix.compiler.cc }} | ${{ matrix.suite }}
name: Test | ${{ matrix.os }} | ${{ matrix.compiler.cc }} | ${{ matrix.reloc && 'reloc | ' || '' }} ${{ matrix.suite }}
env:
CI_BUILD_STAGE_NAME: test
CI_RUNS_ON: ${{ matrix.os }}
CI_RELOC: ${{ matrix.reloc }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.suite }}
CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.reloc }}-${{ matrix.suite }}
CCACHE_MAXSIZE: 100M # Per build per suite (* 5 * 5 = 2500M in total)
VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

View File

@ -203,11 +203,21 @@ verilator.html:
verilator.pdf: Makefile
$(MAKE) -C docs verilator.pdf
# See uninstall also - don't put wildcards in this variable, it might uninstall other stuff
VL_INST_BIN_FILES = verilator verilator_bin$(EXEEXT) verilator_bin_dbg$(EXEEXT) verilator_coverage_bin_dbg$(EXEEXT) \
verilator_ccache_report verilator_coverage verilator_difftree verilator_gantt verilator_includer verilator_profcfunc
# Some scripts go into both the search path and pkgdatadir,
# so they can be found by the user, and under $VERILATOR_ROOT.
# Public executables intended to be invoked directly by the user
# Don't put wildcards in these variables, it might cause an uninstall of other stuff
VL_INST_PUBLIC_SCRIPT_FILES = verilator \
verilator_coverage \
verilator_gantt \
verilator_profcfunc \
VL_INST_PUBLIC_BIN_FILES = verilator_bin$(EXEEXT) \
verilator_bin_dbg$(EXEEXT) \
verilator_coverage_bin_dbg$(EXEEXT) \
# Private executabels intended to be invoked by internals
# Don't put wildcards in these variables, it might cause an uninstall of other stuff
VL_INST_PRIVATE_SCRIPT_FILES = verilator_ccache_report \
verilator_includer \
VL_INST_INC_BLDDIR_FILES = \
include/verilated_config.h \
@ -226,19 +236,34 @@ VL_INST_DATA_SRCDIR_FILES = \
examples/*/Makefile* \
examples/*/vl_* \
installbin:
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator $(DESTDIR)$(bindir)/verilator )
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_coverage $(DESTDIR)$(bindir)/verilator_coverage )
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_gantt $(DESTDIR)$(bindir)/verilator_gantt )
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_profcfunc $(DESTDIR)$(bindir)/verilator_profcfunc )
( cd bin ; $(INSTALL_PROGRAM) verilator_bin$(EXEEXT) $(DESTDIR)$(bindir)/verilator_bin$(EXEEXT) )
( cd bin ; $(INSTALL_PROGRAM) verilator_bin_dbg$(EXEEXT) $(DESTDIR)$(bindir)/verilator_bin_dbg$(EXEEXT) )
( cd bin ; $(INSTALL_PROGRAM) verilator_coverage_bin_dbg$(EXEEXT) $(DESTDIR)$(bindir)/verilator_coverage_bin_dbg$(EXEEXT) )
mkbindirs:
$(MKINSTALLDIRS) $(DESTDIR)$(pkgdatadir)/bin
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_includer $(DESTDIR)$(pkgdatadir)/bin/verilator_includer )
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_ccache_report $(DESTDIR)$(pkgdatadir)/bin/verilator_ccache_report )
( cd ${srcdir}/bin ; $(INSTALL_PROGRAM) verilator_difftree $(DESTDIR)$(pkgdatadir)/bin/verilator_difftree )
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
installbin: | mkbindirs
cd $(srcdir)/bin; \
for p in $(VL_INST_PUBLIC_SCRIPT_FILES) ; do \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkgdatadir)/bin/$$p; \
done
cd bin; \
for p in $(VL_INST_PUBLIC_BIN_FILES) ; do \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkgdatadir)/bin/$$p; \
done
cd $(srcdir)/bin; \
for p in $(VL_INST_PRIVATE_SCRIPT_FILES) ; do \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkgdatadir)/bin/$$p; \
done
installredirect: installbin | mkbindirs
cp ${srcdir}/bin/redirect ${srcdir}/bin/redirect.tmp
perl -p -i -e 'use File::Spec;' \
-e' $$path = File::Spec->abs2rel("$(realpath $(DESTDIR)$(pkgdatadir)/bin)", "$(realpath $(DESTDIR)$(bindir))");' \
-e 's/RELPATH.*/"$$path";/g' -- "${srcdir}/bin/redirect.tmp"
cd $(srcdir)/bin; \
for p in $(VL_INST_PUBLIC_SCRIPT_FILES) $(VL_INST_PUBLIC_BIN_FILES) ; do \
$(INSTALL_PROGRAM) redirect.tmp $(DESTDIR)$(bindir)/$$p; \
done
rm ${srcdir}/bin/redirect.tmp
# Man files can either be part of the original kit, or built in current directory
# So important we use $^ so VPATH is searched
@ -281,8 +306,11 @@ installdata:
# We don't trust rm -rf, so rmdir instead as it will fail if user put in other files
uninstall:
-cd $(DESTDIR)$(bindir) && rm -f $(VL_INST_BIN_FILES)
-cd $(DESTDIR)$(pkgdatadir)/bin && rm -f $(VL_INST_BIN_FILES)
-cd $(DESTDIR)$(bindir) && rm -f $(VL_INST_PUBLIC_SCRIPT_FILES)
-cd $(DESTDIR)$(bindir) && rm -f $(VL_INST_PUBLIC_BIN_FILES)
-cd $(DESTDIR)$(pkgdatadir)/bin && rm -f $(VL_INST_PUBLIC_SCRIPT_FILES)
-cd $(DESTDIR)$(pkgdatadir)/bin && rm -f $(VL_INST_PUBLIC_BIN_FILES)
-cd $(DESTDIR)$(pkgdatadir)/bin && rm -f $(VL_INST_PRIVATE_SCRIPT_FILES)
-cd $(DESTDIR)$(mandir)/man1 && rm -f $(VL_INST_MAN_FILES)
-cd $(DESTDIR)$(pkgdatadir) && rm -f $(VL_INST_INC_BLDDIR_FILES)
-cd $(DESTDIR)$(pkgdatadir) && rm -f $(VL_INST_INC_SRCDIR_FILES)
@ -311,7 +339,7 @@ uninstall:
-rmdir $(DESTDIR)$(pkgconfigdir)
install: all_nomsg install-all
install-all: installbin installman installdata install-msg
install-all: installbin installredirect installman installdata install-msg
install-here: installman info

22
bin/redirect Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env perl
######################################################################
#
# Copyright 2003-2024 by Wilson Snyder. 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
#
######################################################################
require 5.006_001;
use warnings;
use FindBin qw($RealBin $RealScript);
use strict;
my $relpath = RELPATH; # Substituted during Verilator 'make install'
unshift @ARGV, $RealScript;
exec { "$RealBin/$relpath/$RealScript" } @ARGV;
die "%Error: Exec failed,";

View File

@ -15,6 +15,7 @@ use Getopt::Long;
use FindBin qw($RealBin $RealScript);
use IO::File;
use Pod::Usage;
use Cwd qw(realpath);
use strict;
use vars qw($Debug @Opt_Verilator_Sw);
@ -67,6 +68,18 @@ if (! GetOptions(
pod2usage(-exitstatus => 2, -verbose => 0);
}
my $verilator_root = realpath("$RealBin/..");
if (defined $ENV{VERILATOR_ROOT}) {
if ((!-d $ENV{VERILATOR_ROOT}) || $verilator_root ne realpath($ENV{VERILATOR_ROOT})) {
warn "%Error: verilator: VERILATOR_ROOT is set to inconsistent path. Suggest leaving it unset.\n";
warn "%Error: VERILATOR_ROOT=$ENV{VERILATOR_ROOT}\n";
exit 1;
}
} else {
print "export VERILATOR_ROOT='$verilator_root'\n" if $Debug;
$ENV{VERILATOR_ROOT} = $verilator_root;
}
if ($opt_gdbbt && !gdb_works()) {
warn "-Info: --gdbbt ignored: gdb doesn't seem to be working\n" if $Debug;
$opt_gdbbt = 0;
@ -151,30 +164,13 @@ sub debug {
# Builds
sub verilator_bin {
my $bin = "";
# Use VERILATOR_ROOT if defined, else assume verilator_bin is in the search path
my $basename = ($ENV{VERILATOR_BIN}
|| ($Debug ? "verilator_bin_dbg" : "verilator_bin"));
if (defined($ENV{VERILATOR_ROOT})) {
my $dir = $ENV{VERILATOR_ROOT};
if (-x "$dir/bin/$basename"
|| -x "$dir/bin/$basename.exe") { # From a "make install" into VERILATOR_ROOT
$bin = "$dir/bin/$basename";
if (-x "$RealBin/$basename" || -x "$RealBin/$basename.exe") {
return "$RealBin/$basename";
} else {
$bin = "$dir/$basename"; # From pointing to kit directory
return $basename; # Find in PATH
}
} else {
if (-x "$RealBin/$basename"
|| -x "$RealBin/$basename.exe") {
$bin = "$RealBin/$basename"; # From path/to/verilator with verilator_bin installed
} else {
$bin = $basename; # Find in PATH
}
# Note we don't look under bin/$basename which would be right if running
# in the kit dir. Running that would likely break, since
# VERILATOR_ROOT wouldn't be set and Verilator won't find internal files.
}
return $bin;
}
#######################################################################

View File

@ -40,7 +40,7 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then
if [ "$COVERAGE" != 1 ]; then
autoconf
./configure --enable-longtests --enable-ccwarn
./configure --enable-longtests --enable-ccwarn --prefix="$INSTALL_DIR"
ccache -z
"$MAKE" -j "$NPROC" -k
# 22.04: ccache -s -v
@ -87,23 +87,37 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
# Run sanitize on Ubuntu 22.04 only
[ "$CI_RUNS_ON" = 'ubuntu-22.04' ] && sanitize='--sanitize' || sanitize=''
TEST_REGRESS=test_regress
if [ "$CI_RELOC" == 1 ]; then
# Testing that the installation is relocatable.
"$MAKE" install
mkdir -p "$RELOC_DIR"
mv "$INSTALL_DIR" "$RELOC_DIR/relocated-install"
export VERILATOR_ROOT="$RELOC_DIR/relocated-install/share/verilator"
TEST_REGRESS="$RELOC_DIR/test_regress"
mv test_regress "$TEST_REGRESS"
# Feeling brave?
find . -delete
ls -la .
fi
# Run the specified test
ccache -z
case $TESTS in
dist-vlt-0)
"$MAKE" -C test_regress SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=0/3
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=0/3
;;
dist-vlt-1)
"$MAKE" -C test_regress SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=1/3
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=1/3
;;
dist-vlt-2)
"$MAKE" -C test_regress SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=2/3
"$MAKE" -C "$TEST_REGRESS" SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=2/3
;;
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)
"$MAKE" -C test_regress SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=1/2
"$MAKE" -C "$TEST_REGRESS" SCENARIOS=--vltmt DRIVER_HASHSET=--hashset=1/2
;;
coverage-all)
nodist/code_coverage --stages 1-

View File

@ -16,7 +16,7 @@
default: test
# This must point to the root of the VERILATOR kit
VERILATOR_ROOT := $(shell pwd)/..
VERILATOR_ROOT ?= $(shell pwd)/..
export VERILATOR_ROOT
# Pick up PERL and other variable settings

View File

@ -12,6 +12,8 @@ BEGIN {
}
$ENV{MAKE} ||= "make";
$ENV{CXX} ||= "c++";
!defined $ENV{TEST_REGRESS} or die "TEST_REGRESS environment variable is already set";
$ENV{TEST_REGRESS} = Cwd::getcwd();
}
use Getopt::Long;
@ -2484,7 +2486,7 @@ sub _vcd_read {
our $_Cxx_Version;
sub cxx_version {
$_Cxx_Version ||= `$ENV{MAKE} -C $ENV{VERILATOR_ROOT}/test_regress -f Makefile print-cxx-version`;
$_Cxx_Version ||= `$ENV{MAKE} -C $ENV{TEST_REGRESS} -f Makefile print-cxx-version`;
return $_Cxx_Version;
}

View File

@ -16,7 +16,7 @@ scenarios(simulator => 1);
$DEBUG_QUIET = "--debug --debugi 0 --gdbbt --no-dump-tree";
run(cmd => ["perl", "../bin/verilator", $DEBUG_QUIET, "-V"],
run(cmd => ["perl", "$ENV{VERILATOR_ROOT}/bin/verilator", $DEBUG_QUIET, "-V"],
verilator_run => 1,
);

View File

@ -10,8 +10,13 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
rerunnable(0);
my $root = "..";
if ($ENV{VERILATOR_TEST_NO_ATTRIBUTES}) {
skip("Skipping due to VERILATOR_TEST_NO_ATTRIBUTES");
} elsif (!-r "$root/.git") {
skip("Not in a git repository");
} else {
check();
}

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
compile(
verilator_flags2 => ['--assert'],
nc_flags2 => ['+assert'],
@ -57,6 +62,7 @@ extract(
in => $Self->{golden_filename},
out => "../docs/gen/ex_USERFATAL_msg.rst",
regexp => qr/USERFATAL/);
}
ok(1);
1;

View File

@ -24,7 +24,7 @@ execute(
# Read the input .v file and do any CHECK_COVER requests
inline_checks();
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--annotate-points",
"--annotate", "$Self->{obj_dir}/annotated",
"$Self->{obj_dir}/coverage.dat"],
@ -34,7 +34,7 @@ run(cmd => ["../bin/verilator_coverage",
files_identical("$Self->{obj_dir}/annotated/t_cover_line.v", $Self->{golden_filename});
# Also try lcov
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--write-info", "$Self->{obj_dir}/coverage.info",
"$Self->{obj_dir}/coverage.dat"],
verilator_run => 1,

View File

@ -24,7 +24,7 @@ execute(
# Read the input .v file and do any CHECK_COVER requests
inline_checks();
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--annotate-points",
"--annotate", "$Self->{obj_dir}/annotated",
"$Self->{obj_dir}/coverage.dat",

View File

@ -20,7 +20,7 @@ execute(
check_finished => 1,
);
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--annotate-points",
"--annotate", "$Self->{obj_dir}/annotated",
"$Self->{obj_dir}/coverage.dat",

View File

@ -26,7 +26,7 @@ file_grep_not("$Self->{obj_dir}/coverage.dat", "largeish");
file_grep($Self->{stats}, qr/Coverage, Toggle points joined\s+(\d+)/i, 23)
if $Self->{vlt_all};
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--annotate", "$Self->{obj_dir}/annotated",
"$Self->{obj_dir}/coverage.dat",
],
@ -35,7 +35,7 @@ run(cmd => ["../bin/verilator_coverage",
files_identical("$Self->{obj_dir}/annotated/$Self->{name}.v", $Self->{golden_filename});
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--annotate-points",
"--annotate", "$Self->{obj_dir}/annotated-points",
"$Self->{obj_dir}/coverage.dat",

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt_all => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
$Self->{sim_time} = 2000000;
# Read optimizations
@ -89,6 +94,7 @@ sub check {
foreach my $opt (@optimizations) {
check($opt);
}
}
ok(1);
1;

View File

@ -10,11 +10,16 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
if (!-x "$ENV{VERILATOR_ROOT}/bin/verilator_difftree") {
skip("No verilator_difftree available")
}
else {
run(cmd => ["cd $Self->{obj_dir} && $ENV{VERILATOR_ROOT}/bin/verilator_difftree"
. " $Self->{t_dir}/t_difftree.a.tree $Self->{t_dir}/t_difftree.b.tree > diff.log"],
check_finished => 0);
files_identical("$Self->{obj_dir}/diff.log", $Self->{golden_filename}, 'logfile');
}
ok(1);

View File

@ -13,8 +13,13 @@ use JSON::PP;
use IO::File;
scenarios(dist => 1);
my $root = "..";
if ($ENV{VERILATOR_TEST_NO_ATTRIBUTES}) {
skip("Skipping due to VERILATOR_TEST_NO_ATTRIBUTES");
} elsif (!-r "$root/.git") {
skip("Not in a git repository");
} else {
check();
}

View File

@ -10,6 +10,9 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
my $root = "..";
my $Debug;
@ -89,6 +92,7 @@ if (keys %warns) {
error($warns{$file});
}
}
}
ok(1);
1;

View File

@ -1,8 +1,8 @@
// Test that environment substitutions work
# This is also a comment (in several simulators)
-f $VERILATOR_ROOT/test_regress/t/t_flag_f__2.vc
-f $TEST_REGRESS/t/t_flag_f__2.vc
// Env var with .v file, and parens
// Double slash below is intentional, as allowed in other tools
${VERILATOR_ROOT}/test_regress/t//t_flag_f__3.v
${TEST_REGRESS}/t//t_flag_f__3.v
// Test -f
-F $VERILATOR_ROOT/test_regress/t/tsub/t_flag_f_tsub.vc
-F $TEST_REGRESS/t/tsub/t_flag_f_tsub.vc

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
setenv('FOOBARTEST', "gotit");
run(
cmd => ["../bin/verilator --getenv FOOBARTEST"],
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --getenv FOOBARTEST"],
expect => 'gotit
',
logfile => "$Self->{obj_dir}/simx.log",
@ -22,7 +22,7 @@ run(
foreach my $var (qw(MAKE PERL SYSTEMC SYSTEMC_ARCH SYSTEMC_LIBDIR VERILATOR_ROOT)) {
run(
cmd => ["../bin/verilator --getenv ${var}"],
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --getenv ${var}"],
logfile => "$Self->{obj_dir}/simx.log",
verilator_run => 1,
);

View File

@ -30,13 +30,16 @@ sub check {
file_grep($logfile, qr/(DISTRIBUTION|usage:)/i);
}
check("perl", "../bin/verilator");
check("perl", "../bin/verilator_coverage");
check("perl", "$ENV{VERILATOR_ROOT}/bin/verilator");
check("perl", "$ENV{VERILATOR_ROOT}/bin/verilator_coverage");
check("python3", "../bin/verilator_ccache_report");
check("python3", "../bin/verilator_difftree");
check("python3", "../bin/verilator_gantt");
check("python3", "../bin/verilator_profcfunc");
check("python3", "$ENV{VERILATOR_ROOT}/bin/verilator_ccache_report");
check("python3", "$ENV{VERILATOR_ROOT}/bin/verilator_gantt");
check("python3", "$ENV{VERILATOR_ROOT}/bin/verilator_profcfunc");
if (-x "$ENV{VERILATOR_ROOT}/bin/verilator_difftree") {
check("python3", "$ENV{VERILATOR_ROOT}/bin/verilator_difftree");
}
ok(1);
1;

View File

@ -9,7 +9,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
run(fails => 0,
cmd => ["../bin/verilator", "--help", "--valgrind"],
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator", "--help", "--valgrind"],
tee => 0,
verilator_run => 1,
);

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
run(cmd => ["../bin/verilator --lint-only"],
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --lint-only"],
fails => 1,
logfile => "$Self->{obj_dir}/sim.log",
expect_filename => $Self->{golden_filename},

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
run(cmd => ["../bin/verilator",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator",
"t_flag_noop_bad.v"],
fails => 1,
logfile => "$Self->{obj_dir}/sim.log",

View File

@ -12,7 +12,7 @@ scenarios(vlt => 1);
if ($Self->have_coroutines) {
run(
cmd => ["../bin/verilator --get-supported COROUTINES"],
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --get-supported COROUTINES"],
expect => '1
',
logfile => "$Self->{obj_dir}/vlt_coroutines.log",
@ -22,7 +22,7 @@ if ($Self->have_coroutines) {
if ($Self->have_sc) {
run(
cmd => ["../bin/verilator --get-supported SYSTEMC"],
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --get-supported SYSTEMC"],
expect => '1
',
logfile => "$Self->{obj_dir}/vlt_systemc.log",
@ -31,7 +31,7 @@ if ($Self->have_sc) {
}
run(
cmd => ["../bin/verilator --get-supported DOES_NOT_EXIST"],
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator --get-supported DOES_NOT_EXIST"],
expect => '',
logfile => "$Self->{obj_dir}/vlt_does_not_exist.log",
verilator_run => 1,

View File

@ -12,11 +12,11 @@ scenarios(dist => 1);
foreach my $prog (
# See also t_flag_help.pl
"../bin/verilator",
"../bin/verilator_coverage",
#"../bin/verilator_difftree",
#"../bin/verilator_gantt",
#"../bin/verilator_profcfunc",
"$ENV{VERILATOR_ROOT}/bin/verilator",
"$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
#"$ENV{VERILATOR_ROOT}/bin/verilator_difftree",
#"$ENV{VERILATOR_ROOT}/bin/verilator_gantt",
#"$ENV{VERILATOR_ROOT}/bin/verilator_profcfunc",
) {
run(fails => 0,
cmd => ["perl", $prog,

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
compile(
verilator_flags2 => ["--prof-cfuncs"],
);
@ -28,6 +33,7 @@ extract(
in => $Self->{golden_filename},
out => "../docs/gen/ex_DIDNOTCONVERGE_msg.rst",
lines => "1-2");
}
ok(1);
1;

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
top_filename("t/t_lint_didnotconverge_bad.v");
compile(
@ -25,6 +30,7 @@ extract(
in => $Self->{golden_filename},
out => "../docs/gen/ex_DIDNOTCONVERGE_nodbg_msg.rst",
lines => "1");
}
ok(1);
1;

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(linter => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
@ -24,6 +29,7 @@ extract(
in => $Self->{golden_filename},
out => "../docs/gen/ex_MULTIDRIVEN_msg.rst",
lines => "10,11,14");
}
ok(1);
1;

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
lint(
verilator_flags2 => ["--no-timing"],
fails => 1,
@ -25,6 +30,7 @@ extract(
in => $Self->{golden_filename},
out => "../docs/gen/ex_STMTDLY_msg.rst",
lines => "1");
}
ok(1);
1;

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(linter => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
lint(
verilator_flags2 => ["--lint-only"],
fails => $Self->{vlt_all},
@ -31,6 +36,7 @@ extract(
in => $Self->{top_filename},
out => "../docs/gen/ex_WIDTHEXPAND_1_fixed.rst",
lines => "18");
}
ok(1);
1;

View File

@ -12,7 +12,7 @@ scenarios(vlt => 1);
# This doesn't use the general compile rule as we want to make sure we form
# prefix properly using post-escaped identifiers
run(cmd => ["../bin/verilator",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator",
"--cc",
"--Mdir " . $Self->{obj_dir} . "/t_mod_dollar",
"--exe --build --main",

View File

@ -12,7 +12,7 @@ scenarios(vlt => 1);
# Hit the debug statements in the preprocessor for internal coverage
run(cmd => ["../bin/verilator",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator",
"-E",
"t/t_preproc_debugi.v",
"--debug",

View File

@ -10,6 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(linter => 1);
my $root = "..";
if (!-r "$root/.git") {
skip("Not in a git repository");
} else {
lint(
verilator_flags2 => ["--lint-only -Wwarn-VARHIDDEN"],
fails => $Self->{vlt_all},
@ -26,6 +31,7 @@ extract(
out => "../docs/gen/ex_VARHIDDEN_msg.rst",
lineno_adjust => -6,
regexp => qr/(var_bad_hide)/);
}
ok(1);
1;

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(simulator_st => 1);
compile(
verilator_flags2 => ['+incdir+../include'],
verilator_flags2 => ["+incdir+$ENV{VERILATOR_ROOT}/include"],
);
execute(

View File

@ -15,7 +15,7 @@ foreach my $basename ("t_vlcov_data_a.dat",
"t_vlcov_data_c.dat",
"t_vlcov_data_d.dat",
) {
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"t/${basename}",
"--debug",
"--debugi 9",

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
run(cmd => ["../bin/verilator_coverage", '--invalid-dash'],
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage", '--invalid-dash'],
logfile => $Self->{run_log_filename},
fails => 1,
expect_filename => $Self->{golden_filename},

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--write-info", "$Self->{obj_dir}/coverage.info",
"t/t_vlcov_data_a.dat",
"t/t_vlcov_data_b.dat",

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--no-unlink", "--nounlink",
"--write", "$Self->{obj_dir}/coverage.dat",
"t/t_vlcov_data_a.dat",

View File

@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
run(fails => 1,
cmd => ["../bin/verilator_coverage",
cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"t/t_NOT_FOUND",],
logfile => $Self->{run_log_filename},
expect_filename => $Self->{golden_filename},

View File

@ -10,7 +10,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(dist => 1);
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--rank",
"t/t_vlcov_data_a.dat",
"t/t_vlcov_data_b.dat",

View File

@ -15,7 +15,7 @@ foreach my $basename ("t_vlcov_data_a.dat",
"t_vlcov_data_c.dat",
"t_vlcov_data_d.dat",
) {
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"t/${basename}",
"--write", "$Self->{obj_dir}/${basename}"
],

View File

@ -15,7 +15,7 @@ scenarios(dist => 1);
my $tmp = "$Self->{obj_dir}/copied.dat";
File::Copy::copy("$Self->{t_dir}/t_vlcov_data_a.dat", $tmp);
run(cmd => ["../bin/verilator_coverage",
run(cmd => ["$ENV{VERILATOR_ROOT}/bin/verilator_coverage",
"--unlink",
$tmp,
"--write", "$Self->{obj_dir}/output.dat"],