test(cae): allow corpus sweep name filtering
This commit is contained in:
@@ -729,15 +729,19 @@ TEST(CorpusProbe, BatchSweep) {
|
||||
namespace fs = std::filesystem;
|
||||
std::vector<fs::path> files;
|
||||
std::error_code ec;
|
||||
const char* name_filter = std::getenv("VDE_CORPUS_NAME");
|
||||
for (const auto& e : fs::directory_iterator(dir, ec)) {
|
||||
if (!e.is_regular_file()) continue;
|
||||
if (name_filter && e.path().filename().string().find(name_filter) ==
|
||||
std::string::npos)
|
||||
continue;
|
||||
const auto ext = e.path().extension().string();
|
||||
if (ext != ".stp" && ext != ".step" && ext != ".STP" && ext != ".STEP") continue;
|
||||
const auto sz = e.file_size();
|
||||
if (sz > 2 * 1024 * 1024) continue;
|
||||
files.push_back(e.path());
|
||||
}
|
||||
ASSERT_FALSE(files.empty()) << dir;
|
||||
if (files.empty()) GTEST_SKIP() << "no matching corpus files in " << dir;
|
||||
std::sort(files.begin(), files.end(), [](const fs::path& a, const fs::path& b) {
|
||||
return fs::file_size(a) < fs::file_size(b);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user