1
0
Fork 0

TestSuite: Implementation of the --log-split command line option.

This commit is contained in:
Edward d'Auvergne 2019-07-30 14:54:45 +02:00
parent 8b777a74c9
commit b58a63543e
4 changed files with 36 additions and 15 deletions

View file

@ -65,12 +65,18 @@ void fgCompilerOutputter::printFailureDetail(CppUnit::TestFailure *failure)
test_io = *test_iter;
// SG_LOG IO streams.
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, "+test_io.log_priority+" priority", test_io.sg_interleaved, true);
//fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_BULK only priority", test_io.sg_bulk_only);
//fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_DEBUG only priority", test_io.sg_debug_only);
//fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_INFO only priority", test_io.sg_info_only);
//fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_WARN only priority", test_io.sg_warn_only);
//fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_ALERT only priority", test_io.sg_alert_only);
if (!test_io.sg_interleaved.empty())
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, "+test_io.log_priority+" priority", test_io.sg_interleaved, true);
if (!test_io.sg_bulk_only.empty())
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_BULK only priority", test_io.sg_bulk_only);
if (!test_io.sg_debug_only.empty())
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_DEBUG only priority", test_io.sg_debug_only);
if (!test_io.sg_info_only.empty())
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_INFO only priority", test_io.sg_info_only);
if (!test_io.sg_warn_only.empty())
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_WARN only priority", test_io.sg_warn_only);
if (!test_io.sg_alert_only.empty())
fgCompilerOutputter::printIOStreamMessages("SG_LOG, SG_ALL class, SG_ALERT only priority", test_io.sg_alert_only);
// Default IO streams.
fgCompilerOutputter::printIOStreamMessages("STDOUT and STDERR", test_io.stdio);

View file

@ -82,7 +82,7 @@ capturedIO & getIOstreams(sgDebugPriority p)
// Set up to capture all the simgear logging priorities as separate streams.
void setupLogging(sgDebugPriority p)
void setupLogging(sgDebugPriority p, bool split)
{
// Get the single logstream instance.
logstream &log = sglog();
@ -95,12 +95,20 @@ void setupLogging(sgDebugPriority p)
// IO capture.
capturedIO &obj = getIOstreams(p);
log.addCallback(obj.callback_interleaved);
log.addCallback(obj.callback_bulk_only);
log.addCallback(obj.callback_debug_only);
log.addCallback(obj.callback_info_only);
log.addCallback(obj.callback_warn_only);
log.addCallback(obj.callback_alert_only);
if (!split)
log.addCallback(obj.callback_interleaved);
else {
if (p <= SG_BULK)
log.addCallback(obj.callback_bulk_only);
if (p <= SG_DEBUG)
log.addCallback(obj.callback_debug_only);
if (p <= SG_INFO)
log.addCallback(obj.callback_info_only);
if (p <= SG_WARN)
log.addCallback(obj.callback_warn_only);
if (p <= SG_ALERT)
log.addCallback(obj.callback_alert_only);
}
}

View file

@ -90,7 +90,7 @@ class capturedIO
capturedIO & getIOstreams(sgDebugPriority p=SG_BULK);
// Set up to capture all the simgear logging priorities as separate streams.
void setupLogging(sgDebugPriority);
void setupLogging(sgDebugPriority, bool);
// Deactivate all the simgear logging priority IO captures.
void stopLogging();

View file

@ -90,6 +90,7 @@ int main(int argc, char **argv)
// Declarations.
int status_gui=-1, status_simgear=-1, status_system=-1, status_unit=-1, status_fgdata=-1;
bool run_system=false, run_unit=false, run_gui=false, run_simgear=false, run_fgdata=false;
bool logSplit=false;
bool verbose=false, ctest_output=false, debug=false, printSummary=true, help=false;
char *subset_system=NULL, *subset_unit=NULL, *subset_gui=NULL, *subset_simgear=NULL, *subset_fgdata=NULL;
char firstchar;
@ -166,6 +167,10 @@ int main(int argc, char **argv)
return 1;
}
// Log splitting.
} else if (arg == "--log-split") {
logSplit = true;
// Verbose output.
} else if (arg == "-v" || arg == "--verbose") {
verbose = true;
@ -217,6 +222,8 @@ int main(int argc, char **argv)
std::cout << " Logging options:" << std::endl;
std::cout << " --log-level={bulk,debug,info,warn,alert,popup,dev_warn,dev_alert}" << std::endl;
std::cout << " specify the minimum logging level to output" << std::endl;
std::cout << " --log-split output the different non-interleaved log streams" << std::endl;
std::cout << " sequentially" << std::endl;
std::cout << std::endl;
std::cout << " Verbosity options:" << std::endl;
std::cout << " -v, --verbose verbose output including names and timings for all" << std::endl;
@ -251,7 +258,7 @@ int main(int argc, char **argv)
if (debug)
sglog().setLogLevels(SG_ALL, logPriority);
else
setupLogging(logPriority);
setupLogging(logPriority, logSplit);
// Execute each of the test suite categories.
if (run_system)