Tests: Use standard verilator.mk rules for tests.

This commit is contained in:
Wilson Snyder 2019-11-02 11:15:58 -04:00
parent c0c038c887
commit 7febeab275
5 changed files with 10 additions and 37 deletions

View File

@ -14,15 +14,10 @@
default: $(VM_PREFIX)
ifneq ($(MAKE_MAIN),0)
# Add main to classes rather then SC_SRCS to save a compiler run
VM_CLASSES += ${VM_PREFIX}__main $(VM_USER_CLASSES) $(VM_GLOBAL_FAST) $(VM_GLOBAL_SLOW)
endif
include $(VM_PREFIX).mk
# So t/t_foobar.cpp is found (due to test_regress using -Mdir)
VPATH += ../../$(VM_USER_DIR)
VPATH += ../..
#######################################################################
@ -51,30 +46,3 @@ ifeq ($(CFG_WITH_LONGTESTS),yes)
endif
#######################################################################
# Linking final exe
ifeq ($(VM_SC),1)
LIBS += $(SC_LIBS)
endif
.SUFFIXES:
#Default compile, using verilator.mk rules
#%.o: %.cpp
# $(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<
#
#Default link, using normal make rules
#$(VM_PREFIX): $(VK_GLOBAL_OBJS) $(VK_OBJS)
# $(LINK) $(LDFLAGS) -g $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LIBS) 2>&1
#Our own compile rules; Faster compile, all in one file
$(VM_PREFIX)__ALLboth.cpp: $(VK_CLASSES_CPP) $(VK_SUPPORT_CPP)
$(VERILATOR_INCLUDER) -DVL_INLINE_OPT=inline $^ > $@
$(VM_PREFIX)__ALLboth.o: $(VM_PREFIX)__ALLboth.cpp
$(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $<
ifneq ($(MAKE_MAIN),0)
$(VM_PREFIX): $(VM_PREFIX)__ALLboth.o
$(LINK) $(LDFLAGS) -g $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LIBS) 2>&1
endif

View File

@ -818,6 +818,10 @@ sub compile_vlt_flags {
unshift @verilator_flags, "--debug-partition" if $param{vltmt};
unshift @verilator_flags, "--make gmake" if $param{verilator_make_gmake};
unshift @verilator_flags, "--make cmake" if $param{verilator_make_cmake};
unshift @verilator_flags, "--exe" if
$param{make_main} && $param{verilator_make_gmake};
unshift @verilator_flags, "../".$self->{main_filename} if
$param{make_main} && $param{verilator_make_gmake};
if (defined $opt_optimize) {
my $letters = "";
if ($opt_optimize =~ /[a-zA-Z]/) {
@ -1060,7 +1064,6 @@ sub compile {
"TEST_OBJ_DIR=$self->{obj_dir}",
"CPPFLAGS_DRIVER=-D".uc($self->{name}),
($self->{verbose} ? "CPPFLAGS_DRIVER2=-DTEST_VERBOSE=1":""),
($param{make_main}?"":"MAKE_MAIN=0"),
($param{benchmark}?"OPT_FAST=-O2":""),
"$self->{VM_PREFIX}", # bypass default rule, as we don't need archive
($param{make_flags}||""),

View File

@ -31,7 +31,6 @@ mkdir $child_dir;
"make", "-f".getcwd()."/Makefile_obj",
"CPPFLAGS_DRIVER=-D".uc($self->{name}),
($opt_verbose ? "CPPFLAGS_DRIVER2=-DTEST_VERBOSE=1":""),
"MAKE_MAIN=0",
"VM_PREFIX=$self->{VM_PREFIX}_child",
"V$self->{name}_child__ALL.a", # bypass default rule, make archive
($param{make_flags}||""),

View File

@ -9,12 +9,16 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(vlt => 1);
$Self->{make_main} = 0;
$Self->{make_top_shell} = 0;
compile (
verilator_flags2 => ["--protect-lib",
"secret",
"--protect-key",
"SECRET_FAKE_KEY"],
verilator_make_gcc => 0,
verilator_make_gmake => 0,
);
run(cmd=>["make",

View File

@ -14,8 +14,7 @@ unlink("$Self->{obj_dir}/t_sys_file_basic_test.log");
compile(
v_flags2 => ['+incdir+../include'],
# Build without cached objects, see bug363
verilator_flags2 => ["--exe ../$Self->{main_filename}"],
make_flags => 'MAKE_MAIN=0 VM_PARALLEL_BUILDS=0',
make_flags => 'VM_PARALLEL_BUILDS=0',
);
execute(