Skip to content

Commit 6a5f8b1

Browse files
committed
Testsuite: Add "which_mach" and use in div-by-zero tests
The divmod tests fail on arm64, because the tests are expecting SIGFPE error to be raised, but ARM does not. This may need to be addressed in the code generation for Bluesim, but in the meantime, update the test to expect no error when the MACHTYPE is arm64. A new "which_mach" procedure in the testsuite allows querying MACHTYPE. Found an old test that was calling "uname -m" to get the machtype, and test for x86_64. This could be replaced with a call to "which_mach", but the use was to workaround a bug in iverilog 0.8.3, which is older than we need to support, so instead the code is just removed.
1 parent 4546062 commit 6a5f8b1

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

testsuite/bsc.misc/divmod/divmod.exp

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ test_c_veri_bsv_modules_options DivMod {} "-no-use-negate"
77

88
test_c_veri_bsv_modules_options DivModWide {} "-no-use-negate" sysDivModWide.out.expected
99

10-
# expected status for darwin rh3 and rh4
1110
set fpe [list SIGFPE 8 136]
1211

1312
# Test that divide-by-zero produces some failure in Bluesim
1413
compile_object_pass DivideByZero.bsv sysDivideByZero
1514
link_objects_pass sysDivideByZero sysDivideByZero
16-
sim_output_status sysDivideByZero $fpe
15+
if [string equal [which_mach] "arm64"] {
16+
# This is an expected bug (GitHub #688)
17+
sim_output_status sysDivideByZero 0
18+
} else {
19+
sim_output_status sysDivideByZero $fpe
20+
}
1721

1822
# In Verilog it silently produces x's
1923
test_veri_only_bsv DivideByZero sysDivideByZero.v.out.expected

testsuite/bsc.names/portRenaming/misc/misc.exp

+1-18
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,9 @@
66

77
if { $vtest == 1 } {
88

9-
proc test_iverilog_version_and_machine_type {} {
10-
global verilog_compiler
11-
set code [catch "exec $verilog_compiler -V 2>/dev/null | head -1" x2]
12-
set mach [exec uname -m]
13-
set x86_64 [string first "x86_64" $mach]
14-
set icarus [string first "Icarus Verilog" $x2]
15-
set version [string first "0.8.3" $x2]
16-
return [expr {$x86_64 == -1 || $icarus == -1 || $version == -1}]
17-
}
18-
199
compile_object_pass Small1.bsv
2010
compile_verilog_pass Small1.bsv
21-
if [ test_iverilog_version_and_machine_type ] {
22-
# this test is known to fail for x86_64 for iverilog 0.8.3
23-
# due to a bug (assertion failure) in iverilog
24-
link_verilog_no_main_pass {Tb1.v mkSmallTest1.v} Tb1
25-
} else {
26-
verbose -log "Skipping Tb1 verilog link test"
27-
}
28-
11+
link_verilog_no_main_pass {Tb1.v mkSmallTest1.v} Tb1
2912

3013
compile_object_pass Small2.bsv
3114
compile_verilog_pass Small2.bsv

testsuite/config/unix.exp

+10
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ proc which_os {} {
200200
return $env(OSTYPE)
201201
}
202202

203+
proc which_mach {} {
204+
global env
205+
if {! [info exists env(MACHTYPE)]} {
206+
perror "can't find architecture -- set MACHTYPE to the name"
207+
exit 1
208+
}
209+
return $env(MACHTYPE)
210+
}
211+
203212
# return true if the given Bluetcl packahe is available
204213
proc bluetcl_package_available { pkg } {
205214
global bluetcl
@@ -3209,6 +3218,7 @@ verbose -log "Do internal checks is [do_internal_checks]" 1
32093218
# System settings
32103219

32113220
verbose -log "Operating system is [which_os]" 1
3221+
verbose -log "Architecture is [which_mach]" 1
32123222

32133223
# Assume 64-bit
32143224
set ::is64 "64"

testsuite/suitemake.mk

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ ifneq ($(TEST_OSTYPE), $(findstring $(TEST_OSTYPE), Linux Darwin))
77
$(error TEST_OSTYPE environment not recognized: $(TEST_OSTYPE))
88
endif
99

10+
TEST_MACHTYPE ?= $(shell $(CONFDIR)/../platform.sh machtype)
11+
# TODO: Test for expected architectures?
12+
1013
MAKEFLAGS += --no-print-directory
1114

1215
# Make sure that the environments are consistent
@@ -64,7 +67,9 @@ RUNTESTENV = MAKEFLAGS= BSCTEST=1 \
6467
BSC_VERILOG_SIM=$(TEST_BSC_VERILOG_SIM) \
6568
TEST_CONFIG_DIR=${TEST_CONFIG} \
6669
BLUETCL=$(TEST_BLUETCL) \
67-
OSTYPE=$(TEST_OSTYPE) LC_ALL=$(LC_ALL) \
70+
OSTYPE=$(TEST_OSTYPE) \
71+
MACHTYPE=$(TEST_MACHTYPE) \
72+
LC_ALL=$(LC_ALL) \
6873
SYSTEMC_INC=$(TEST_SYSTEMC_INC) \
6974
SYSTEMC_LIB=$(TEST_SYSTEMC_LIB) \
7075
SYSTEMC_CXXFLAGS=$(TEST_SYSTEMC_CXXFLAGS) \

0 commit comments

Comments
 (0)