32 Commits

Author SHA1 Message Date
gingerBill 842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn 7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Feoramund 71c6b0c8f0 testing: Add API to expect signals and assertion failures 2025-06-16 11:25:32 -04:00
Laytan Laats 603efa860a add '#caller_expression' 2024-09-14 22:13:37 +02:00
Feoramund 0fa24ac3c4 Remove deprecated log procs from core:testing 2024-08-18 21:30:32 -04:00
Feoramund 0af025d056 Add explicit copyright info to core:testing 2024-08-12 14:16:22 -04:00
Jeroen van Rijn a05b73c632 Keep -vet happy when mem tracking is disabled. 2024-08-08 21:02:35 +02:00
Jeroen van Rijn 4d27898418 Use test runner's own tracking allocator. 2024-08-08 20:58:25 +02:00
Jeroen van Rijn 80d1e1ba82 Allow testing for intentional leaks in test runner
Adds `expect_leak_or_bad_free :: proc(t: ^T, client_test: proc(t: ^T), verifier: Memory_Verifier_Proc)`.

It sets up its own `Tracking_Allocator`, runs the `client_test`, and then calls the `verifier` procedure.
The verifier can then inspect the contents of the tracking allocator and call `testing.expect*` as sensible for the test in question.

Any allocations are then cleared so that the test runner doesn't itself complain about leaks.

Additionally, `ODIN_TEST_LOG_LEVEL_MEMORY` has been added as a define to set the severity of the test runner's memory tracker. You can use `-define:ODIN_TEST_LOG_LEVEL_MEMORY=error` to make tests fail rather than warn if leaks or bad frees have been found.
2024-08-08 20:41:32 +02:00
gingerBill 8642d719f0 Imply #no_capture to all variadic parameters 2024-07-14 12:19:47 +01:00
gingerBill c7bd954752 Add more uses of #no_capture 2024-07-14 11:56:04 +01:00
Feoramund bb823d5ba0 Make testing.fail_now divergent
This is in line with the old way it worked on Windows.
2024-06-15 10:53:21 -04:00
Feoramund 784408358d Call cleanups after test signal 2024-06-15 10:46:47 -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
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
gingerBill 6736205723 Merge pull request #3138 from FourteenBrush/master
Add a testing.expectf proc as a way to avoid a tprintf call.
2024-01-29 17:33:29 +00:00
gingerBill 3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
FourteenBrush 766d6aa946 Fix typo 2024-01-25 12:05:19 +01:00
FourteenBrush 895ebb95d5 Need to unpack args 2024-01-25 11:44:53 +01:00
FourteenBrush 3a5d80b291 Forgot to include loc param 2024-01-25 10:20:23 +01:00
FourteenBrush 712ae1c5ac Add testing.expectf 2024-01-25 10:08:09 +01:00
ramn 5f53d815d1 fix: make -vet not complain 2023-07-09 00:15:01 +02:00
ramn 7b89f25818 Fix #2637
where testing.expect_value can't compare nils
2023-07-08 23:46:51 +02:00
gingerBill 9b54b99bf6 Use positional and named arguments within the core library 2023-06-21 01:17:05 +01:00
gingerBill 3a60bee804 Move assert to implementation file 2021-10-11 20:07:39 +01:00
gingerBill b67e0002c1 Add testing.expect_value; Improve testing.set_fail_timeout 2021-10-11 20:05:13 +01:00
gingerBill e64eb631df Add testing.set_fail_timeout 2021-10-11 15:28:25 +01:00
Jeroen van Rijn 97a46f664d testing: Strip ; from test runner. 2021-09-07 14:46:53 +02:00
gingerBill cf0bf1a7cb Add testing.fail_now 2021-05-01 23:06:14 +01:00
gingerBill 52d38ae42b Make the core:testing runner on windows run in a separate thread to handle crashes in more safe manner 2021-05-01 22:54:27 +01:00
gingerBill 468ad4837b Add pkg field to testing.Internal_Test 2021-03-14 18:15:08 +00:00
gingerBill 2aa588209e odin test to work with the new core:testing package 2021-03-14 18:01:31 +00:00