@@ -55,6 +55,14 @@ func TestCompiler(t *testing.T) {
5555 runPlatTests ("cortex-m-qemu" , matches , t )
5656 })
5757
58+ if runtime .GOOS == "windows" || runtime .GOOS == "darwin" {
59+ // Note: running only on Windows and macOS because Linux usually has an
60+ // outdated QEMU version that doesn't support RISC-V yet.
61+ t .Run ("EmulatedHiFive1" , func (t * testing.T ) {
62+ runPlatTests ("hifive1-qemu" , matches , t )
63+ })
64+ }
65+
5866 if runtime .GOOS == "linux" {
5967 t .Run ("ARMLinux" , func (t * testing.T ) {
6068 runPlatTests ("arm--linux-gnueabihf" , matches , t )
@@ -83,6 +91,11 @@ func runPlatTests(target string, matches []string, t *testing.T) {
8391 // run all tests on host
8492 case target == "cortex-m-qemu" :
8593 // all tests are supported
94+ case target == "hifive1-qemu" :
95+ if path == filepath .Join ("testdata" , "cgo" )+ string (filepath .Separator ) {
96+ // CGo doesn't work yet for some reason.
97+ continue
98+ }
8699 default :
87100 // cross-compilation of cgo is not yet supported
88101 if path == filepath .Join ("testdata" , "cgo" )+ string (filepath .Separator ) {
@@ -203,7 +216,11 @@ func runTest(path, target string, t *testing.T) {
203216 }
204217 close (runComplete )
205218
206- if ranTooLong {
219+ if ranTooLong && target != "hifive1-qemu" {
220+ // Note: the hifive1-qemu exception is here because QEMU does
221+ // not yet include the SiFive test finisher used to exit tests.
222+ // https://github.com/sifive/riscv-qemu/commit/0eec372a36b7237caf16ec7c7646a202faba5fdb
223+ // It's a crude hack, but it makes RISC-V testable.
207224 stdout .WriteString ("--- test ran too long, terminating...\n " )
208225 }
209226
0 commit comments