Commit Graph

4776 Commits

Author SHA1 Message Date
Feoramund
6a5d51f0d6 Use more concise way of satisfying -vet 2024-06-02 14:54:31 -04:00
Feoramund
433ca538bf Be specific about platforms not implementing test runner signal handler 2024-06-02 14:54:31 -04:00
Feoramund
d1723664a7 Catch SIGILL, SIGFPE, SIGSEGV in the test runner 2024-06-02 14:54:31 -04:00
Feoramund
fb37572c4c Rename signal_handler.odin to signal_handler_libc.odin 2024-06-02 14:54:31 -04:00
Jeroen van Rijn
d7bfbe0552 Port testing\core\text\i18n 2024-06-02 14:47:08 -04:00
Jeroen van Rijn
601df0e8f7 Port tests\core\encoding\json 2024-06-02 14:47:08 -04:00
Jeroen van Rijn
1b32e27aa4 Port tests\core\encoding\hxa
And fix a few leaks in `core:encoding/hxa` while at it.
2024-06-02 14:47:08 -04:00
Jeroen van Rijn
3404dea8ac Port tests\encoding\hex 2024-06-02 14:47:08 -04:00
Feoramund
b74b956fda Remove unneeded import 2024-06-02 14:47:08 -04:00
Feoramund
1f6a6f2cd3 Support deterministic random seeding of tests
Add a new option `ODIN_TEST_RANDOM_SEED` which is picked from the cycle
counter at startup, if it's not specified by the user.

This number is sent to every test in the `T` struct and reset every test
(just in case).
2024-06-02 14:47:07 -04:00
Jeroen van Rijn
a27b167218 Update tests\core\encoding\cbor to use new test runner.
It was leaky and required a substantial number of `loc := #caller_location` additions to parts of the core library to make it easier to track down how and where it leaked.

The tests now run fine multi-threaded.
2024-06-02 14:47:07 -04:00
Feoramund
84ad71fdb3 Support ODIN_TEST_PROGRESS_WIDTH=0
This will automatically calculate how wide the progress bars should be
based on the package with the greatest number of tests.

The progress width is now capped to 100.
2024-06-02 14:47:07 -04:00
Feoramund
49fa66370f Report test memory usage only if there's an issue
Adds new option `ODIN_TEST_ALWAYS_REPORT_MEMORY`, for when you always
want to see the memory usage report.
2024-06-02 14:47:07 -04:00
Feoramund
e1a3c0e21d Track memory in the test runner by default 2024-06-02 14:47:07 -04:00
Feoramund
bf42e39b1c Be specific about int size for Rollback_Stack asserts
This should fix tests failing on 32-bit platforms.
2024-06-02 14:47:07 -04:00
Feoramund
b7e1ae7073 Change test runner options to SCREAMING_SNAKE_CASE
This commit also changes the name of `test_select` to `ODIN_TEST_NAMES`,
to better conform with the already-existing `-test-name:<name>` option.
2024-06-02 14:47:07 -04:00
Feoramund
dcfda195d2 Send terminal control code to STDOUT instead
`STDERR` might be redirected, and this code signals to the terminal to
show the cursor again. Otherwise, the cursor will be invisible.
2024-06-02 14:47:07 -04:00
Feoramund
a1c5bebac7 Fix ANSI redraw eating last log line 2024-06-02 14:47:07 -04:00
Feoramund
89d8df28be Combine multi-line attributes onto one line 2024-06-02 14:47:07 -04:00
Feoramund
dffc3af86c Remove safe_heap_allocator from test runner
I was under the impression that the default `context.allocator` was not
thread-safe, but I've been told that this is not the case.
2024-06-02 14:47:06 -04:00
Feoramund
eadfbb1318 Forbid singleton allocations from shrinking their block offset 2024-06-02 14:47:06 -04:00
Feoramund
1afc235359 Use plain sort for internal_tests 2024-06-02 14:47:06 -04:00
Feoramund
09ef08f035 Add more sanity checking to mem.Rollback_Stack 2024-06-02 14:47:06 -04:00
Feoramund
0f675fa436 Use uintptr where applicable in mem.Rollback_Stack 2024-06-02 14:47:06 -04:00
Feoramund
568b746c98 Fix indentation 2024-06-02 14:47:06 -04:00
Feoramund
87ea4a2652 Temporarily disable Windows-specific test runner
I do not have a Windows machine to test the refactored test runner, and
I am unsure if it would even run correctly on Windows without this
disabled.
2024-06-02 14:34:31 -04:00
Feoramund
d03024088a Remove unneeded code 2024-06-02 14:34:31 -04:00
Feoramund
b6c4dfb68d Refactor the test runner
Changes

