>From b6ab98d5e9afb19ca0a116ea9aba1af3281bf6e2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 7 Dec 2014 15:23:02 +0100 Subject: [PATCH 1/2] Add support for "--distribution" command line option in the UI tests. This option will be used to enable tests that should only be executed when testing binary program distributions (it is not used anywhere just yet). --- main_wx_test.cpp | 25 +++++++++++++++++++++---- wx_test_case.hpp | 6 ++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/main_wx_test.cpp b/main_wx_test.cpp index db9b88f..4166bd9 100644 --- a/main_wx_test.cpp +++ b/main_wx_test.cpp @@ -176,6 +176,9 @@ class application_test // Used by tests to retrieve their configuration parameters. wxConfigBase const& get_config_for(char const* name); + // Used to check if distribution tests should be enabled. + bool is_distribution_test() const { return is_distribution_test_; } + private: application_test(); @@ -228,10 +231,13 @@ class application_test boost::scoped_ptr config_; bool run_all_; + + bool is_distribution_test_; }; application_test::application_test() :run_all_(true) + ,is_distribution_test_(false) { } @@ -327,6 +333,11 @@ bool application_test::process_command_line(int& argc, char* argv[]) last_test_option = arg; remove_arg(n, argc, argv); } + else if(0 == std::strcmp(arg, "--distribution")) + { + is_distribution_test_ = true; + remove_arg(n, argc, argv); + } else if ( 0 == std::strcmp(arg, "-h") @@ -340,10 +351,11 @@ bool application_test::process_command_line(int& argc, char* argv[]) "Usage: " << argv[0] << "\n" - " -h,\t--help \tdisplay this help and exit\n" - " -l,\t--list \tlist all available tests and exit\n" - " -t or \trun only the specified test (may occur\n" - " --test \tmultiple times); default: run all tests\n" + " -h,\t--help \tdisplay this help and exit\n" + " -l,\t--list \tlist all available tests and exit\n" + " -t or \trun only the specified test (may occur\n" + " --test \tmultiple times); default: run all tests\n" + " --distribution \tenable distribution-specific tests\n" "\n" "Additionally, all command line options supported by the\n" "main lmi executable are also supported." @@ -495,6 +507,11 @@ void wx_base_test_case::skip_if_not_supported(char const* file) } } +bool wx_base_test_case::is_distribution_test() const +{ + return application_test::instance().is_distribution_test(); +} + // Application to drive the tests class SkeletonTest : public Skeleton { diff --git a/wx_test_case.hpp b/wx_test_case.hpp index e408a38..07b2533 100644 --- a/wx_test_case.hpp +++ b/wx_test_case.hpp @@ -65,6 +65,12 @@ class wx_base_test_case /// Throws test_skipped_exception if the file is not supported. void skip_if_not_supported(char const* file); + /// Return true if running in distribution testing mode. + /// + /// This method is used to restrict execution of the tests that are + /// specific to the binary program distribution. + bool is_distribution_test() const; + protected: /// The argument must be a literal, as we just store the pointer. explicit wx_base_test_case(char const* name); -- 1.7.9