Skip to content

Commit

Permalink
Allow passing a test as argument to e2e_read_test (#1535)
Browse files Browse the repository at this point in the history
This commit adds support to use e2e_read_test to scan a single directory that contains a suite of tests and
test.group file. Example:
(runner dir) ./e2e_read_test test/test_files/shortest_path
  • Loading branch information
rfdavid committed May 11, 2023
1 parent bc8fa44 commit 5f65a89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/common/file_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ std::vector<std::string> FileUtils::globFilePath(const std::string& path) {

std::vector<std::string> FileUtils::findAllDirectories(const std::string& path) {
std::vector<std::string> directories;
directories.push_back(path);
for (const auto& entry : std::filesystem::recursive_directory_iterator(path)) {
if (entry.is_directory()) {
directories.push_back(entry.path().string());
Expand Down
10 changes: 9 additions & 1 deletion test/runner/e2e_read_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ void scanTestFiles(const std::string& path, std::vector<TestConfig>& configs) {
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
std::vector<TestConfig> configs;
scanTestFiles(TestHelper::appendKuzuRootPath("test/test_files"), configs);
std::string path = "test/test_files";
if (argc > 1) {
path = argv[1];
}
path = TestHelper::appendKuzuRootPath(path);
if (!FileUtils::fileOrPathExists(path)) {
throw Exception("Test directory not exists! [" + path + "].");
}
scanTestFiles(path, configs);
registerTests(configs);
return RUN_ALL_TESTS();
}

0 comments on commit 5f65a89

Please sign in to comment.