Skip to content

Commit 63370b4

Browse files
mellery451nbougalis
authored andcommitted
Default to ipv4 for unit tests, add ipv6 option
1 parent 49bcdda commit 63370b4

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ matrix:
3636
include:
3737

3838
- compiler: gcc
39-
env: GCC_VER=5 TARGET=debug APP_ARGS="--unittest-ipv4"
39+
env: GCC_VER=5 TARGET=debug
4040

4141
# - compiler: gcc
4242
# env: GCC_VER=5 TARGET=debug.nounity
@@ -45,7 +45,7 @@ matrix:
4545
# env: GCC_VER=5 TARGET=coverage PATH=$PWD/cmake/bin:$PATH
4646

4747
- compiler: clang
48-
env: GCC_VER=5 TARGET=debug APP_ARGS="--unittest-ipv4"
48+
env: GCC_VER=5 TARGET=debug
4949

5050
# - compiler: clang
5151
# env: GCC_VER=5 TARGET=debug.nounity

Builds/Test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ def powerset(iterable):
130130
help='Run tests in parallel'
131131
)
132132

133+
parser.add_argument(
134+
'--ipv6',
135+
action='store_true',
136+
help='Use IPv6 localhost when running unit tests.',
137+
)
138+
133139
parser.add_argument(
134140
'--clean', '-c',
135141
action='store_true',
@@ -292,13 +298,16 @@ def run_cmake_tests(directory, target, config):
292298
testflag = '--unittest'
293299
quiet = ''
294300
testjobs = ''
301+
ipv6 = ''
295302
if ARGS.test:
296303
testflag += ('=' + ARGS.test)
297304
if ARGS.quiet:
298305
quiet = '-q'
306+
if ARGS.ipv6:
307+
ipv6 = '--unittest-ipv6'
299308
if ARGS.testjobs:
300309
testjobs = ('--unittest-jobs=' + str(ARGS.testjobs))
301-
resultcode, lines = shell(executable, (testflag, quiet, testjobs,))
310+
resultcode, lines = shell(executable, (testflag, quiet, testjobs, ipv6))
302311

303312
if resultcode:
304313
if not ARGS.verbose:

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ try {
200200
'NINJA_BUILD=false',
201201
"CCACHE_BASEDIR=${cdir}",
202202
'PLANTUML_JAR=/opt/plantuml/plantuml.jar',
203+
'APP_ARGS=--unittest-ipv6',
203204
'CCACHE_NOHASHDIR=true',
204205
"CC=${cc}",
205206
"CXX=${cxx}",

src/ripple/app/main/Main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,15 @@ static int runUnitTests(
216216
bool quiet,
217217
bool log,
218218
bool child,
219-
bool ipv4,
219+
bool ipv6,
220220
std::size_t num_jobs,
221221
int argc,
222222
char** argv)
223223
{
224224
using namespace beast::unit_test;
225225
using namespace ripple::test;
226226

227-
if (ipv4)
228-
ripple::test::envUseIPv4 = true;
227+
ripple::test::envUseIPv4 = (! ipv6);
229228

230229
if (!child && num_jobs == 1)
231230
{
@@ -376,7 +375,7 @@ int run (int argc, char** argv)
376375
"argument is handled individually by any suite that accesses it -- "
377376
"as such, it typically only make sense to provide this when running "
378377
"a single suite.")
379-
("unittest-ipv4", "Use IPv4 localhost when running unittests (default is IPv6).")
378+
("unittest-ipv6", "Use IPv6 localhost when running unittests (default is IPv4).")
380379
("unittest-log",
381380
"Force unit test log message output. Only useful in combination with "
382381
"--quiet, in which case log messages will print but suite/case names "
@@ -457,7 +456,7 @@ int run (int argc, char** argv)
457456
bool (vm.count ("quiet")),
458457
bool (vm.count ("unittest-log")),
459458
unittestChild,
460-
bool (vm.count ("unittest-ipv4")),
459+
bool (vm.count ("unittest-ipv6")),
461460
numJobs,
462461
argc,
463462
argv);

0 commit comments

Comments
 (0)