use nix build & meson & zlog

This commit is contained in:
Rongsong Shen 2025-11-03 18:19:59 +08:00
parent 0123623742
commit 346768a144
60 changed files with 13739 additions and 0 deletions

View file

@ -0,0 +1,44 @@
#include <stdio.h>
#include <stdlib.h>
#include "xce/errnox.h"
#include "unity.h"
#include "utils.h"
static void test_error_setget(void) {
int myerrno =1;
ectx_t *e;
SET_ERROR(myerrno);
e = get_ectx();
TEST_ASSERT_TRUE(e != NULL);
TEST_ASSERT_TRUE(errno == myerrno);
TEST_ASSERT_TRUE(e->file != NULL);
TEST_ASSERT_TRUE(e->func != NULL);
TEST_ASSERT_TRUE(strcmp(e->file, __FILE__) == 0);
TEST_ASSERT_TRUE(strcmp(e->func, __func__) == 0);
}
#if 0
static void test_strerror_r(void) {
char errmsg1[256];
char errmsg2[256];
int errors[] ={ENOENT, EINVAL, E_XCE_BAD_JOB, E_XCE_BAD_WORKER, 0};
int i;
for(i = 0; errors[i] != 0; i ++) {
strerror_r(errors[i], errmsg1, sizeof(errmsg1));
xce_strerror_r(errors[i], errmsg2, sizeof(errmsg2));
TEST_ASSERT_TRUE(strcmp(errmsg1, errmsg2) == 0);
}
}
#endif
void test_error(void) {
printf("\n>> error test\n\n");
RUN_TEST(test_error_setget);
#if 0
RUN_TEST(test_strerror_r);
#endif
}