diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-18 23:21:04 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-18 23:21:04 -0400 |
| commit | d4803583ffced81e08d3e68f947fa3c230f26923 (patch) | |
| tree | 18aa2684a8df3b64c28c4c4e2661d5aacd44e881 /core/testing/runner.odin | |
| parent | 8b31cddaba18cc646d471b35249a3f2771e20651 (diff) | |
Work around Windows test failure
I am uncertain why this works, but it does. Previously, `rtti_test` was
failing due to non-zero data appearing in the `l_buggy` `Buggy_Struct`.
The issue was caused by calling `runtime.default_random_generator` with
a pointer to the state, somehow. The pointer could be on the stack or in
the heap; it did not matter.
I found two workarounds.
- One is to move the RNG setup behind the call to `free_all`.
- The other is to construct the random generator manually.
Despite my digging and testing, I could find no reason as to why this
works or what the fundamental issue was to begin with. If anyone comes
upon this in the future with direct access to a Windows machine, I
recommend stepping through the program with a debugger to investigate
more deeply into why this happens.
Diffstat (limited to 'core/testing/runner.odin')
| -rw-r--r-- | core/testing/runner.odin | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/testing/runner.odin b/core/testing/runner.odin index 01464e1aa..3510856c7 100644 --- a/core/testing/runner.odin +++ b/core/testing/runner.odin @@ -107,10 +107,14 @@ run_test_task :: proc(task: thread.Task) { options = Default_Test_Logger_Opts, } - free_all(context.temp_allocator) + random_generator_state: runtime.Default_Random_State + context.random_generator = { + procedure = runtime.default_random_generator_proc, + data = &random_generator_state, + } + rand.reset(data.t.seed) - random_generator_state := rand.create(data.t.seed) - context.random_generator = rand.default_random_generator(&random_generator_state) + free_all(context.temp_allocator) data.it.p(&data.t) |