31 X("namespace::get_or_create", test_ns_get_or_create), \
32 X("namespace::get_or_create_twice", test_ns_get_twice), \
33 X("config::wiring", test_config_wiring), X("config::runtime_macros", test_runtime_macros)
47 TEST_CHECK(atomic_load(&ns->sym_table)->len == 0);
52 TEST_CHECK(atomic_load(&engine->namespaces)->len == 1);
53 TEST_CHECK(srn_context_find_namespace(ctx,
"serene.tests") == ns);
72 TEST_CHECK(atomic_load(&engine->namespaces)->len == 1);
78 TEST_CHECK(atomic_load(&engine->namespaces)->len == 2);
79 TEST_CHECK(srn_context_find_namespace(ctx,
"serene.other") == ns3);
80 TEST_CHECK(srn_context_find_namespace(ctx,
"serene.missing") ==
nullptr);
#define TEST_ASSERT(cond)
#define RELEASE_CONTEXT(x)
#define SHUTDOWN_ENGINE(mm, engine)
#define MAKE_ENGINE(mm, engine)
#define MAKE_CONTEXT(engine, x)
#define SRN_CONFIG_DEFAULTS
srn_metadata_t absurd_metadata
We use this for testing. Defined once in core.c.
#define AS_STRING(value_ref)
srn_mm_t * srn_mm_init(const srn_configuration_t *config)
Initialize the memory manager, this function will panic on error.
srn_engine_t * srn_engine_make(srn_mm_t *mm, const srn_configuration_t *config)
Create the engine over mm, copying config (the runtime's knobs) into it.
srn_fiber_t * srn_fiber_spawn(srn_context_t *ctx, srn_fiber_entry_t entry, void *arg)
Make and schedule a fiber with every default, the engine's scheduler, the configured stack size,...
AI Generated (🤦) Fiber subsystem overview.
static size_t srn_fiber_stack_size(srn_fiber_stack_t s)
void * srn_fiber_result_t
What a fiber's entry produces, type-erased.
srn_namespace_t * srn_namespace_get_or_create(srn_engine_t *engine, srn_string_t *name, srn_error_t **err)
Create a new and empty namespace if it is not already created in the engine, if it exists,...
A namespace is an isolation for names nad technically a compilation unit.
static void test_ns_get_twice()
static void test_config_wiring()
static void test_ns_get_or_create()
static srn_fiber_result_t config_wiring_fiber_entry(srn_context_t *ctx, void *arg)
static void test_runtime_macros()
#define SERENE_RUNTIME_SHUTDOWN(engine)
Tear down what SERENE_RUNTIME_INIT brought up, in reverse order, the engine (reactor,...
#define SERENE_RUNTIME_INIT_WITH_SCHED(engine, sched, config)
SERENE_RUNTIME_INIT plus a sched variable bound to the engine's scheduler, which every run and fiber ...
void srn_sched_shutdown(srn_scheduler_t *sched)
The one stop tear down of the fiber subsystem, should be called once srn_sched_run has returned.
void srn_sched_run(srn_scheduler_t *sched, size_t nworkers)
Run the scheduler with nworkers os threads draining it, returning once the pool goes quiescent (every...
srn_value_t * srn_string_make(srn_context_t *ctx, srn_metadata_t *metadata, const char *src)
Create a string from a null terminated C string.
bool srn_string_eq(const srn_string_t *a, const srn_string_t *b)
Every runtime knob, in one place.
srn_limits_config_t limits
Engine is a structure to own the long living and main pieces of the compiler.
srn_scheduler_t * scheduler
The fiber scheduler, that is the entry point of the fiber subsystem.
A runtime error, a tag classifying the failure and a human-readable message.
size_t stack_size
Size of every fiber stack, in bytes.
size_t ns_name_max_len
Longest namespace name accepted, in bytes.
size_t string_max_len
Largest string accepted, in bytes.
size_t block_size_magnitude
Magnitude of one block the arena hands out from.
Main memory manager structure that will own all the allocated blocks and data.
srn_context_t * root_context
srn_term_t * node
The top level node of the namespace.