ai: 重新设计stage1的spl 让ai重构代码

This commit is contained in:
zzy committed 2026-12-02 12:40:36 +08:00
1 parent 032102f1d7
commit e531aab2d3
44 files changed
+708 -422

No files matched your search

+9 -6
View File
@@ -1,6 +1,6 @@
#define COMMON_CFLAGS "-Wall", "-Wextra", "-D_CRT_SECURE_NO_WARNINGS", "-D_CRT_NONSTDC_NO_DEPRECATE"
#define SPL_CFLAGS COMMON_CFLAGS, "-O0", "-g"
#define SPL_CFLAGS COMMON_CFLAGS, "-I.", "-Istage1/include", "-O0", "-g"
#define SPL_OPTIMIZATION_FLAG COMMON_CFLAGS, "-O2"
#define nob_cc_flags(cmd) nob_cmd_append(cmd, SPL_CFLAGS)
#undef UNICODE
@@ -19,7 +19,7 @@
#define BUILD_FOLDER "build/"
// Content of the .cflags stamp file; must match SPL_CFLAGS above.
#define CFLAGS_STR "-Wall -Wextra -O0 -g"
#define CFLAGS_STR "-Wall -Wextra -I. -Istage1/include -O0 -g"
// Stamp file whose mtime is refreshed whenever the flags change so that all
// object files get rebuilt.
static const char *CFLAGS_STAMP = BUILD_FOLDER ".cflags";
@@ -544,7 +544,8 @@ static bool test_parse_expect(const char *fname, test_expect_t *expect) {
expect->pending = true;
continue;
}
if (nob_sv_eq(key, nob_sv_from_cstr("location"))) { if (expect->has_location) {
if (nob_sv_eq(key, nob_sv_from_cstr("location"))) {
if (expect->has_location) {
malformed = true;
break;
}
@@ -588,6 +589,7 @@ typedef struct {
static const test_suite_t TEST_SUITES[] = {
{"stage1", "./tests/stage1/"},
{"spl_core", "./tests/spl_core/"},
{"stage2", "./tests/stage2/"},
{"stage3", "./tests/stage3/"},
};
@@ -671,7 +673,8 @@ static void test_pending_compile_and_run(const char *fname, test_ctx_t *ctx) {
nob_log(NOB_INFO, "%s: pending (run failed as expected)", fname);
ctx->pending += 1;
} else {
nob_log(NOB_ERROR, "%s: pending test passed unexpectedly; remove `// Expect pending`", fname);
nob_log(NOB_ERROR, "%s: pending test passed unexpectedly; remove `// Expect pending`",
fname);
ctx->failed += 1;
}
nob_cmd_result_free(result);
@@ -1026,8 +1029,8 @@ static int cli_test(nob_cli_t *cli) {
bool walked = walk_spl_files(suite->dir, &cli->test_filters, test_run_file, &ctx);
if (ctx.no_expect > 0)
nob_log(NOB_INFO, "%s (`%s`): %d passed, %d failed, %d pending (%d without `// Expect`)", suite->name,
target, ctx.passed, ctx.failed, ctx.pending, ctx.no_expect);
nob_log(NOB_INFO, "%s (`%s`): %d passed, %d failed, %d pending (%d without `// Expect`)",
suite->name, target, ctx.passed, ctx.failed, ctx.pending, ctx.no_expect);
else
nob_log(NOB_INFO, "%s (`%s`): %d passed, %d failed, %d pending", suite->name, target,
ctx.passed, ctx.failed, ctx.pending);