Default to ipv4 for unit tests, add ipv6 option

This commit is contained in:
Mike Ellery
2018-06-26 14:15:13 -07:00
committed by Nik Bougalis
parent 49bcdda418
commit 63370b4441
4 changed files with 17 additions and 8 deletions

View File

@@ -36,7 +36,7 @@ matrix:
include:
- compiler: gcc
env: GCC_VER=5 TARGET=debug APP_ARGS="--unittest-ipv4"
env: GCC_VER=5 TARGET=debug
# - compiler: gcc
# env: GCC_VER=5 TARGET=debug.nounity
@@ -45,7 +45,7 @@ matrix:
# env: GCC_VER=5 TARGET=coverage PATH=$PWD/cmake/bin:$PATH
- compiler: clang
env: GCC_VER=5 TARGET=debug APP_ARGS="--unittest-ipv4"
env: GCC_VER=5 TARGET=debug
# - compiler: clang
# env: GCC_VER=5 TARGET=debug.nounity

View File

@@ -130,6 +130,12 @@ parser.add_argument(
help='Run tests in parallel'
)
parser.add_argument(
'--ipv6',
action='store_true',
help='Use IPv6 localhost when running unit tests.',
)
parser.add_argument(
'--clean', '-c',
action='store_true',
@@ -292,13 +298,16 @@ def run_cmake_tests(directory, target, config):
testflag = '--unittest'
quiet = ''
testjobs = ''
ipv6 = ''
if ARGS.test:
testflag += ('=' + ARGS.test)
if ARGS.quiet:
quiet = '-q'
if ARGS.ipv6:
ipv6 = '--unittest-ipv6'
if ARGS.testjobs:
testjobs = ('--unittest-jobs=' + str(ARGS.testjobs))
resultcode, lines = shell(executable, (testflag, quiet, testjobs,))
resultcode, lines = shell(executable, (testflag, quiet, testjobs, ipv6))
if resultcode:
if not ARGS.verbose:

1
Jenkinsfile vendored
View File

@@ -200,6 +200,7 @@ try {
'NINJA_BUILD=false',
"CCACHE_BASEDIR=${cdir}",
'PLANTUML_JAR=/opt/plantuml/plantuml.jar',
'APP_ARGS=--unittest-ipv6',
'CCACHE_NOHASHDIR=true',
"CC=${cc}",
"CXX=${cxx}",

View File

@@ -216,7 +216,7 @@ static int runUnitTests(
bool quiet,
bool log,
bool child,
bool ipv4,
bool ipv6,
std::size_t num_jobs,
int argc,
char** argv)
@@ -224,8 +224,7 @@ static int runUnitTests(
using namespace beast::unit_test;
using namespace ripple::test;
if (ipv4)
ripple::test::envUseIPv4 = true;
ripple::test::envUseIPv4 = (! ipv6);
if (!child && num_jobs == 1)
{
@@ -376,7 +375,7 @@ int run (int argc, char** argv)
"argument is handled individually by any suite that accesses it -- "
"as such, it typically only make sense to provide this when running "
"a single suite.")
("unittest-ipv4", "Use IPv4 localhost when running unittests (default is IPv6).")
("unittest-ipv6", "Use IPv6 localhost when running unittests (default is IPv4).")
("unittest-log",
"Force unit test log message output. Only useful in combination with "
"--quiet, in which case log messages will print but suite/case names "
@@ -457,7 +456,7 @@ int run (int argc, char** argv)
bool (vm.count ("quiet")),
bool (vm.count ("unittest-log")),
unittestChild,
bool (vm.count ("unittest-ipv4")),
bool (vm.count ("unittest-ipv6")),
numJobs,
argc,
argv);