From 56f60c381f9eebe4911a03b761291382c810a391 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Tue, 8 Nov 2022 11:53:13 +0100 Subject: [PATCH] fgfs_test_suite: improve the --help output - The program name is fgfs_test_suite, not run_test_suite. - Add three examples for particularly useful tasks; be explicit about how to discover available test names. - std::endl flushes the stream every time it is used; better use '\n' in most places (more efficient and takes less space on screen). :-) --- test_suite/testSuite.cxx | 110 +++++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/test_suite/testSuite.cxx b/test_suite/testSuite.cxx index 6cb59bdd9..fa6fdefaa 100644 --- a/test_suite/testSuite.cxx +++ b/test_suite/testSuite.cxx @@ -33,57 +33,65 @@ using namespace std; // The help message. void helpPrintout(std::ostream &stream) { - stream << "Usage: run_test_suite [options]" << std::endl << std::endl; - stream << "Options:" << std::endl; - stream << " -h, --help show this help message and exit." << std::endl; - stream << std::endl; - stream << " Test selection options:" << std::endl; - stream << " -s, --system-tests execute the system/functional tests." << std::endl; - stream << " -u, --unit-tests execute the unit tests." << std::endl; - stream << " -g, --gui-tests execute the GUI tests." << std::endl; - stream << " -m, --simgear-tests execute the simgear tests." << std::endl; - stream << " -f, --fgdata-tests execute the FGData tests." << std::endl; - stream << std::endl; - stream << " The -s, -u, -g, and -m options accept an optional argument to perform a" << std::endl; - stream << " subset of all tests. This argument should either be the name of a test" << std::endl; - stream << " suite, the full name of an individual test, or a comma separated list." << std::endl; - stream << " E.g. -u DigitalFilterTests\n"; - stream << std::endl; - stream << " Full test names consist of the test suite name, the separator '::' and then" << std::endl; - stream << " the individual test name. The test names can revealed with the verbose" << std::endl; - stream << " option." << std::endl; - stream << std::endl; - stream << " Logging options:" << std::endl; - stream << " --log-level={bulk,debug,info,warn,alert,popup,dev_warn,dev_alert}" << std::endl; - stream << " specify the minimum logging level to output" << std::endl; - stream << " --log-class=[none, terrain, astro, flight, input, gl, view, cockpit," << std::endl; - stream << " general, math, event, aircraft, autopilot, io, clipper," << std::endl; - stream << " network, atc, nasal, instrumentation, systems, ai, environment," << std::endl; - stream << " sound, navaid, gui, terrasync, particles, headless, osg," << std::endl; - stream << " undefined, all]" << std::endl; - stream << " select the logging class(es) to output." << std::endl; - stream << " --log-split output the different non-interleaved log streams" << std::endl; - stream << " sequentially." << std::endl; - stream << std::endl; - stream << " Verbosity options:" << std::endl; - stream << " -t, --timings verbose output including names and timings for all" << std::endl; - stream << " tests." << std::endl; - stream << " -c, --ctest simplified output suitable for running via CTest." << std::endl; - stream << " -d, --debug disable IO capture for debugging (super verbose output)." << std::endl; - stream << " --no-summary disable the final summary printout." << std::endl; - stream << std::endl; - stream << " FG options:" << std::endl; - stream << " --fg-root the path to FGData." << std::endl; - stream << std::endl; - stream << "Environmental variables:" << std::endl; - stream << " FG_TEST_LOG_LEVEL equivalent to the --log-level option." << std::endl; - stream << " FG_TEST_LOG_CLASS equivalent to the --log-class option." << std::endl; - stream << " FG_TEST_LOG_SPLIT equivalent to the --log-split option." << std::endl; - stream << " FG_TEST_TIMINGS equivalent to the -t or --timings option." << std::endl; - stream << " FG_TEST_DEBUG equivalent to the -d or --debug option." << std::endl; - stream << " FG_ROOT the path to FGData. The order of precedence is" << std::endl; - stream << " --fg-root, the FG_DATA_DIR CMake option, FG_ROOT," << std::endl; - stream << " '../fgdata/', and '../data/'." << std::endl; + stream << "Usage: fgfs_test_suite [options]\n"; + stream << '\n'; + stream << "Options:\n"; + stream << " -h, --help show this help message and exit.\n"; + stream << '\n'; + stream << " Test selection options:\n"; + stream << " -s, --system-tests execute the system/functional tests.\n"; + stream << " -u, --unit-tests execute the unit tests.\n"; + stream << " -g, --gui-tests execute the GUI tests.\n"; + stream << " -m, --simgear-tests execute the simgear tests.\n"; + stream << " -f, --fgdata-tests execute the FGData tests.\n"; + stream << '\n'; + stream << " The -s, -u, -g, and -m options accept an optional argument to perform a\n"; + stream << " subset of all tests. This argument should either be the name of a test\n"; + stream << " suite, the full name of an individual test, or a comma separated list.\n"; + stream << '\n'; + stream << " Full test names consist of the test suite name, the separator '::' and\n"; + stream << " then the individual test name. The test names can revealed with the -t\n"; + stream << " option.\n"; + stream << '\n'; + stream << " Examples:\n"; + stream << " - perform and print the names of all available unit tests:\n"; + stream << " --> fgfs_test_suite -t -u\n"; + stream << " - run all tests from the NavRadioTests test suite:\n"; + stream << " --> fgfs_test_suite -u NavRadioTests\n"; + stream << " - run a specific test without discarding its output:\n"; + stream << " --> fgfs_test_suite --no-summary -d -u NavRadioTests::testGS\n"; + stream << '\n'; + stream << " Logging options:\n"; + stream << " --log-level={bulk,debug,info,warn,alert,popup,dev_warn,dev_alert}\n"; + stream << " specify the minimum logging level to output\n"; + stream << " --log-class=[none, terrain, astro, flight, input, gl, view, cockpit,\n"; + stream << " general, math, event, aircraft, autopilot, io, clipper,\n"; + stream << " network, atc, nasal, instrumentation, systems, ai, environment,\n"; + stream << " sound, navaid, gui, terrasync, particles, headless, osg,\n"; + stream << " undefined, all]\n"; + stream << " select the logging class(es) to output.\n"; + stream << " --log-split output the different non-interleaved log streams\n"; + stream << " sequentially.\n"; + stream << '\n'; + stream << " Verbosity options:\n"; + stream << " -t, --timings verbose output including names and timings for all\n"; + stream << " tests.\n"; + stream << " -c, --ctest simplified output suitable for running via CTest.\n"; + stream << " -d, --debug disable IO capture for debugging (super verbose output).\n"; + stream << " --no-summary disable the final summary printout.\n"; + stream << '\n'; + stream << " FG options:\n"; + stream << " --fg-root the path to FGData.\n"; + stream << '\n'; + stream << "Environmental variables:\n"; + stream << " FG_TEST_LOG_LEVEL equivalent to the --log-level option.\n"; + stream << " FG_TEST_LOG_CLASS equivalent to the --log-class option.\n"; + stream << " FG_TEST_LOG_SPLIT equivalent to the --log-split option.\n"; + stream << " FG_TEST_TIMINGS equivalent to the -t or --timings option.\n"; + stream << " FG_TEST_DEBUG equivalent to the -d or --debug option.\n"; + stream << " FG_ROOT the path to FGData. The order of precedence is\n"; + stream << " --fg-root, the FG_DATA_DIR CMake option, FG_ROOT,\n"; + stream << " '../fgdata/', and '../data/'.\n"; stream.flush(); }