Skip to content

Commit 014dda9

Browse files
committed
riscv: run tests in QEMU
Not everything is supported right now, but these tests should make sure that things that work now won't break in the future.
1 parent 34ee388 commit 014dda9

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.circleci/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ commands:
262262
ln -s $PWD/llvm-build/bin/clang-9 /usr/local/bin/clang-9
263263
- run:
264264
name: "Test TinyGo"
265-
command: make test
265+
command: |
266+
make gen-device-sifive # needed for testing
267+
make test
266268
- run:
267269
name: "Build TinyGo release"
268270
command: |

azure-pipelines.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ jobs:
5252
script: |
5353
export PATH="/c/Go1.13/bin:$PATH:./llvm-build/bin:/c/Program Files/qemu"
5454
unset GOROOT
55+
make gen-device-sifive # needed for testing
56+
qemu-system-riscv32 --version
5557
make test
5658
- task: Bash@3
5759
displayName: Build TinyGo release tarball

main_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ func TestCompiler(t *testing.T) {
5353
runPlatTests("cortex-m-qemu", matches, t)
5454
})
5555

56+
if runtime.GOOS == "windows" {
57+
t.Run("EmulatedHiFive1", func(t *testing.T) {
58+
runPlatTests("hifive1-qemu", matches, t)
59+
})
60+
}
61+
5662
if runtime.GOOS == "linux" {
5763
t.Run("ARMLinux", func(t *testing.T) {
5864
runPlatTests("arm--linux-gnueabihf", matches, t)
@@ -78,6 +84,15 @@ func runPlatTests(target string, matches []string, t *testing.T) {
7884
// run all tests on host
7985
case target == "cortex-m-qemu":
8086
// all tests are supported
87+
case target == "hifive1-qemu":
88+
if path == filepath.Join("testdata", "coroutines.go") || path == filepath.Join("testdata", "channel.go") || path == filepath.Join("testdata", "interface.go") {
89+
// time.Sleep does not work yet in QEMU?
90+
continue
91+
}
92+
if path == filepath.Join("testdata", "cgo")+string(filepath.Separator) {
93+
// CGo doesn't work yet for some reason.
94+
continue
95+
}
8196
default:
8297
// cross-compilation of cgo is not yet supported
8398
if path == filepath.Join("testdata", "cgo")+string(filepath.Separator) {

0 commit comments

Comments
 (0)