8000 Improve command-line options handling in ToolTest.cc · Issue #2238 · apache/orc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Improve command-line options handling in ToolTest.cc #2238
Open
@lahwaacz

Description

@lahwaacz

ToolTest.cc has terrible handling of command-line options:

GTEST_API_ int main(int argc, char** argv) {
GOOGLE_PROTOBUF_VERIFY_VERSION;
std::cout << "ORC version: " << ORC_VERSION << "\n";
if (argc >= 2) {
exampleDirectory = argv[1];
} else {
exampleDirectory = "../examples";
}
if (argc >= 3) {
buildDirectory = argv[2];
} else {
buildDirectory = ".";
}
std::cout << "example dir = " << exampleDirectory << "\n";
if (buildDirectory) {
std::cout << "build dir = " << buildDirectory << "\n";
}
testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
google::protobuf::ShutdownProtobufLibrary();
return result;
}

First, it interprets argv[1] as exampleDirectory and argv[2] as buildDirectory. Then it passes all options to testing::InitGoogleTest(&argc, argv);

This means that passing optional arguments like --gtest_* does not work. If I do

gtest_filter="-TestMatchParam/FileParam.Contents/19:-TestMatchParam/FileParam.Contents/23"
build/tools/test/tool-test --gtest_filter="$gtest_filter"

then all tests except one fail with an error like

C++ exception with description "Can't open --gtest_filter=-TestMatchParam/FileParam.Contents/19:-TestMatchParam/FileParam.Contents/23/TestOrcFile.testDate2038.orc" thrown in the test body.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0