diff --git a/.travis.yml b/.travis.yml index 80bd2613..dc897be9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,71 +137,64 @@ install: - export PATH="`pwd`":$PATH - git submodule update --init tools/build - git submodule update --init tools/boostdep - - git submodule update --init libs/config - - git submodule update --init libs/any - git submodule update --init libs/asio + - git submodule update --init libs/assert + - git submodule update --init libs/config + - git submodule update --init libs/core + - git submodule update --init libs/endian + - git submodule update --init libs/filesystem + - git submodule update --init libs/intrusive + - git submodule update --init libs/locale + - git submodule update --init libs/optional + - git submodule update --init libs/smart_ptr + - git submodule update --init libs/static_assert + - git submodule update --init libs/system + - git submodule update --init libs/throw_exception + - git submodule update --init libs/type_traits + - git submodule update --init libs/utility + - git submodule update --init libs/winapi + - git submodule update --init libs/algorithm - git submodule update --init libs/array - - git submodule update --init libs/assert - git submodule update --init libs/atomic - git submodule update --init libs/bind - git submodule update --init libs/chrono - git submodule update --init libs/concept_check - - git submodule update --init libs/config - git submodule update --init libs/container - git submodule update --init libs/context - git submodule update --init libs/conversion - - git submodule update --init libs/core - git submodule update --init libs/coroutine - git submodule update --init libs/date_time - git submodule update --init libs/detail - - git submodule update --init libs/endian - git submodule update --init libs/exception - - git submodule update --init libs/filesystem - - git submodule update --init libs/foreach - git submodule update --init libs/function - git submodule update --init libs/function_types - git submodule update --init libs/functional - git submodule update --init libs/fusion - git submodule update --init libs/integer - - git submodule update --init libs/intrusive - git submodule update --init libs/io - - git submodule update --init libs/iostreams - git submodule update --init libs/iterator - git submodule update --init libs/lambda - git submodule update --init libs/lexical_cast - - git submodule update --init libs/locale - git submodule update --init libs/logic - git submodule update --init libs/math - git submodule update --init libs/move - git submodule update --init libs/mpl - git submodule update --init libs/numeric/conversion - - git submodule update --init libs/optional - git submodule update --init libs/pool - git submodule update --init libs/predef - git submodule update --init libs/preprocessor - - git submodule update --init libs/program_options - - git submodule update --init libs/proto - git submodule update --init libs/random - git submodule update --init libs/range - git submodule update --init libs/ratio - git submodule update --init libs/rational - - git submodule update --init libs/regex - git submodule update --init libs/serialization - - git submodule update --init libs/smart_ptr - - git submodule update --init libs/static_assert - - git submodule update --init libs/system - git submodule update --init libs/thread - - git submodule update --init libs/throw_exception - git submodule update --init libs/tokenizer - - git submodule update --init libs/tti - git submodule update --init libs/tuple - git submodule update --init libs/type_index - - git submodule update --init libs/type_traits - git submodule update --init libs/typeof - git submodule update --init libs/unordered - - git submodule update --init libs/utility - - git submodule update --init libs/winapi - rm -rf libs/beast - mkdir libs/beast - cp -r $TRAVIS_BUILD_DIR/* libs/beast diff --git a/CHANGELOG.md b/CHANGELOG.md index f8731ebc..6fde6f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Version 87: * Update README, add CONTRIBUTING.md and CODE_OF_CONDUCT.md * Update doc links in README.md * Refactor tests Jamfile +* Don't use program_options -------------------------------------------------------------------------------- diff --git a/Jamfile b/Jamfile index e835b1fe..221938ff 100644 --- a/Jamfile +++ b/Jamfile @@ -78,7 +78,6 @@ project beast /boost/system//boost_system /boost/coroutine//boost_coroutine/BOOST_COROUTINES_NO_DEPRECATION_WARNING=1 /boost/filesystem//boost_filesystem - /boost/program_options//boost_program_options BOOST_ALL_NO_LIB=1 BOOST_COROUTINES_NO_DEPRECATION_WARNING=1 multi diff --git a/appveyor.yml b/appveyor.yml index 60520cae..fb2b3e73 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,71 +23,64 @@ install: - cd boost-root - git submodule update --init tools/build - git submodule update --init tools/boostdep - - git submodule update --init libs/config - - git submodule update --init libs/any - git submodule update --init libs/asio + - git submodule update --init libs/assert + - git submodule update --init libs/config + - git submodule update --init libs/core + - git submodule update --init libs/endian + - git submodule update --init libs/filesystem + - git submodule update --init libs/intrusive + - git submodule update --init libs/locale + - git submodule update --init libs/optional + - git submodule update --init libs/smart_ptr + - git submodule update --init libs/static_assert + - git submodule update --init libs/system + - git submodule update --init libs/throw_exception + - git submodule update --init libs/type_traits + - git submodule update --init libs/utility + - git submodule update --init libs/winapi + - git submodule update --init libs/algorithm - git submodule update --init libs/array - - git submodule update --init libs/assert - git submodule update --init libs/atomic - git submodule update --init libs/bind - git submodule update --init libs/chrono - git submodule update --init libs/concept_check - - git submodule update --init libs/config - git submodule update --init libs/container - git submodule update --init libs/context - git submodule update --init libs/conversion - - git submodule update --init libs/core - git submodule update --init libs/coroutine - git submodule update --init libs/date_time - git submodule update --init libs/detail - - git submodule update --init libs/endian - git submodule update --init libs/exception - - git submodule update --init libs/filesystem - - git submodule update --init libs/foreach - git submodule update --init libs/function - git submodule update --init libs/function_types - git submodule update --init libs/functional - git submodule update --init libs/fusion - git submodule update --init libs/integer - - git submodule update --init libs/intrusive - git submodule update --init libs/io - - git submodule update --init libs/iostreams - git submodule update --init libs/iterator - git submodule update --init libs/lambda - git submodule update --init libs/lexical_cast - - git submodule update --init libs/locale - git submodule update --init libs/logic - git submodule update --init libs/math - git submodule update --init libs/move - git submodule update --init libs/mpl - git submodule update --init libs/numeric/conversion - - git submodule update --init libs/optional - git submodule update --init libs/pool - git submodule update --init libs/predef - git submodule update --init libs/preprocessor - - git submodule update --init libs/program_options - - git submodule update --init libs/proto - git submodule update --init libs/random - git submodule update --init libs/range - git submodule update --init libs/ratio - git submodule update --init libs/rational - - git submodule update --init libs/regex - git submodule update --init libs/serialization - - git submodule update --init libs/smart_ptr - - git submodule update --init libs/static_assert - - git submodule update --init libs/system - git submodule update --init libs/thread - - git submodule update --init libs/throw_exception - git submodule update --init libs/tokenizer - - git submodule update --init libs/tti - git submodule update --init libs/tuple - git submodule update --init libs/type_index - - git submodule update --init libs/type_traits - git submodule update --init libs/typeof - git submodule update --init libs/unordered - - git submodule update --init libs/utility - - git submodule update --init libs/winapi - MKDIR libs\beast - XCOPY /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\ - CMD /c bootstrap diff --git a/example/server-framework/main.cpp b/example/server-framework/main.cpp index 9fc2b1fa..bdbfabec 100644 --- a/example/server-framework/main.cpp +++ b/example/server-framework/main.cpp @@ -25,7 +25,6 @@ #include "ws_upgrade_service.hpp" #include -#include #include @@ -101,36 +100,19 @@ main( return EXIT_FAILURE; }; - namespace po = boost::program_options; - po::options_description desc("Options"); + // Check command line arguments. + if(ac != 5) + { + std::cerr << + "Usage: " << av[0] << + "
"; + return EXIT_FAILURE; + } - desc.add_options() - ("root,r", po::value()->default_value("."), - "Set the root directory for serving files") - ("port,p", po::value()->default_value(1000), - "Set the base port number for the server") - ("ip", po::value()->default_value("0.0.0.0"), - "Set the IP address to bind to, \"0.0.0.0\" for all") - ("threads,n", po::value()->default_value(4), - "Set the number of threads to use") - ; - po::variables_map vm; - po::store(po::parse_command_line(ac, av, desc), vm); - - // Get the IP address from the options - std::string const ip = vm["ip"].as(); - - // Get the port number from the options - std::uint16_t const port = vm["port"].as(); - - // Build an endpoint from the address and port - address_type const addr{address_type::from_string(ip)}; - - // Get the number of threads from the command line - std::size_t const threads = vm["threads"].as(); - - // Get the root path from the command line - boost::filesystem::path const root = vm["root"].as(); + auto const addr = boost::asio::ip::address::from_string(av[1]); + auto const port = static_cast(std::atoi(av[2])); + auto const threads = static_cast(std::atoi(av[3])); + auto const root = std::string(av[4]); // These settings will be applied to all new websocket connections boost::beast::websocket::permessage_deflate pmd; diff --git a/extras/boost/beast/unit_test/main.cpp b/extras/boost/beast/unit_test/main.cpp index 6faeb556..04b6aed9 100644 --- a/extras/boost/beast/unit_test/main.cpp +++ b/extras/boost/beast/unit_test/main.cpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -29,53 +28,6 @@ # endif #endif -namespace boost { -namespace beast { -namespace unit_test { - -static -std::string -prefix(suite_info const& s) -{ - if(s.manual()) - return "|M| "; - return " "; -} - -static -void -print(std::ostream& os, suite_list const& c) -{ - std::size_t manual = 0; - for(auto const& s : c) - { - os << prefix(s) << s.full_name() << '\n'; - if(s.manual()) - ++manual; - } - os << - amount(c.size(), "suite") << " total, " << - amount(manual, "manual suite") << - '\n' - ; -} - -// Print the list of suites -// Used with the --print command line option -static -void -print(std::ostream& os) -{ - os << "------------------------------------------\n"; - print(os, global_suites()); - os << "------------------------------------------" << - std::endl; -} - -} // unit_test -} // beast -} // boost - // Simple main used to produce stand // alone executables that run unit tests. int main(int ac, char const* av[]) @@ -83,6 +35,9 @@ int main(int ac, char const* av[]) using namespace std; using namespace boost::beast::unit_test; + dstream log(std::cerr); + std::unitbuf(log); + #if BOOST_MSVC { int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); @@ -91,44 +46,42 @@ int main(int ac, char const* av[]) } #endif - namespace po = boost::program_options; - po::options_description desc("Options"); - desc.add_options() - ("help,h", "Produce a help message") - ("print,p", "Print the list of available test suites") - ("suites,s", po::value(), "suites to run") - ; - - po::positional_options_description p; - po::variables_map vm; - po::store(po::parse_command_line(ac, av, desc), vm); - po::notify(vm); - - dstream log(std::cerr); - std::unitbuf(log); - - if(vm.count("help")) + if(ac == 2) { - log << desc << std::endl; + std::string const s{av[1]}; + if(s == "-h" || s == "--help") + { + log << + "Usage:\n" + " " << av[0] << ": { ... }" << + std::endl; + return EXIT_SUCCESS; + } } - else if(vm.count("print")) + + reporter r(log); + bool failed; + if(ac > 1) { - print(log); + std::vector v; + v.reserve(ac - 1); + for(int i = 1; i < ac; ++i) + v.emplace_back(selector::automatch, av[i]); + auto pred = + [&v](suite_info const& si) mutable + { + for(auto& p : v) + if(p(si)) + return true; + return false; + }; + failed = r.run_each_if(global_suites(), pred); } else { - std::string suites; - if(vm.count("suites") > 0) - suites = vm["suites"].as(); - reporter r(log); - bool failed; - if(! suites.empty()) - failed = r.run_each_if(global_suites(), - match_auto(suites)); - else - failed = r.run_each(global_suites()); - if(failed) - return EXIT_FAILURE; - return EXIT_SUCCESS; + failed = r.run_each(global_suites()); } + if(failed) + return EXIT_FAILURE; + return EXIT_SUCCESS; }