Граф коммитов

2542 коммитов

Автор SHA1 Сообщение Дата
Damian Gryski
c87bb0e9cc pass more --dirs to wasmtime so it can read the entire module tree
This allows compress/flate to pass on -target=wasi out of the box

Fixes #2367
2022-01-15 17:29:33 +01:00
Nia Waldvogel
6afceb5621 os (wasi): fix opening files in read-only mode
On wasi, O_RDWR is a bitwise or of read and write mode.
As a result, the bit test result was incorrect, and rewrote it to read-write mode.
However, the bit tests are not necessary (and upstream Go does not use them).
This passes the flags through directly.
2022-01-15 10:26:19 -05:00
Nia Waldvogel
aa053b5fb0 interp: always run atomic and volatile loads/stores at runtime 2022-01-15 14:40:14 +01:00
Dan Kegel
0ed34e3cb0 testing: print duration
TODO: account for time taken in Cleanup().
2022-01-15 10:38:22 +01:00
Dan Kegel
78a36f7724 testing: nudge functions closer to upstream order, to make diffing easier. No functional change. 2022-01-15 10:38:22 +01:00
Nia Waldvogel
a743580734 main (test): reorganize runTestWithConfig
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-14 14:09:37 -05:00
Nia Waldvogel
e2178ce682 compiler: work around AVR atomics bugs
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-14 13:49:20 +01:00
Elliott Sales de Andrade
b2ef7299b7 arm: Explicitly disable unwind tables
Some clang builds (e.g., Fedora's) enable unwind tables by default. As
tinygo does not need nor support them, that leads to undefined symbols
when linking.
2022-01-14 07:34:36 +01:00
Kenneth Bell
14ce531498 stm32: add blues wireless swan 2022-01-13 07:56:08 +01:00
Dan Kegel
21c76c0cb0 testing: benchmarks: implement -benchtime flag 2022-01-12 21:49:27 +01:00
Dan Kegel
fbd72a4b2c testing: benchmarks: -bench: allow filtering subbenchmarks
Pull in testing/match.go verbatim from upstream and use it to filter benchmarks.

TODO: also update testing.go to filter tests similarly.
2022-01-12 21:49:27 +01:00
Pure White
93e0636c03
feat: support build on darwin arm64 (#2439)
main: support build on darwin arm64
2022-01-12 12:10:08 +01:00
Dan Kegel
ef77b645b9 testing: implement testing.Cleanup
Also reorder and regroup common's fields slightly to match upstream.

TODO: pull in more upstream tests once this package is goroutine-safe
2022-01-12 08:59:09 +01:00
Dan Kegel
0b939f93bc testing: gather duplicate code into tRunner
No change in behavior, just preparing for next commit, and gently nudging code closer to upstream.
2022-01-12 08:59:09 +01:00
Dan Kegel
798085e866 testdata/testing.go: update so it can be run with go 1.16 for comparison 2022-01-12 08:59:09 +01:00
Dan Kegel
69bf6e3c89 interp: show breadcrumbs to help developer find slow init functions; raise timeout. 2022-01-11 22:09:15 +01:00
Elliott Sales de Andrade
8f8d83bffe Run go mod tidy 2022-01-11 16:09:45 +01:00
Dan Kegel
998f01608c os: implement file.Seek, add smoke test 2022-01-11 14:23:14 +01:00
Cameron Eagans
84279ab2ec
Add JSON output to info command (#2501)
main: Add json output flag to tinygo info
2022-01-11 13:02:58 +01:00
Dan Kegel
a888d6245d testing: replace spaces with underscores in test/benchmark names, as upstream does 2022-01-11 11:53:24 +01:00
Dan Kegel
f80efa5b8b testing: support b.SetBytes(); implement sub-benchmarks. 2022-01-11 11:53:24 +01:00
Dan Kegel
29f7ebc63e os: pull in os.Rename and some of its tests from upstream
Skip part of the test on Windows because of https://github.com/tinygo-org/tinygo/issues/2480

TODO: fix 2480 and unskip test
TODO: pull in rest of upstream tests, fix problems they find

Requested in https://github.com/tinygo-org/tinygo/issues/2109
2022-01-11 09:58:38 +01:00
deadprogram
72e15af1fa ci: use GH action to perform build for macos
Signed-off-by: deadprogram <ron@hybridgroup.com>
2022-01-10 22:50:52 +01:00
sago35
6cb604c752 board: add M5Stamp C3 2022-01-10 11:10:06 +01:00
Nia Waldvogel
cb01d4d63e builder (env): update clang header search path to look in /usr/lib
Arch Linux stores the clang executable seperately from its data, so the search based on the executable does not work.
This change searches /usr/lib as a backup.
2022-01-09 18:46:15 +01:00
Nia Waldvogel
fe21650010 builder (musl): add -fno-stack-protector
Arch Linux has turned on the stack protector by default.
This causes a crash in libc init because the stack protector uses TLS before it is initialized.
2022-01-09 18:46:15 +01:00
Ayke van Laethem
ebd4969cde all: switch to LLVM 13
This adds support for building with `-tags=llvm13` and switches to LLVM
13 for tinygo binaries that are statically linked against LLVM.

Some notes on this commit:

  * Added `-mfloat-abi=soft` to all Cortex-M targets because otherwise
    nrfx would complain that floating point was enabled on Cortex-M0.
    That's not the case, but with `-mfloat-abi=soft` the `__SOFTFP__`
    macro is defined which silences this warning.
    See: https://reviews.llvm.org/D100372
  * Changed from `--sysroot=<root>` to `-nostdlib -isystem <root>` for
    musl because with Clang 13, even with `--sysroot` some system
    libraries are used which we don't want.
  * Changed all `-Xclang -internal-isystem -Xclang` to simply
    `-isystem`, for consistency with the above change. It appears to
    have the same effect.
  * Moved WebAssembly function declarations to the top of the file in
    task_asyncify_wasm.S because (apparently) the assembler has become
    more strict.
2022-01-09 11:04:10 +01:00
Ayke van Laethem
32a7b8cc4e avr: use a stack size of 512 bytes for testing
The goroutine tests are failing with the default 256 byte stack size.
2022-01-09 11:04:10 +01:00
Dan Kegel
b4fa658705 .github: asset-test-linux: show cpuinfo for troubleshooting. 2022-01-07 10:39:30 +01:00
Dan Kegel
ee4e42ba1f src/testing: support -bench option to run benchmarks matching the given pattern. 2022-01-07 10:39:30 +01:00
Dan Kegel
c6678525a9 src/testing/benchmark.go: reorder functions to make diffing against go easier
On the theory that tinygo is tending towards smaller diffs with go...

Also adds placeholder for ReportAllocs(), otherwise zero semantic changes.
2022-01-07 10:39:30 +01:00
Dan Kegel
8d75b58bdf .github: update apt before installing, in case it is stale
Symptom: assert-test-linux failed in https://github.com/tinygo-org/tinygo/runs/4721983373
with following errors:

E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/c/ceph/librados2_15.2.14-0ubuntu0.20.04.1_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/c/ceph/librbd1_15.2.14-0ubuntu0.20.04.1_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-block-extra_4.2-3ubuntu6.18_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-system-common_4.2-3ubuntu6.18_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-system-data_4.2-3ubuntu6.18_all.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-system-arm_4.2-3ubuntu6.18_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/q/qemu/qemu-system-misc_4.2-3ubuntu6.18_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/universe/q/qemu/qemu-user_4.2-3ubuntu6.18_amd64.deb  404  Not Found [IP: 52.154.174.208 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

This usually means those packages have been updated and you have to run apt-get update first, as recommended at
https://github.com/actions/virtual-environments/issues/1757
2022-01-06 16:29:53 +01:00
Dan Kegel
ec97313239 When running tests under wasmtime, provide a fresh TMPDIR.
Also fix a couple os tests that wrote to current directory to write to os.TempDir() instead.

After this, os tests pass in wasi, so add them to the list run by "make tinygo-test-wasi".
2022-01-04 21:43:38 +01:00
Kenneth Bell
e046b23773 stm32l552ze: use supported stlink interface 2022-01-04 20:27:41 +01:00
Kenneth Bell
0099d47002 all: show error if platform has no rng 2022-01-04 20:27:41 +01:00
Kenneth Bell
5c3ad004ab stm32: add more MCUs with h/w RNG 2022-01-04 20:27:41 +01:00
Dan Kegel
61be9189f1 os: add a few upstream tests for Read and ReadAt, fix problems they exposed.
There are more upstream tests to pull in, but this is plenty for today.
2022-01-04 15:45:49 +01:00
Damian Gryski
1e2791b216 src/os: loop in File.ReadAt to handle short reads
This matches what upstream Go does.  This also means len(b) == 0 successfully
reads 0 bytes without any extra logic.  The tests in archive/zip test for this
behaviour.
2022-01-04 15:45:49 +01:00
Nia Waldvogel
d86dd642b3 main (test): add tests to tinygo test 2022-01-03 18:59:19 -05:00
Ayke van Laethem
21b89ef327 compiler: fix emission of large object layouts
Large object layouts don't fit in a pointer-sized integer and therefore
need to be stored in a global instead. However, the way the data was
stored in these globals was not correct for buffers that don't have
pointers near the end. This commit fixes this issue by using math/big
FillBytes() instead of Bytes().

This gets the unicode package to compile on AVR.
2022-01-03 21:22:49 +01:00
Ayke van Laethem
39c8711332 compiler: add correct debug location to init instructions
This adds proper debug locations to interp errors. For example, when
trying to use the unicode package on AVR (which currently doesn't work),
the following error is shown with this commit:

    /usr/local/go1.17/src/unicode/casetables.go:13:31: interp: ptrtoint integer size does not equal pointer size

Before this commit, that error was a lot less helpful:

    unicode/<init>:13:31: interp: ptrtoint integer size does not equal pointer size
2022-01-03 17:58:02 +01:00
Nia Waldvogel
edc9319e0d main (tinygo test): fail tests on build error
This fixes a bug where build errors (e.g. linker errors) would be ignored by tinygo test.
2022-01-03 10:12:14 -05:00
Ayke van Laethem
fcd88356db avr: fix time.Sleep() in init code
In the early days of TinyGo, the idea of `postinit` was to enable
interrupts only after initializers have run. Which kind of makes
sense... except that `time.Sleep` is allowed in init code and
`time.Sleep` requires interrupts to be enabled. Therefore, interrupts
must be enabled while initializers are being run.

This commit simply moves the enabling of interrupts to a point right
before running package initializers. It also removes `runtime.postinit`,
which is not necessary anymore (and was only used on AVR).
2022-01-02 19:41:44 +01:00
Nia
e536676a67
main (test): run tests on AVR 2022-01-01 15:58:03 +01:00
Tobias Theel
342c438586 remove multi core support non-goal 2022-01-01 00:17:51 -05:00
sago35
6b7ecf1f52 readme: unify the notation of micros with tinygo.org 2021-12-31 16:44:45 +01:00
Elias Naur
bd7ab8ddd5 targets,runtime,machine: add support for the stm32f469-disco board
The LEDs and button work; I haven't tested the SPI and I2C
configuration.
2021-12-31 10:30:48 +00:00
Elias Naur
302e72e84f machine: add PG* and PK* pins
They're used for LEDs on the STM32F469-Discovery board.
2021-12-31 10:30:48 +00:00
Elias Naur
55ca5287fe runtime: separate runtime initialization for STM32F4 boards
The STM32F469 can use the same initialization as the existing STM32F407
with a few frequency tweaks. This change splits the generic
initialization code into a separate runtime_stm32f4.go file, leaving
only the 407 board specific constants in the existing
runtime_stm32f407.go file.

Note that runtime_stm32f405.go initialization seems semantically similar
to the 407, but I don't have enough confidence in merging 405 with 407
in this change.
2021-12-31 10:30:48 +00:00
Elias Naur
11ee0969b6 machine: merge stm32f405/407
They're no longer functionally different.
2021-12-31 10:30:48 +00:00