- Support multi-threaded testing.
- Support `set_fail_timeout` on all platforms.
- Display an animated progress report.
- Setup all tests with a context logger.
- Give all tests their own separate custom allocators.
- Support tracking test memory usage.
- Display a summary of the failed tests at the end.
- Let users select only specific tests to run.
- Support copying failed tests to the clipboard to run again.
- Support catching SIGINT (CTRL-C) to cancel early.
- Record context in cleanup procs.
- Write all log messages to STDERR for easy redirection.
- Possibly more I've forgotten.

New Options

- `-define:test_threads=N`: Specify thread count.
- `-define:test_thread_memory=B`: Specify initial memory block size in bytes to each thread.
- `-define:test_track_memory=true`: Track the memory usage of individual tests.
- `-define:test_fancy=false`: Disable animated progress report.
- `-define:test_select=package.test_name,...`: Run only select tests.
- `-define:test_clipboard=true`: Copy names of failed tests to the clipboard.
- `-define:test_progress_width=24`: Change the width of the animated progress bars.
2024-06-02 14:34:31 -04:00
Feoramund
95c2e020ff Share libc signal definitions with more platforms
I confirmed that these 3 platforms share the same signal definitions
from these sources.

Haiku: https://github.com/haiku/haiku/blob/master/headers/posix/signal.h
OpenBSD: https://github.com/openbsd/src/blob/master/sys/sys/signal.h
NetBSD: http://fxr.watson.org/fxr/source/sys/signal.h?v=NETBSD
2024-06-02 14:34:30 -04:00
Feoramund
50dffaf131 Add mem.Rollback_Stack 2024-06-02 14:34:30 -04:00
Feoramund
fc4f6b87bb Add core:encoding/ansi package 2024-06-02 14:34:30 -04:00
Feoramund
8137b9dd75 Add mem.tracking_allocator_reset 2024-06-02 14:34:30 -04:00
Feoramund
558c330028 Add task-stopping functionality to thread.Pool 2024-06-02 14:34:30 -04:00
Feoramund
1875e7c36a Make log.do_*_header argument orders consistent 2024-06-02 14:34:30 -04:00
Feoramund
7d4da6eaa7 Fix trailing space with only .Date log option 2024-06-02 14:34:30 -04:00
Feoramund
8ae375dbff Move log timestamping out to do_time_header proc 2024-06-02 14:34:30 -04:00
Yawning Angel
c751e4b2eb core/crypto/aes: Add AES implementation 2024-06-01 22:55:42 +09:00
Yawning Angel
1ade62b630 core/crypto/_aes/ct64: Add GHASH 2024-06-01 22:55:42 +09:00
Yawning Angel
cba58924a8 core/crypto/_aes: 64-bit portable implementation 2024-06-01 22:55:42 +09:00
Yawning Angel
f49575f1fb core/simd/x86: Add the AES-NI intrinsics 2024-06-01 22:55:42 +09:00
gingerBill
5628cfabe5 Merge branch 'master' of https://github.com/odin-lang/Odin 2024-05-31 16:35:38 +01:00
gingerBill
31a9b3f428 core:encoding/ini 2024-05-31 16:35:30 +01:00
Erik Isidore
0514ee0410 PR#3655 - small linter issue correction 2024-05-30 16:12:20 -03:00
Erik Isidore
f6e699cd22 core:sys/linux - Add support for Unix Domain Socket addresses 2024-05-30 00:14:00 -03:00
Vitalii Kravchenko
223c987db2 Take logger itself, not a pointer to logger in multi-logger destructor. 2024-05-28 21:13:25 +01:00
gingerBill
74524b6050 Merge pull request #3644 from odin-lang/foreign-import-improvements
Allow `foreign import` import paths to be evaluated in the semantic phase rather than parsing
2024-05-28 12:18:15 +01:00
Feoramund
01ad69413a Remove unused code in internal_random_prime 2024-05-28 01:36:44 -04:00
gingerBill
d91054b615 Change parser to use ^Expr rather than string for the foreign import paths 2024-05-28 00:27:13 +01:00
shashank
fb6248925a fix pitch_from_quaternion 2024-05-27 23:38:50 +05:30
Vitalii Kravchenko
bdc4daca54 Make destroy_file_logger take logger instead of logger pointer. 2024-05-27 16:19:44 +01:00