added io::stdout().flush() - to force printing test name before possible deadlock

mem::scoped() and long jump resilience fixed #1963
fixed --test-nosort argument + extra test for teardown_fn memory leak
Some renaming. Simplify robust test allocator handling. Pop temp allocators in test runner.
`Thread` no longer allocates memory on posix.
Update unprintable struct output.
Correctly give an error if a character literal contains a line break.
This commit is contained in:
Alex Veden
2025-02-12 12:02:11 +04:00
committed by Christoffer Lerno
parent 535151a2a5
commit 5046608d1f
12 changed files with 109 additions and 107 deletions

View File

@@ -5,7 +5,6 @@ import std::os;
const TEST_MAGNITUDE = 10;
fn void lock_control_test() @test
{
Mutex m;
@@ -37,7 +36,7 @@ fn void! own_mutex(Mutex* m)
m.unlock()!;
}
fn void ensure_owner_checks() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void ensure_owner_checks() @test
{
Mutex m;
m.init()!!;
@@ -77,7 +76,7 @@ fn void shared_mutex_decrement(ArgsWrapper1* args)
args.m.unlock()!!;
}
fn void shared_mutex() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void shared_mutex() @test
{
Mutex m;
m.init()!!;
@@ -127,7 +126,7 @@ fn void acquire_recursively(RecursiveMutex* m)
}
}
fn void test_recursive_mutex() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void test_recursive_mutex() @test
{
RecursiveMutex m;
m.init()!!;

View File

@@ -5,7 +5,7 @@ import std::thread::pool;
def Pool = ThreadPool(<4>);
fn void init_destroy() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void init_destroy() @test
{
for (usz i = 0; i < 20; i++)
{
@@ -15,7 +15,7 @@ fn void init_destroy() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
}
}
fn void push_destroy() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void push_destroy() @test
{
for FOO: (usz i = 0; i < 20; i++)
{
@@ -42,7 +42,7 @@ fn void push_destroy() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
}
}
fn void push_stop() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void push_stop() @test
{
for (usz i = 0; i < 20; i++)
{

View File

@@ -3,7 +3,7 @@ import std::io;
int a;
fn void testrun() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void testrun() @test
{
Thread t;
a = 0;
@@ -18,7 +18,7 @@ fn void testrun() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
Mutex m_global;
fn void testrun_mutex() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void testrun_mutex()
{
Thread[20] ts;
a = 0;
@@ -48,7 +48,7 @@ fn void testrun_mutex() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
m_global.destroy()!!;
}
fn void testrun_mutex_try() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void testrun_mutex_try() @test
{
Mutex m;
m.init()!!;
@@ -59,7 +59,7 @@ fn void testrun_mutex_try() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
m.unlock()!!;
}
fn void testrun_mutex_timeout() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void testrun_mutex_timeout() @test
{
TimedMutex m;
m.init()!!;
@@ -80,7 +80,7 @@ fn void call_once()
x_once += 100;
}
fn void testrun_once() @test => mem::@scoped(&allocator::LIBC_ALLOCATOR)
fn void testrun_once() @test
{
OnceFlag once;
once.call(&call_once);