Some style
This commit is contained in:
parent
1d3ae96ae6
commit
f7b3d58b73
@ -2,22 +2,21 @@
|
|||||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
import llnl.util.tty as tty
|
import glob
|
||||||
import importlib
|
import importlib
|
||||||
import inspect
|
import inspect
|
||||||
import glob
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import llnl.util.filesystem as fs
|
import llnl.util.filesystem as fs
|
||||||
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
import spack.builder
|
|
||||||
import spack.build_systems.cmake
|
import spack.build_systems.cmake
|
||||||
|
import spack.builder
|
||||||
import spack.util.log_parse
|
import spack.util.log_parse
|
||||||
|
|
||||||
from spack.builder import run_after
|
from spack.builder import run_after
|
||||||
from spack.directives import depends_on, variant, requires
|
from spack.directives import depends_on, requires, variant
|
||||||
from spack.package import CMakePackage
|
from spack.package import CMakePackage
|
||||||
|
|
||||||
|
|
||||||
@ -31,6 +30,7 @@ class CTestBuilder(spack.build_systems.cmake.CMakeBuilder):
|
|||||||
like regression tests that can be used to monitior differences in behavior/performance
|
like regression tests that can be used to monitior differences in behavior/performance
|
||||||
without failing the install.
|
without failing the install.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
phases = ("cmake", "build", "install", "analysis")
|
phases = ("cmake", "build", "install", "analysis")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -46,14 +46,16 @@ def std_cmake_args(self):
|
|||||||
"""
|
"""
|
||||||
args = super().std_cmake_args
|
args = super().std_cmake_args
|
||||||
if self.spec.variants["cdash_submit"].value:
|
if self.spec.variants["cdash_submit"].value:
|
||||||
args.extend([
|
args.extend(
|
||||||
|
[
|
||||||
"-D",
|
"-D",
|
||||||
f"BUILDNAME={self.pkg.spec.name}",
|
f"BUILDNAME={self.pkg.spec.name}",
|
||||||
"-D",
|
"-D",
|
||||||
f"CTEST_BUILD_OPTIONS={self.pkg.spec.short_spec}",
|
f"CTEST_BUILD_OPTIONS={self.pkg.spec.short_spec}",
|
||||||
"-D",
|
"-D",
|
||||||
"SITE=TODO"
|
"SITE=TODO",
|
||||||
])
|
]
|
||||||
|
)
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def ctest_args(self):
|
def ctest_args(self):
|
||||||
@ -84,7 +86,7 @@ def build_args(self):
|
|||||||
"Configure",
|
"Configure",
|
||||||
"-T",
|
"-T",
|
||||||
"Build",
|
"Build",
|
||||||
"-VV"
|
"-VV",
|
||||||
]
|
]
|
||||||
return args
|
return args
|
||||||
|
|
||||||
@ -93,11 +95,7 @@ def submit_args(self):
|
|||||||
"""
|
"""
|
||||||
CTest arguments just for sumbmission. Allows us to split phases, where default CTest behavior is to configure, build, test and submit from a single command.
|
CTest arguments just for sumbmission. Allows us to split phases, where default CTest behavior is to configure, build, test and submit from a single command.
|
||||||
"""
|
"""
|
||||||
args = [
|
args = ["-T", "Submit", "-V"]
|
||||||
"-T",
|
|
||||||
"Submit",
|
|
||||||
"-V"
|
|
||||||
]
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def submit_cdash(self, pkg, spec, prefix):
|
def submit_cdash(self, pkg, spec, prefix):
|
||||||
@ -106,7 +104,6 @@ def submit_cdash(self, pkg, spec, prefix):
|
|||||||
build_env = os.environ.copy()
|
build_env = os.environ.copy()
|
||||||
ctest(*self.submit_args, env=build_env)
|
ctest(*self.submit_args, env=build_env)
|
||||||
|
|
||||||
|
|
||||||
def build(self, pkg, spec, prefix):
|
def build(self, pkg, spec, prefix):
|
||||||
"""
|
"""
|
||||||
The only reason to run through the CTest interface is if we want to submit to CDash with
|
The only reason to run through the CTest interface is if we want to submit to CDash with
|
||||||
@ -120,7 +117,9 @@ def build(self, pkg, spec, prefix):
|
|||||||
build_env = os.environ.copy()
|
build_env = os.environ.copy()
|
||||||
# have ctest run, but we still want to submit if there are build failures where spack would stop.
|
# have ctest run, but we still want to submit if there are build failures where spack would stop.
|
||||||
# check for errors and submit to cdash if there are failures
|
# check for errors and submit to cdash if there are failures
|
||||||
output = ctest(*self.build_args, env=build_env, output=str.split, error=str.split).split("\n")
|
output = ctest(
|
||||||
|
*self.build_args, env=build_env, output=str.split, error=str.split
|
||||||
|
).split("\n")
|
||||||
errors, warnings = spack.util.log_parse.parse_log_events(output)
|
errors, warnings = spack.util.log_parse.parse_log_events(output)
|
||||||
if len(errors) > 0:
|
if len(errors) > 0:
|
||||||
errs = [str(e) for e in errors]
|
errs = [str(e) for e in errors]
|
||||||
@ -156,6 +155,7 @@ class CtestPackage(CMakePackage):
|
|||||||
"""
|
"""
|
||||||
This package's default behavior is to act as a Standard CMakePackage,
|
This package's default behavior is to act as a Standard CMakePackage,
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CMakeBuilder = CTestBuilder
|
CMakeBuilder = CTestBuilder
|
||||||
variant("cdash_submit", default=False, description="Submit results to cdash")
|
variant("cdash_submit", default=False, description="Submit results to cdash")
|
||||||
variant("ctest_args", default="", description="quoted string of arguments to send to ctest")
|
variant("ctest_args", default="", description="quoted string of arguments to send to ctest")
|
||||||
@ -190,4 +190,3 @@ def copy_compile_commands(self):
|
|||||||
source = os.path.join(self.build_directory, "compile_commands.json")
|
source = os.path.join(self.build_directory, "compile_commands.json")
|
||||||
if os.path.isfile(source):
|
if os.path.isfile(source):
|
||||||
shutil.copyfile(source, target)
|
shutil.copyfile(source, target)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user