forked from boostorg/beast
Don't use program_options
This commit is contained in:
39
.travis.yml
39
.travis.yml
@@ -137,71 +137,64 @@ install:
|
|||||||
- export PATH="`pwd`":$PATH
|
- export PATH="`pwd`":$PATH
|
||||||
- git submodule update --init tools/build
|
- git submodule update --init tools/build
|
||||||
- git submodule update --init tools/boostdep
|
- 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/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/algorithm
|
||||||
- git submodule update --init libs/array
|
- git submodule update --init libs/array
|
||||||
- git submodule update --init libs/assert
|
|
||||||
- git submodule update --init libs/atomic
|
- git submodule update --init libs/atomic
|
||||||
- git submodule update --init libs/bind
|
- git submodule update --init libs/bind
|
||||||
- git submodule update --init libs/chrono
|
- git submodule update --init libs/chrono
|
||||||
- git submodule update --init libs/concept_check
|
- git submodule update --init libs/concept_check
|
||||||
- git submodule update --init libs/config
|
|
||||||
- git submodule update --init libs/container
|
- git submodule update --init libs/container
|
||||||
- git submodule update --init libs/context
|
- git submodule update --init libs/context
|
||||||
- git submodule update --init libs/conversion
|
- git submodule update --init libs/conversion
|
||||||
- git submodule update --init libs/core
|
|
||||||
- git submodule update --init libs/coroutine
|
- git submodule update --init libs/coroutine
|
||||||
- git submodule update --init libs/date_time
|
- git submodule update --init libs/date_time
|
||||||
- git submodule update --init libs/detail
|
- git submodule update --init libs/detail
|
||||||
- git submodule update --init libs/endian
|
|
||||||
- git submodule update --init libs/exception
|
- 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
|
||||||
- git submodule update --init libs/function_types
|
- git submodule update --init libs/function_types
|
||||||
- git submodule update --init libs/functional
|
- git submodule update --init libs/functional
|
||||||
- git submodule update --init libs/fusion
|
- git submodule update --init libs/fusion
|
||||||
- git submodule update --init libs/integer
|
- git submodule update --init libs/integer
|
||||||
- git submodule update --init libs/intrusive
|
|
||||||
- git submodule update --init libs/io
|
- git submodule update --init libs/io
|
||||||
- git submodule update --init libs/iostreams
|
|
||||||
- git submodule update --init libs/iterator
|
- git submodule update --init libs/iterator
|
||||||
- git submodule update --init libs/lambda
|
- git submodule update --init libs/lambda
|
||||||
- git submodule update --init libs/lexical_cast
|
- git submodule update --init libs/lexical_cast
|
||||||
- git submodule update --init libs/locale
|
|
||||||
- git submodule update --init libs/logic
|
- git submodule update --init libs/logic
|
||||||
- git submodule update --init libs/math
|
- git submodule update --init libs/math
|
||||||
- git submodule update --init libs/move
|
- git submodule update --init libs/move
|
||||||
- git submodule update --init libs/mpl
|
- git submodule update --init libs/mpl
|
||||||
- git submodule update --init libs/numeric/conversion
|
- git submodule update --init libs/numeric/conversion
|
||||||
- git submodule update --init libs/optional
|
|
||||||
- git submodule update --init libs/pool
|
- git submodule update --init libs/pool
|
||||||
- git submodule update --init libs/predef
|
- git submodule update --init libs/predef
|
||||||
- git submodule update --init libs/preprocessor
|
- 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/random
|
||||||
- git submodule update --init libs/range
|
- git submodule update --init libs/range
|
||||||
- git submodule update --init libs/ratio
|
- git submodule update --init libs/ratio
|
||||||
- git submodule update --init libs/rational
|
- git submodule update --init libs/rational
|
||||||
- git submodule update --init libs/regex
|
|
||||||
- git submodule update --init libs/serialization
|
- 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/thread
|
||||||
- git submodule update --init libs/throw_exception
|
|
||||||
- git submodule update --init libs/tokenizer
|
- git submodule update --init libs/tokenizer
|
||||||
- git submodule update --init libs/tti
|
|
||||||
- git submodule update --init libs/tuple
|
- git submodule update --init libs/tuple
|
||||||
- git submodule update --init libs/type_index
|
- 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/typeof
|
||||||
- git submodule update --init libs/unordered
|
- git submodule update --init libs/unordered
|
||||||
- git submodule update --init libs/utility
|
|
||||||
- git submodule update --init libs/winapi
|
|
||||||
- rm -rf libs/beast
|
- rm -rf libs/beast
|
||||||
- mkdir libs/beast
|
- mkdir libs/beast
|
||||||
- cp -r $TRAVIS_BUILD_DIR/* libs/beast
|
- cp -r $TRAVIS_BUILD_DIR/* libs/beast
|
||||||
|
@@ -6,6 +6,7 @@ Version 87:
|
|||||||
* Update README, add CONTRIBUTING.md and CODE_OF_CONDUCT.md
|
* Update README, add CONTRIBUTING.md and CODE_OF_CONDUCT.md
|
||||||
* Update doc links in README.md
|
* Update doc links in README.md
|
||||||
* Refactor tests Jamfile
|
* Refactor tests Jamfile
|
||||||
|
* Don't use program_options
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
1
Jamfile
1
Jamfile
@@ -78,7 +78,6 @@ project beast
|
|||||||
<library>/boost/system//boost_system
|
<library>/boost/system//boost_system
|
||||||
<library>/boost/coroutine//boost_coroutine/<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
<library>/boost/coroutine//boost_coroutine/<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||||
<library>/boost/filesystem//boost_filesystem
|
<library>/boost/filesystem//boost_filesystem
|
||||||
<library>/boost/program_options//boost_program_options
|
|
||||||
<define>BOOST_ALL_NO_LIB=1
|
<define>BOOST_ALL_NO_LIB=1
|
||||||
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
|
||||||
<threading>multi
|
<threading>multi
|
||||||
|
39
appveyor.yml
39
appveyor.yml
@@ -23,71 +23,64 @@ install:
|
|||||||
- cd boost-root
|
- cd boost-root
|
||||||
- git submodule update --init tools/build
|
- git submodule update --init tools/build
|
||||||
- git submodule update --init tools/boostdep
|
- 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/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/algorithm
|
||||||
- git submodule update --init libs/array
|
- git submodule update --init libs/array
|
||||||
- git submodule update --init libs/assert
|
|
||||||
- git submodule update --init libs/atomic
|
- git submodule update --init libs/atomic
|
||||||
- git submodule update --init libs/bind
|
- git submodule update --init libs/bind
|
||||||
- git submodule update --init libs/chrono
|
- git submodule update --init libs/chrono
|
||||||
- git submodule update --init libs/concept_check
|
- git submodule update --init libs/concept_check
|
||||||
- git submodule update --init libs/config
|
|
||||||
- git submodule update --init libs/container
|
- git submodule update --init libs/container
|
||||||
- git submodule update --init libs/context
|
- git submodule update --init libs/context
|
||||||
- git submodule update --init libs/conversion
|
- git submodule update --init libs/conversion
|
||||||
- git submodule update --init libs/core
|
|
||||||
- git submodule update --init libs/coroutine
|
- git submodule update --init libs/coroutine
|
||||||
- git submodule update --init libs/date_time
|
- git submodule update --init libs/date_time
|
||||||
- git submodule update --init libs/detail
|
- git submodule update --init libs/detail
|
||||||
- git submodule update --init libs/endian
|
|
||||||
- git submodule update --init libs/exception
|
- 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
|
||||||
- git submodule update --init libs/function_types
|
- git submodule update --init libs/function_types
|
||||||
- git submodule update --init libs/functional
|
- git submodule update --init libs/functional
|
||||||
- git submodule update --init libs/fusion
|
- git submodule update --init libs/fusion
|
||||||
- git submodule update --init libs/integer
|
- git submodule update --init libs/integer
|
||||||
- git submodule update --init libs/intrusive
|
|
||||||
- git submodule update --init libs/io
|
- git submodule update --init libs/io
|
||||||
- git submodule update --init libs/iostreams
|
|
||||||
- git submodule update --init libs/iterator
|
- git submodule update --init libs/iterator
|
||||||
- git submodule update --init libs/lambda
|
- git submodule update --init libs/lambda
|
||||||
- git submodule update --init libs/lexical_cast
|
- git submodule update --init libs/lexical_cast
|
||||||
- git submodule update --init libs/locale
|
|
||||||
- git submodule update --init libs/logic
|
- git submodule update --init libs/logic
|
||||||
- git submodule update --init libs/math
|
- git submodule update --init libs/math
|
||||||
- git submodule update --init libs/move
|
- git submodule update --init libs/move
|
||||||
- git submodule update --init libs/mpl
|
- git submodule update --init libs/mpl
|
||||||
- git submodule update --init libs/numeric/conversion
|
- git submodule update --init libs/numeric/conversion
|
||||||
- git submodule update --init libs/optional
|
|
||||||
- git submodule update --init libs/pool
|
- git submodule update --init libs/pool
|
||||||
- git submodule update --init libs/predef
|
- git submodule update --init libs/predef
|
||||||
- git submodule update --init libs/preprocessor
|
- 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/random
|
||||||
- git submodule update --init libs/range
|
- git submodule update --init libs/range
|
||||||
- git submodule update --init libs/ratio
|
- git submodule update --init libs/ratio
|
||||||
- git submodule update --init libs/rational
|
- git submodule update --init libs/rational
|
||||||
- git submodule update --init libs/regex
|
|
||||||
- git submodule update --init libs/serialization
|
- 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/thread
|
||||||
- git submodule update --init libs/throw_exception
|
|
||||||
- git submodule update --init libs/tokenizer
|
- git submodule update --init libs/tokenizer
|
||||||
- git submodule update --init libs/tti
|
|
||||||
- git submodule update --init libs/tuple
|
- git submodule update --init libs/tuple
|
||||||
- git submodule update --init libs/type_index
|
- 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/typeof
|
||||||
- git submodule update --init libs/unordered
|
- git submodule update --init libs/unordered
|
||||||
- git submodule update --init libs/utility
|
|
||||||
- git submodule update --init libs/winapi
|
|
||||||
- MKDIR libs\beast
|
- MKDIR libs\beast
|
||||||
- XCOPY /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\
|
- XCOPY /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\
|
||||||
- CMD /c bootstrap
|
- CMD /c bootstrap
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "ws_upgrade_service.hpp"
|
#include "ws_upgrade_service.hpp"
|
||||||
|
|
||||||
#include <boost/asio/signal_set.hpp>
|
#include <boost/asio/signal_set.hpp>
|
||||||
#include <boost/program_options.hpp>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -101,36 +100,19 @@ main(
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
// Check command line arguments.
|
||||||
po::options_description desc("Options");
|
if(ac != 5)
|
||||||
|
{
|
||||||
|
std::cerr <<
|
||||||
|
"Usage: " << av[0] <<
|
||||||
|
" <address> <port> <threads> <root-directory>";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
desc.add_options()
|
auto const addr = boost::asio::ip::address::from_string(av[1]);
|
||||||
("root,r", po::value<std::string>()->default_value("."),
|
auto const port = static_cast<unsigned short>(std::atoi(av[2]));
|
||||||
"Set the root directory for serving files")
|
auto const threads = static_cast<std::size_t>(std::atoi(av[3]));
|
||||||
("port,p", po::value<std::uint16_t>()->default_value(1000),
|
auto const root = std::string(av[4]);
|
||||||
"Set the base port number for the server")
|
|
||||||
("ip", po::value<std::string>()->default_value("0.0.0.0"),
|
|
||||||
"Set the IP address to bind to, \"0.0.0.0\" for all")
|
|
||||||
("threads,n", po::value<std::size_t>()->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<std::string>();
|
|
||||||
|
|
||||||
// Get the port number from the options
|
|
||||||
std::uint16_t const port = vm["port"].as<std::uint16_t>();
|
|
||||||
|
|
||||||
// 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<std::size_t>();
|
|
||||||
|
|
||||||
// Get the root path from the command line
|
|
||||||
boost::filesystem::path const root = vm["root"].as<std::string>();
|
|
||||||
|
|
||||||
// These settings will be applied to all new websocket connections
|
// These settings will be applied to all new websocket connections
|
||||||
boost::beast::websocket::permessage_deflate pmd;
|
boost::beast::websocket::permessage_deflate pmd;
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
#include <boost/beast/unit_test/reporter.hpp>
|
#include <boost/beast/unit_test/reporter.hpp>
|
||||||
#include <boost/beast/unit_test/suite.hpp>
|
#include <boost/beast/unit_test/suite.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/program_options.hpp>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -29,53 +28,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#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
|
// Simple main used to produce stand
|
||||||
// alone executables that run unit tests.
|
// alone executables that run unit tests.
|
||||||
int main(int ac, char const* av[])
|
int main(int ac, char const* av[])
|
||||||
@@ -83,6 +35,9 @@ int main(int ac, char const* av[])
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost::beast::unit_test;
|
using namespace boost::beast::unit_test;
|
||||||
|
|
||||||
|
dstream log(std::cerr);
|
||||||
|
std::unitbuf(log);
|
||||||
|
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
{
|
{
|
||||||
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||||
@@ -91,44 +46,42 @@ int main(int ac, char const* av[])
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
if(ac == 2)
|
||||||
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<string>(), "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"))
|
|
||||||
{
|
{
|
||||||
log << desc << std::endl;
|
std::string const s{av[1]};
|
||||||
|
if(s == "-h" || s == "--help")
|
||||||
|
{
|
||||||
|
log <<
|
||||||
|
"Usage:\n"
|
||||||
|
" " << av[0] << ": { <suite-name>... }" <<
|
||||||
|
std::endl;
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
else if(vm.count("print"))
|
|
||||||
{
|
|
||||||
print(log);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string suites;
|
|
||||||
if(vm.count("suites") > 0)
|
|
||||||
suites = vm["suites"].as<string>();
|
|
||||||
reporter r(log);
|
reporter r(log);
|
||||||
bool failed;
|
bool failed;
|
||||||
if(! suites.empty())
|
if(ac > 1)
|
||||||
failed = r.run_each_if(global_suites(),
|
{
|
||||||
match_auto(suites));
|
std::vector<selector> 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
|
else
|
||||||
|
{
|
||||||
failed = r.run_each(global_suites());
|
failed = r.run_each(global_suites());
|
||||||
|
}
|
||||||
if(failed)
|
if(failed)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user