merge job rusage and pending reason support

This commit is contained in:
Rongsong Shen 2025-12-16 14:36:28 +08:00
parent 30824ae5ea
commit cb0c7fe9e7
82 changed files with 4280 additions and 2561 deletions

View file

@ -0,0 +1,56 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "delay.h"
#include "unity.h"
static int delay_work(void* arg)
{
time_t now;
int* pcount = (int*)arg;
now = time(NULL);
(*pcount)++;
printf("delay task run at %ld\n", now);
return 0;
}
static void test_delay1()
{
delaymgr_t mgr;
int count = 0;
int runcount = 15;
int delay_period = 2;
time_t t_start = time(NULL);
delaymgr_init(&mgr, 1, NULL);
delaymgr_start(&mgr);
delay_task(&mgr, delay_period, runcount, (delay_task_entry_fn_t)delay_work,
&count);
while (1) {
time_t now = time(NULL);
if (now - t_start > (runcount + 2) * delay_period) {
break;
}
sleep(5);
}
TEST_ASSERT_TRUE(count == runcount);
delaymgr_fini(&mgr);
return;
}
void test_delay(void)
{
printf("\n>> delay test\n\n");
RUN_TEST(test_delay1);
}