From f4fe48b9ec552aa67dd73768d7a3cac0f9a2d824 Mon Sep 17 00:00:00 2001 From: Julie Schwartz Date: Sat, 6 Apr 2024 12:46:54 +1300 Subject: [PATCH 1/3] GitHub CI: Include macOS 14 VM in testing Now that GitHub supports macos-14 as a target, include it in the matrix for building/testing BSC and for building the docs. And have the testing of the latest GHC be done on macos-14. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a0fcb5c..496f1f83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: build-and-test-macos: strategy: matrix: - os: [ macos-11, macos-12, macos-13 ] + os: [ macos-11, macos-12, macos-13, macos-14 ] fail-fast: false name: "Build/Test: ${{ matrix.os }}" uses: ./.github/workflows/build-and-test-macos.yml @@ -65,7 +65,7 @@ jobs: name: "Build/Test: GHC latest macOS" uses: ./.github/workflows/build-and-test-macos.yml with: - os: macos-12 + os: macos-14 ghc_version: 9.8.2 hls_version: 2.7.0.0 secrets: inherit @@ -111,7 +111,7 @@ jobs: build-doc-macOS: strategy: matrix: - os: [ macos-11, macos-12, macos-13 ] + os: [ macos-11, macos-12, macos-13, macos-14 ] fail-fast: false name: "Build doc: ${{ matrix.os }}" runs-on: ${{ matrix.os }} From 45460624fed9f28223c2a26747e9a3b8a847a8bc Mon Sep 17 00:00:00 2001 From: Julie Schwartz Date: Sat, 6 Apr 2024 13:13:40 +1300 Subject: [PATCH 2/3] GitHub CI: Install pyyaml via brew not pip, for macOS 14+ Installing with pip3 on the macos-14 VM gives an error that the python environment is externally managed. It suggests using brew to install packages, or else to create a virtual environment (with "venv"), or use pipx to manage a virtual environment for you. Unfortunately, the brew install doesn't seem to be visible on the older VMs. It may be possible to use the same "venv" commands across VMs, but it's easy enough to check the macOS version and use brew or pip3 to install as appropriate. --- .github/workflows/build-and-test-macos.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test-macos.yml b/.github/workflows/build-and-test-macos.yml index 2c5c6b45..5ffb8bc5 100644 --- a/.github/workflows/build-and-test-macos.yml +++ b/.github/workflows/build-and-test-macos.yml @@ -88,7 +88,12 @@ jobs: - name: Test Haskell Language Server run: | ghcup install hls ${{ inputs.hls_version }} - pip3 install pyyaml + macos_ver=$(sw_vers -productVersion | cut -d '.' -f 1) + if [ "$macos_ver" -ge "14" ]; then + brew install pyyaml + else + pip3 install pyyaml + fi python3 util/haskell-language-server/gen_hie.py pushd src/comp haskell-language-server-${{ inputs.ghc_version }} bsc.hs From 6a5f8b1bcdbdbc6831271662e9ab4c818781c508 Mon Sep 17 00:00:00 2001 From: Julie Schwartz Date: Sat, 6 Apr 2024 22:10:18 +1300 Subject: [PATCH 3/3] 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. --- testsuite/bsc.misc/divmod/divmod.exp | 8 ++++++-- .../bsc.names/portRenaming/misc/misc.exp | 19 +------------------ testsuite/config/unix.exp | 10 ++++++++++ testsuite/suitemake.mk | 7 ++++++- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/testsuite/bsc.misc/divmod/divmod.exp b/testsuite/bsc.misc/divmod/divmod.exp index 0e0c6666..cc82f103 100644 --- a/testsuite/bsc.misc/divmod/divmod.exp +++ b/testsuite/bsc.misc/divmod/divmod.exp @@ -7,13 +7,17 @@ test_c_veri_bsv_modules_options DivMod {} "-no-use-negate" test_c_veri_bsv_modules_options DivModWide {} "-no-use-negate" sysDivModWide.out.expected -# expected status for darwin rh3 and rh4 set fpe [list SIGFPE 8 136] # Test that divide-by-zero produces some failure in Bluesim compile_object_pass DivideByZero.bsv sysDivideByZero link_objects_pass sysDivideByZero sysDivideByZero -sim_output_status sysDivideByZero $fpe +if [string equal [which_mach] "arm64"] { + # This is an expected bug (GitHub #688) + sim_output_status sysDivideByZero 0 +} else { + sim_output_status sysDivideByZero $fpe +} # In Verilog it silently produces x's test_veri_only_bsv DivideByZero sysDivideByZero.v.out.expected diff --git a/testsuite/bsc.names/portRenaming/misc/misc.exp b/testsuite/bsc.names/portRenaming/misc/misc.exp index c24d4cc7..0cae78f6 100644 --- a/testsuite/bsc.names/portRenaming/misc/misc.exp +++ b/testsuite/bsc.names/portRenaming/misc/misc.exp @@ -6,26 +6,9 @@ if { $vtest == 1 } { -proc test_iverilog_version_and_machine_type {} { - global verilog_compiler - set code [catch "exec $verilog_compiler -V 2>/dev/null | head -1" x2] - set mach [exec uname -m] - set x86_64 [string first "x86_64" $mach] - set icarus [string first "Icarus Verilog" $x2] - set version [string first "0.8.3" $x2] - return [expr {$x86_64 == -1 || $icarus == -1 || $version == -1}] -} - compile_object_pass Small1.bsv compile_verilog_pass Small1.bsv -if [ test_iverilog_version_and_machine_type ] { - # this test is known to fail for x86_64 for iverilog 0.8.3 - # due to a bug (assertion failure) in iverilog - link_verilog_no_main_pass {Tb1.v mkSmallTest1.v} Tb1 -} else { - verbose -log "Skipping Tb1 verilog link test" -} - +link_verilog_no_main_pass {Tb1.v mkSmallTest1.v} Tb1 compile_object_pass Small2.bsv compile_verilog_pass Small2.bsv diff --git a/testsuite/config/unix.exp b/testsuite/config/unix.exp index 6a456ab7..93e41c8e 100644 --- a/testsuite/config/unix.exp +++ b/testsuite/config/unix.exp @@ -200,6 +200,15 @@ proc which_os {} { return $env(OSTYPE) } +proc which_mach {} { + global env + if {! [info exists env(MACHTYPE)]} { + perror "can't find architecture -- set MACHTYPE to the name" + exit 1 + } + return $env(MACHTYPE) +} + # return true if the given Bluetcl packahe is available proc bluetcl_package_available { pkg } { global bluetcl @@ -3209,6 +3218,7 @@ verbose -log "Do internal checks is [do_internal_checks]" 1 # System settings verbose -log "Operating system is [which_os]" 1 +verbose -log "Architecture is [which_mach]" 1 # Assume 64-bit set ::is64 "64" diff --git a/testsuite/suitemake.mk b/testsuite/suitemake.mk index 5c81fe43..b70195a6 100644 --- a/testsuite/suitemake.mk +++ b/testsuite/suitemake.mk @@ -7,6 +7,9 @@ ifneq ($(TEST_OSTYPE), $(findstring $(TEST_OSTYPE), Linux Darwin)) $(error TEST_OSTYPE environment not recognized: $(TEST_OSTYPE)) endif +TEST_MACHTYPE ?= $(shell $(CONFDIR)/../platform.sh machtype) +# TODO: Test for expected architectures? + MAKEFLAGS += --no-print-directory # Make sure that the environments are consistent @@ -64,7 +67,9 @@ RUNTESTENV = MAKEFLAGS= BSCTEST=1 \ BSC_VERILOG_SIM=$(TEST_BSC_VERILOG_SIM) \ TEST_CONFIG_DIR=${TEST_CONFIG} \ BLUETCL=$(TEST_BLUETCL) \ - OSTYPE=$(TEST_OSTYPE) LC_ALL=$(LC_ALL) \ + OSTYPE=$(TEST_OSTYPE) \ + MACHTYPE=$(TEST_MACHTYPE) \ + LC_ALL=$(LC_ALL) \ SYSTEMC_INC=$(TEST_SYSTEMC_INC) \ SYSTEMC_LIB=$(TEST_SYSTEMC_LIB) \ SYSTEMC_CXXFLAGS=$(TEST_SYSTEMC_CXXFLAGS) \