aboutsummaryrefslogtreecommitdiffhomepage
path: root/main_test.go
diff options
context:
space:
mode:
authorKenneth Bell <[email protected]>2022-07-02 17:19:36 +0100
committerRon Evans <[email protected]>2022-08-23 12:37:25 +0200
commit24b45555bd9c82a5486f3063b32c262bfa420253 (patch)
tree8ce811a7b94dcb3d7048b40d6cdc831d63f2356c /main_test.go
parent80c17c0f320ca54a812d68f4077b0dda49229a62 (diff)
downloadtinygo-24b45555bd9c82a5486f3063b32c262bfa420253.tar.gz
tinygo-24b45555bd9c82a5486f3063b32c262bfa420253.zip
runtime: add support for time.NewTimer and time.NewTicker
This commit adds support for time.NewTimer and time.NewTicker. It also adds support for the Stop() method on time.Timer, but doesn't (yet) add support for the Reset() method. The implementation has been carefully written so that programs that don't use these timers will normally not see an increase in RAM or binary size. None of the examples in the drivers repo change as a result of this commit. This comes at the cost of slightly more complex code and possibly slower execution of the timers when they are used.
Diffstat (limited to 'main_test.go')
-rw-r--r--main_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/main_test.go b/main_test.go
index 6bd79347b..a6925cea9 100644
--- a/main_test.go
+++ b/main_test.go
@@ -65,6 +65,7 @@ func TestBuild(t *testing.T) {
"stdlib.go",
"string.go",
"structs.go",
+ "timers.go",
"zeroalloc.go",
}
_, minor, err := goenv.GetGorootVersion(goenv.Get("GOROOT"))
@@ -180,6 +181,14 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
}
for _, name := range tests {
+ if options.GOOS == "linux" && (options.GOARCH == "arm" || options.GOARCH == "386") {
+ switch name {
+ case "timers.go":
+ // Timer tests do not work because syscall.seek is implemented
+ // as Assembly in mainline Go and causes linker failure
+ continue
+ }
+ }
if options.Target == "simavr" {
// Not all tests are currently supported on AVR.
// Skip the ones that aren't.
@@ -208,6 +217,11 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
// CGo does not work on AVR.
continue
+ case "timers.go":
+ // Doesn't compile:
+ // panic: compiler: could not store type code number inside interface type code
+ continue
+
default:
}
}