test(tools): 默认数据/报告路径同时支持在仓库根目录运行
问题:`OffscreenChecks` 的默认 `-data` 只探测 `../TestData/...`,默认 `-report` 也固定写 `../Temp/tools/...`;在**仓库根目录**运行时会静默报 "no data file"(退出码 2),容易被误认为工具坏了(本轮实际踩到)。 改动: * 默认数据文件候选同时包含 `../TestData/X` 与 `TestData/X`; * 报告打不开时,若路径以 `../Temp/` 开头则去掉前缀重试一次; * `Tools/README.md` 补充说明两种调用方式等价,显式 `-data/-out/-report` 仍以当前工作目录为准。 验证:在仓库根目录执行 `Tools\OffscreenChecks\Build\OffscreenChecks.exe -all` → 6/6 检查 PASS,`checks=108 failed=0`;在 `Tools/` 下行为不变。
This commit is contained in:
1 parent
b58b427f62
commit
35b67b216e
2 files changed
+23
-3
No files matched your search
@@ -160,18 +160,30 @@ int main(int argc, char** argv)
|
||||
|
||||
EnsureDirectory(options.outDir);
|
||||
|
||||
// 报告路径同样要能在两种工作目录下工作(见上面 `-data` 的说明)。
|
||||
g_report = std::fopen(reportPath.c_str(), "wb");
|
||||
if (g_report == nullptr && reportPath.rfind("../Temp/", 0) == 0)
|
||||
{
|
||||
reportPath = reportPath.substr(3); // 去掉 "../"
|
||||
g_report = std::fopen(reportPath.c_str(), "wb");
|
||||
}
|
||||
|
||||
EmitLine("==============================================================\n");
|
||||
EmitLine(" Just DataInspector - offscreen checks\n");
|
||||
EmitLine(" mode=%s out=%s report=%s\n", options.mode.c_str(), options.outDir.c_str(), reportPath.c_str());
|
||||
EmitLine("==============================================================\n");
|
||||
|
||||
// 数据文件:命令行优先,否则在 TestData 里挑一个可用的样本
|
||||
// 数据文件:命令行优先,否则在 TestData 里挑一个可用的样本。
|
||||
// ⚠️ 默认路径同时支持「在 Tools/ 下运行」与「在仓库根目录运行」两种习惯:
|
||||
// 前者要 `../TestData/...`,后者要 `TestData/...`。只认一种会让另一种
|
||||
// 静默报 "no data file"(本轮就踩过,容易被误认为工具坏了)。
|
||||
if (options.dataPath.empty())
|
||||
{
|
||||
static const char* const candidates[] = {"../TestData/SCATTER_TEST.csv", "../TestData/[1].CSV",
|
||||
"../TestData/BIG_DATA.csv", "../TestData/Problem_Data.CSV"};
|
||||
static const char* const candidates[] = {"../TestData/SCATTER_TEST.csv", "TestData/SCATTER_TEST.csv",
|
||||
"../TestData/[1].CSV", "TestData/[1].CSV",
|
||||
"../TestData/BIG_DATA.csv", "TestData/BIG_DATA.csv",
|
||||
"../TestData/Problem_Data.CSV",
|
||||
"TestData/Problem_Data.CSV"};
|
||||
for (const char* const candidate : candidates)
|
||||
{
|
||||
if (FileExists(candidate))
|
||||
|
||||
Reference in new issue
Block a user