diff options
author | Ayke van Laethem <[email protected]> | 2021-11-05 13:23:08 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-11-16 11:08:30 +0100 |
commit | 869e917dc6959445fac6ee4d93cd10c98ab445e5 (patch) | |
tree | 451d6c4b9a07b60a58f9db5d865720bf95498904 /main_test.go | |
parent | 41bcad9c194d92ba90f6f42f680087efa4f0e998 (diff) | |
download | tinygo-869e917dc6959445fac6ee4d93cd10c98ab445e5.tar.gz tinygo-869e917dc6959445fac6ee4d93cd10c98ab445e5.zip |
all: add support for windows/amd64
This uses Mingw-w64, which seems to be the de facto standard for porting
Unixy programs to Windows.
Diffstat (limited to 'main_test.go')
-rw-r--r-- | main_test.go | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/main_test.go b/main_test.go index 8fd286bef..557ac2bfa 100644 --- a/main_test.go +++ b/main_test.go @@ -71,11 +71,9 @@ func TestCompiler(t *testing.T) { return } - if runtime.GOOS != "windows" { - t.Run("Host", func(t *testing.T) { - runPlatTests(optionsFromTarget(""), tests, t) - }) - } + t.Run("Host", func(t *testing.T) { + runPlatTests(optionsFromTarget(""), tests, t) + }) if testing.Short() { return @@ -113,10 +111,6 @@ func TestCompiler(t *testing.T) { // Test a few build options. t.Run("build-options", func(t *testing.T) { - if runtime.GOOS == "windows" { - // These tests assume a host that is supported by TinyGo. - t.Skip("can't test build options on Windows") - } t.Parallel() // Test with few optimizations enabled (no inlining, etc). @@ -298,6 +292,9 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c // Build the test binary. binary := filepath.Join(tmpdir, "test") + if spec.GOOS == "windows" { + binary += ".exe" + } err = runBuild("./"+path, binary, &options) if err != nil { printCompilerError(t.Log, err) @@ -339,7 +336,13 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c } go func() { // Terminate the process if it runs too long. - timer := time.NewTimer(10 * time.Second) + maxDuration := 10 * time.Second + if runtime.GOOS == "windows" { + // For some reason, tests on Windows can take around + // 30s to complete. TODO: investigate why and fix this. + maxDuration = 40 * time.Second + } + timer := time.NewTimer(maxDuration) select { case <-runComplete: timer.Stop() @@ -369,7 +372,7 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c t.Log("failed to run:", err) fail = true } else if !bytes.Equal(expected, actual) { - t.Log("output did not match") + t.Logf("output did not match (expected %d bytes, got %d bytes):", len(expected), len(actual)) fail = true } |