core: skip results checking when introspecting the command line

This commit is contained in:
Tommaso Pecorella
2022-01-26 11:09:13 -03:00
committed by Gabriel Ferreira
parent bf0708e61f
commit e1e07f2ffd
2 changed files with 10 additions and 5 deletions

View File

@@ -25,7 +25,8 @@
#include <string>
#include <sstream>
#include <cstdlib> // itoa(), system ()
#include <cstdlib> // itoa(), system (), getenv ()
#include <cstring>
/**
* \file
@@ -122,6 +123,13 @@ ExampleAsTestCase::DoRun (void)
// Make sure the example didn't outright crash
NS_TEST_ASSERT_MSG_EQ (status, 0, "example " + m_program + " failed");
// Check that we're not just introspecting the command-line
const char * envVar = std::getenv ("NS_COMMANDLINE_INTROSPECTION");
if (envVar != 0 && std::strlen (envVar) != 0)
{
return;
}
// Compare the testFile to the reference file
NS_ASCII_TEST_EXPECT_EQ (testFile, refFile);
}

View File

@@ -1998,7 +1998,4 @@ def main(argv):
return run_tests()
if __name__ == '__main__':
returncode = main(sys.argv)
if os.getenv("NS_COMMANDLINE_INTROSPECTION", None) is not None:
returncode = 0
sys.exit(returncode)
sys.exit(main(sys.argv))