阶段 D 步骤 10:测试固化(CLI 级 + 写侧自检)。

- codegen_test line1:compiler::StbView 自检(model_matches STATOR1 + sha_ok),
  篡改一字节 → sha 校验失败
- CTest 新增:cli_compile(--machine 编译退出 0)、cli_missing_machine(缺参 WILL_FAIL)
- 冻结哈希确认:工程哈希只依赖源文件内容(0xc3fe4ae74ad45900 不变,compiler_test 通过)
- 全量 ctest 14/14 全绿(新增 2 个 CLI 用例)
This commit is contained in:
2026-08-21 22:33:14 +08:00
parent a5f49caa94
commit 40bfd175c4
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -4,6 +4,16 @@ add_test(NAME stcompiler_version
add_test(NAME bytecode_executor_version
COMMAND BytecodeExecutor)
# CLI 级:编译需 --machine;缺参必须失败(WILL_FAIL
add_test(NAME cli_compile
COMMAND STCompiler ${CMAKE_SOURCE_DIR}/tests/cases/01_empty_main/project.toml
-o ${CMAKE_CURRENT_BINARY_DIR}/cli_case01.stb
--machine ${CMAKE_SOURCE_DIR}/compiler/machine.toml)
add_test(NAME cli_missing_machine
COMMAND STCompiler ${CMAKE_SOURCE_DIR}/tests/cases/01_empty_main/project.toml
-o ${CMAKE_CURRENT_BINARY_DIR}/cli_nope.stb)
set_tests_properties(cli_missing_machine PROPERTIES WILL_FAIL TRUE)
# isa 合同测试:链接 isa 库,断言覆盖饱和/编解码/disasm/哈希/映像/sidecar
add_executable(isa_test
./src/isa_test.cpp)