sanitycheck: support ninja builder

Add an option to support building with ninja instead of make.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-12-30 13:01:06 -05:00 committed by Anas Nashif
commit a8a1388ae4

View file

@ -753,6 +753,7 @@ class MakeGenerator:
MAKE_RULE_TMPL = """\t@echo sanity_test_{phase} {goal} >&2
\tcmake \\
\t\t-G"{generator}"\\
\t\t-H{directory}\\
\t\t-B{outdir}\\
\t\t-DEXTRA_CFLAGS="-Werror {cflags}"\\
@ -760,8 +761,8 @@ class MakeGenerator:
\t\t-DEXTRA_LDFLAGS="{ldflags}"\\
\t\t{args}\\
\t\t>{logfile} 2>&1
\t$(MAKE) -C {outdir}\\
\t\tVERBOSE={verb} {make_args}\\
\t{generator_cmd} -C {outdir}\\
\t\t{verb} {make_args}\\
\t\t>>{logfile} 2>&1
"""
@ -796,7 +797,6 @@ class MakeGenerator:
@param args Arguments given to CMake
@param make_args Arguments given to the Makefile generated by CMake
"""
verb = "1" if VERBOSE else "0"
args = " ".join(["-D{}".format(a) for a in args])
ldflags = ""
@ -811,7 +811,18 @@ class MakeGenerator:
if not "native_posix" in args:
ldflags="-Wl,--fatal-warnings"
if options.ninja:
generator = "Ninja"
generator_cmd = "ninja"
verb = "-v" if VERBOSE else ""
else:
generator = "Unix Makefiles"
generator_cmd = "$(MAKE)"
verb = "VERBOSE=1" if VERBOSE else "VERBOSE=0"
return MakeGenerator.MAKE_RULE_TMPL.format(
generator=generator,
generator_cmd=generator_cmd,
phase=phase,
goal=name,
outdir=outdir,
@ -2046,6 +2057,11 @@ def parse_arguments():
"3/5 means run the 3rd fifth of the total. "
"This option is useful when running a large number of tests on "
"different hosts to speed up execution time.")
parser.add_argument(
"-N", "--ninja", action="store_true",
help="Use the Ninja generator with CMake")
parser.add_argument(
"-y", "--dry-run", action="store_true",
help="Create the filtered list of test cases, but don't actually "