binutils: convert to new stand-alone test process (#37690)
This commit is contained in:
parent
37e95713f4
commit
9278c0df21
@ -2,6 +2,7 @@
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import os
|
||||
import re
|
||||
|
||||
import spack.build_systems.autotools
|
||||
@ -192,31 +193,36 @@ def flag_handler(self, name, flags):
|
||||
iflags.append("-Wl,-z,notext")
|
||||
return (iflags, None, flags)
|
||||
|
||||
def test(self):
|
||||
spec_vers = str(self.spec.version)
|
||||
def test_binaries(self):
|
||||
binaries = [
|
||||
"ar",
|
||||
"c++filt",
|
||||
"coffdump",
|
||||
"dlltool",
|
||||
"elfedit",
|
||||
"gprof",
|
||||
"ld",
|
||||
"nm",
|
||||
"objdump",
|
||||
"ranlib",
|
||||
"readelf",
|
||||
"size",
|
||||
"strings",
|
||||
]
|
||||
|
||||
checks = {
|
||||
"ar": spec_vers,
|
||||
"c++filt": spec_vers,
|
||||
"coffdump": spec_vers,
|
||||
"dlltool": spec_vers,
|
||||
"elfedit": spec_vers,
|
||||
"gprof": spec_vers,
|
||||
"ld": spec_vers,
|
||||
"nm": spec_vers,
|
||||
"objdump": spec_vers,
|
||||
"ranlib": spec_vers,
|
||||
"readelf": spec_vers,
|
||||
"size": spec_vers,
|
||||
"strings": spec_vers,
|
||||
}
|
||||
# Since versions can have mixed separator characters after the minor
|
||||
# version, just check the first two components
|
||||
version = str(self.spec.version.up_to(2))
|
||||
for _bin in binaries:
|
||||
reason = "checking version of {0} is {1}".format(_bin, version)
|
||||
with test_part(self, "test_binaries_{0}".format(_bin), purpose=reason):
|
||||
installed_exe = join_path(self.prefix.bin, _bin)
|
||||
if not os.path.exists(installed_exe):
|
||||
raise SkipTest("{0} is not installed".format(_bin))
|
||||
|
||||
for exe in checks:
|
||||
expected = checks[exe]
|
||||
reason = "test: ensuring version of {0} is {1}".format(exe, expected)
|
||||
self.run_test(
|
||||
exe, "--version", expected, installed=True, purpose=reason, skip_missing=True
|
||||
)
|
||||
exe = which(installed_exe)
|
||||
out = exe("--version", output=str.split, error=str.split)
|
||||
assert version in out
|
||||
|
||||
|
||||
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
|
||||
|
Loading…
Reference in New Issue
Block a user