feat(raft-library): task 1.1 — build scaffold (raft/ files + meson wiring)

This commit is contained in:
Rongsong Shen 2026-05-31 04:51:42 +00:00
parent dbb750ebd3
commit 7f7de013b9
7 changed files with 225 additions and 0 deletions

View file

@ -105,6 +105,7 @@ libxce_src = [ gen_srcs[0],
'wobj.c',
'configobj.c',
'cluster.c',
'raft/raft.c',
]
incdir = include_directories('../include')
@ -171,6 +172,8 @@ libxce_test_src = ['testsuite/test.c',
'testsuite/test_cluster_parse.c',
'testsuite/test_libxce_retry.c',
'testsuite/test_netio_on_connected.c',
'testsuite/test_raft.c',
'raft/raft_sim.c',
]
libxce_test_deps = [libxce_deps, librtti_dep, unity_dep, libxce_dep]
@ -178,6 +181,7 @@ libxce_test = executable('xcelib_test',
libxce_test_src,
include_directories: [incdir, build_inc],
dependencies: libxce_test_deps,
c_args: ['-DXCE_TESTING'],
install: true)
test('libxce test', libxce_test, timeout: 120)

3
src/lib/raft/raft.c Normal file
View file

@ -0,0 +1,3 @@
#include "raft.h"
/* raft library — populated in task 2 */

10
src/lib/raft/raft.h Normal file
View file

@ -0,0 +1,10 @@
#ifndef RAFT_H
#define RAFT_H
/* raft library — populated in task 2 */
#include <errno.h>
#include <stdint.h>
#include <string.h>
#endif /* RAFT_H */

5
src/lib/raft/raft_sim.c Normal file
View file

@ -0,0 +1,5 @@
#ifdef XCE_TESTING
/* raft simulation helpers — populated in task 2 */
#endif /* XCE_TESTING */

View file

@ -36,6 +36,7 @@ extern void test_cluster(void);
extern void test_cluster_parse(void);
extern void test_libxce_retry(void);
extern void test_netio_on_connected(void);
extern void test_raft(void);
void setUp(void) { return; }
@ -141,6 +142,7 @@ int main(int argc, char* argv[])
TEST(test_cluster_parse);
TEST(test_libxce_retry);
TEST(test_netio_on_connected);
TEST(test_raft);
return UNITY_END();
}

View file

@ -0,0 +1,16 @@
#include <stdio.h>
#include <unity/unity.h>
static void test_raft_placeholder(void)
{
/* placeholder — real tests added in task 2 */
TEST_PASS();
}
void test_raft(void)
{
printf("\n>> raft test\n\n");
RUN_TEST(test_raft_placeholder);
}