aboutsummaryrefslogtreecommitdiffhomepage
path: root/main_test.go
AgeCommit message (Collapse)Author
2024-08-17ci: use Go 1.23Ayke van Laethem
2024-08-17compiler: add support for Go 1.23 range-over-funcAyke van Laethem
2024-08-12mips: add GOMIPS=softfloat supportAyke van Laethem
Previously, the compiler would default to hardfloat. This is not supported by some MIPS CPUs. This took me much longer than it should have because of a quirk in the LLVM Mips backend: if the target-features string is not set (like during LTO), the Mips backend picks the first function in the module and uses that. Unfortunately, in the case of TinyGo this first function is `llvm.dbg.value`, which is an LLVM intrinsic and doesn't have the target-features string. I fixed it by adding a `-mllvm -mattr=` flag to the linker.
2024-08-11builder: interpret linker error messagesAyke van Laethem
This shows nicely formatted error messages for missing symbol names and for out-of-flash, out-of-RAM conditions (on microcontrollers with limited flash/RAM). Unfortunately the missing symbol name errors aren't available on Windows and WebAssembly because the linker doesn't report source locations yet. This is something that I could perhaps improve in LLD.
2024-07-22all: add linux/mipsle supportAyke van Laethem
This adds linux/mipsle (little endian Mips) support to TinyGo. It also adds experimental linux/mips (big-endian) support. It doesn't quite work yet, some parts of the standard library (like the reflect package) currently seem to assume a little-endian system.
2024-07-20diagnostics: move diagnostic printing to a new packageAyke van Laethem
This is a refactor, which should (in theory) not change the behavior of the compiler. But since this is a pretty large change, there is a chance there will be some regressions. For that reason, the previous commits added a bunch of tests to make sure most error messages will not be changed due to this refactor.
2024-07-13all: add testing for compiler error messagesAyke van Laethem
This is needed for some improvements I'm going to make next. This commit also refactors error handling slightly to make it more easily testable, this should hopefully not result in any actual changes in behavior.
2024-07-08main_test: Diff expected and actual results when tests fail (#4288)L. Pereira
Uses a vendored "internal/diff" from Big Go to show the differences between the expected and actual outputs when tests fail. Signed-off-by: L. Pereira <[email protected]>
2024-07-02wasi preview 2 support (#4027)Damian Gryski
* all: wasip2 support Co-authored-by: Randy Reddig <[email protected]>
2024-06-28test: support GOOS/GOARCH pairs in the -target flagAyke van Laethem
This means it's possible to test just a particular OS/arch with a command like this: go test -run=Build -target=linux/arm I found it useful while working on MIPS support.
2024-03-27all: change references of 'wasi' to 'wasip1'; test hygieneRandy Reddig
2024-03-19all: move -panic=trap support to the compiler/runtimeAyke van Laethem
Support for `-panic=trap` was previously a pass in the optimization pipeline. This change moves it to the compiler and runtime, which in my opinion is a much better place. As a side effect, it also fixes https://github.com/tinygo-org/tinygo/issues/4161 by trapping inside runtime.runtimePanicAt and not just runtime.runtimePanic. This change also adds a test for the list of imported functions. This is a more generic test where it's easy to add more tests for WebAssembly file properties, such as exported functions.
2024-01-19loader: make sure Go version is plumbed throughAyke van Laethem
This fixes the new loop variable behavior in Go 1.22. Specifically: * The compiler (actually, the x/tools/go/ssa package) now correctly picks up the Go version. * If a module doesn't specify the Go version, the current Go version (from the `go` tool and standard library) is used. This fixes `go run`. * The tests in testdata/ that use a separate directory are now actually run in that directory. This makes it possible to use a go.mod file there. * There is a test to make sure old Go modules still work with the old Go behavior, even on a newer Go version.
2024-01-18compiler: update golang.org/x/tools/go/ssa packageAyke van Laethem
This update includes support for the new range loops over integers.
2023-08-17wasm: add support for GOOS=wasip1Ayke van Laethem
This adds true GOOS=wasip1 support in addition to our existing -target=wasi support. The old support for WASI isn't removed, but should be treated as deprecated and will likely be removed eventually to reduce the test burden.
2023-08-04compiler: add min and max builtin supportAyke van Laethem
2023-03-31main: stuff test runner options into their own structDamian Gryski
Fixes #2406
2023-02-26ci: add AVR timers testAyke van Laethem
Add the timers test because they now work correctly on AVR, probably as a result of the reflect refactor: https://github.com/tinygo-org/tinygo/pull/2640 I've also updated a few of the other tests to indicate the new status and why they don't work. It's no longer because of compiler errors, but because of linker or runtime errors (which is at least some progress). For example, I found that testdata/reflect.go works if you disable `testAppendSlice` and increase the stack size.
2023-01-15test: print package name when compilation failedAyke van Laethem
Before this patch, a compile error would prevent the 'ok' or 'FAIL' line to be printed. That's unexpected. This patch changes the code in such a way that it's obvious a test result line is printed in all cases. To be able to also print the package name, I had to make sure the build result is passed through everywhere even on all the failure paths. This results in a bit of churn, but it's all relatively straightforward. Found while working on Go 1.20.
2022-11-25all: re-enable AVR testsAyke van Laethem
I have some confidence they'll work reliably now.
2022-11-25avr: add channel testAyke van Laethem
It is working now, so add it as a test. Not sure why, maybe the ThinLTO change fixed something here?
2022-08-30all: drop support for Go 1.16 and Go 1.17Ayke van Laethem
2022-08-23runtime: add support for time.NewTimer and time.NewTickerKenneth Bell
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.
2022-08-20src/testing: add support for -benchmemDamian Gryski
2022-08-20make interp timeout configurable from command lineDamian Gryski
2022-08-09Fix skip message for missing emulatorsElliott Sales de Andrade
2022-08-07all: update _test.go files for ioutil changesDamian Gryski
2022-06-19avr: add support for recover()Ayke van Laethem
You can see that it works with the following command: tinygo run -target=simavr ./testdata/recover.go This also gets the following tests to pass again: go test -run=Build -target=simavr -v Adding support for AVR was a bit more compliated because it's also necessary to save and restore the Y register.
2022-06-16compiler: implement recover() built-in functionAyke van Laethem
2022-06-11compiler: add support for type parameters (aka generics)Ayke van Laethem
...that was surprisingly easy.
2022-06-11fix: fixes tinygo test ./... syntax.José Carlos Chávez
2022-05-30all: add support for the embed packageAyke van Laethem
2022-05-18avr: enable testdata/map.goAyke van Laethem
The test needs a few changes to support low-memory devices but other than that, it works fine.
2022-05-18avr: use compiler-rtAyke van Laethem
This change adds support for compiler-rt, which supports float64 (unlike libgcc for AVR). This gets a number of tests to pass that require float64 support. We're still using libgcc with this change, but libgcc will probably be removed eventually once AVR support in compiler-rt is a bit more mature. I've also pushed a fix for a small regression in our xtensa_release_14.0.0-patched LLVM branch that has also been merged upstream. Without it, a floating point comparison against zero always returns true which is certainly a bug. It is necessary to correctly print floating point values.
2022-05-18avr: get `go test -target=simavr` to workAyke van Laethem
This patch changes two things: 1. It changes the default stack size. Without this change, the goroutine.go test doesn't pass (apparently there's some memory corruption). 2. It moves the excluded tests so that they are skipped with a regular `-target=simavr`, not just when running all tests (without `-target`).
2022-04-28testdata: move map growth test to map.goDamian Gryski
2022-04-28testdata: add test for mapgrowth logicDamian Gryski
2022-04-28all: make emulator command a string instead of a []stringAyke van Laethem
This matches the flash-command and is generally a bit easier to work with. This commit also prepares for allowing multiple formats to be used in the emulator command, which is necessary for the esp32.
2022-04-20main: use shared code for both run and test subcommandsAyke van Laethem
This means that we don't need duplicate code to pass parameters to wasmtime and that the following actually produces verbose output (it didn't before this commit): tinygo test -v -target=cortex-m-qemu math
2022-04-16main: unify how a given program runsAyke van Laethem
Refactor the code that runs a binary. With this change, the slightly duplicated code between `tinygo run` and `TestBuild` is merged into one. Apart from deduplication (which doesn't even gain much in terms of lines removed), it makes it much easier to maintain this code. In particular, passing command line arguments to programs to run now becomes trivial. A future change might also merge `buildAndRun` and `runPackageTest`, which currently have some overlap. In particular, flags like `-test.v` don't need to be special-cased for wasmtime.
2022-04-06main_test.go: fork testdata/testing.go for go 1.18Dan Kegel
2022-04-05Revert "testdata: add test for mapgrowth logic"Ron Evans
This reverts commit 73571dd423f343a0126e65a8149bf5ac83ee3f55.
2022-04-04testdata: add test for mapgrowth logicDamian Gryski
2022-02-07Fix cross-Linux setup on non-amd64 archesElliott Sales de Andrade
In that case, an emulator is needed for amd64, and tests should be run for amd64 as a _cross_ test.
2022-01-17main: replace {root} for compiler tests tooDamian Gryski
2022-01-16main (test): skip AVR testsNia Waldvogel
The AVR tests fail inconsistently now due to non-deterministic backend bugs. This disables them until this can be understood and fixed.
2022-01-15testing: print durationDan Kegel
TODO: account for time taken in Cleanup().
2022-01-14main (test): reorganize runTestWithConfigNia Waldvogel
This change updates the test runner to use exec.CommandContext for timeout handling. The timeout has been raised to 1 minute to handle slow machines and (hopefully) Windows. The test run also now acquires the semaphore to reserve CPU time for the test and (hopefully?????) reduce the number of timeouts in Windows CI.
2022-01-14compiler: work around AVR atomics bugsNia Waldvogel
The AVR backend has several critical atomics bugs. This change invokes libcalls for all atomic operations on AVR. Now `testdata/atomic.go` compiles and runs correctly.
2022-01-12testing: benchmarks: implement -benchtime flagDan Kegel