Skip to content

Commit 29ba51b

Browse files
committed
test(model): keep importer test on merged roots; export test off preset path
The split-root setup in test_model_import_exporter hung the x86 test run (Run tests stalled 25min+ vs the usual 9s). Revert to the original merged OverrideRootPathForTest(testRoot, testRoot) and point the export test's model at testRoot/export_target/ (outside the preset path) so ExportModelConfig no longer flags it as preset.
1 parent b9dbafd commit 29ba51b

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

test/test_model_import_exporter.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ TEST_CASE("ModelImportExporter Tests", "[model]") {
3131
ModelImportExporter importExporter;
3232

3333
std::string testRoot = "/tmp/cosmo_test_models";
34-
// Separate user (udata) and preset (adata) roots so export-path checks don't flag test models.
35-
cosmo::path::OverrideRootPathForTest(testRoot + "/udata", testRoot + "/adata");
34+
cosmo::path::OverrideRootPathForTest(testRoot, testRoot);
3635

37-
std::string testModelDir = cosmo::path::GetModelPath(); // udata/resource/models (user)
38-
std::string testTemplateDir = cosmo::path::GetModelTemplatePath(); // adata/resource/model_template
36+
std::string testModelDir = testRoot + "/resource/models";
37+
std::string testTemplateDir = testRoot + "/resource/model_template";
3938
fs::create_directories(testModelDir);
4039
fs::create_directories(testTemplateDir);
4140

@@ -55,7 +54,7 @@ TEST_CASE("ModelImportExporter Tests", "[model]") {
5554
if (code == "1234567")
5655
return testModelDir + "/1234567";
5756
if (code == "test_export_model")
58-
return testModelDir + "/test_export_model";
57+
return testRoot + "/export_target/test_export_model";
5958
return std::string("");
6059
},
6160
[&]() { return std::string("1234567"); }, [&](const nlohmann::json&) {},
@@ -389,7 +388,7 @@ TEST_CASE("ModelImportExporter Tests", "[model]") {
389388
}
390389

391390
SECTION("2.4 ExportModelConfig:验证 tar.gz 创建") {
392-
std::string exportModelDir = testModelDir + "/test_export_model";
391+
std::string exportModelDir = testRoot + "/export_target/test_export_model";
393392
fs::create_directories(exportModelDir);
394393
std::ofstream outCfg(exportModelDir + "/config.json");
395394
outCfg << "{\"modelCode\": \"test_export_model\", \"algorithmVersion\": \"1.0.0\"}";

0 commit comments

Comments
 (0)