Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test runner parameter for C++ standard #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions test/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
valgrind = "valgrind --error-exitcode=1"
gcov = "gcov -l "

gccflags = ("-std=c++0x -O0 -g "
gccflags = ("-O0 -g "
" -Wall -Wextra -Wpedantic "
" -Wno-unknown-pragmas"
" -Wno-unknown-warning"
Expand Down Expand Up @@ -66,21 +66,24 @@
"macro" : "-D", "incpath" : "-I",
"obj" : "",
"cov" : "-fprofile-arcs -ftest-coverage",
"link" : "-o "
"link" : "-o ",
"defaultStd": "-std=c++0x"
},
"clang" : {"exe": "clang++",
"clang" : {"exe": "clang++-10",
"flags" : gccflags,
"macro" : "-D", "incpath" : "-I",
"obj" : "",
"cov" : "-fprofile-arcs -ftest-coverage",
"link" : "-o "
"link" : "-o ",
"defaultStd": "-std=c++0x"
},
"msvc" : {"exe": "cl",
"flags" : " /W4 /EHsc ",
"macro" : "/D:", "incpath" : "/I:",
"obj" : "/Foc:",
"cov" : "",
"link" : "/link /out:"
"link" : "/link /out:",
"defaultStd": "/std:c++14"
}
}

Expand Down Expand Up @@ -164,6 +167,7 @@ def dependencies(source, searchpaths = [], sofar = Set()):
useValgrind = False
useGcov = False
doClean = False
stdOpt = None

# process input args
if len(argv) > 1:
Expand Down Expand Up @@ -192,7 +196,8 @@ def dependencies(source, searchpaths = [], sofar = Set()):
print " -c, --compiler (gcc|clang|msvc) select compiler"
print " --valgrind run test through valgrind"
print " --gcov run test through gcov"
print " --continue-on-fail continue running regardless of failed builds or tests";
print " --continue-on-fail continue running regardless of failed builds or tests"
print " -s <standard> option to select c++ standard, e.g. \"-std\""
exit(0)
elif arg == "--clean":
doClean = True
Expand All @@ -210,6 +215,10 @@ def dependencies(source, searchpaths = [], sofar = Set()):
if i+1 < len(argv):
compiler = argv[i+1]
next = i + 2
elif arg == '-s':
if i+1 < len(argv):
stdOpt = argv[i+1]
next = i + 2
else:
paths.append(arg)

Expand All @@ -231,6 +240,9 @@ def dependencies(source, searchpaths = [], sofar = Set()):
linkOpt = compilers[compiler]["link"]
coverageOpt = compilers[compiler]["cov"]

if not stdOpt:
stdOpt = compilers[compiler]["defaultStd"]

if useGcov:
compileopts = compileopts + " " + coverageOpt

Expand Down Expand Up @@ -277,7 +289,7 @@ def dependencies(source, searchpaths = [], sofar = Set()):


# compile and run tests
compilecmd = compileexec + " " + compileopts
compilecmd = compileexec + " " + stdOpt + " " + compileopts
print "compiler call: "
print compilecmd
print separator
Expand Down