From 95fd6ae836ab5fee7387f4df46b727165a05b723 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 25 Jun 2026 04:42:23 +0200 Subject: Adds v1 unit tests and fixes bugs found by them --- core/salis.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/salis.c') diff --git a/core/salis.c b/core/salis.c index dac9e52..bf7ec44 100644 --- a/core/salis.c +++ b/core/salis.c @@ -506,6 +506,7 @@ void core_init(struct Core *core, uint64_t *seed) { core->pnum = CLONES; core->pcap = CLONES; core->plst = CLONES - 1; + core->pcur = CLONES - 1; core->iviv = calloc(SYNC_INTERVAL, sizeof(uint8_t)); core->ivav = calloc(SYNC_INTERVAL, sizeof(uint64_t)); core->pvec = calloc(core->pcap, sizeof(struct Proc)); @@ -989,6 +990,12 @@ void salis_run_thread(uint64_t ns) { } void salis_sync(void) { +#if !defined(NDEBUG) + for (int i = 0; i < CORES; ++i) { + assert(g_cores[i].ivpt == SYNC_INTERVAL); + } +#endif + uint8_t *iviv0 = g_cores[0].iviv; uint64_t *ivav0 = g_cores[0].ivav; -- cgit v1.2.1