summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2023-05-29 02:59:09 -0700
committerGitHub <noreply@github.com>2023-05-29 11:59:09 +0200
commit9278c0df21faf095b6563149bfca9295f4078327 (patch)
tree093f83520abddfe11f0794198040019a8fd36ef7
parent37e95713f4bbb01f4e029d28c4261548e4aea12e (diff)
downloadspack-9278c0df21faf095b6563149bfca9295f4078327.tar.gz
spack-9278c0df21faf095b6563149bfca9295f4078327.tar.bz2
spack-9278c0df21faf095b6563149bfca9295f4078327.tar.xz
spack-9278c0df21faf095b6563149bfca9295f4078327.zip
binutils: convert to new stand-alone test process (#37690)
-rw-r--r--var/spack/repos/builtin/packages/binutils/package.py56
1 files changed, 31 insertions, 25 deletions
diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py
index 0bec2ca1a2..e182d2236e 100644
--- a/var/spack/repos/builtin/packages/binutils/package.py
+++ b/var/spack/repos/builtin/packages/binutils/package.py
@@ -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 @@ class Binutils(AutotoolsPackage, GNUMirrorPackage):
iflags.append("-Wl,-z,notext")
return (iflags, None, flags)
- def test(self):
- spec_vers = str(self.spec.version)
-
- 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,
- }
-
- 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
- )
+ def test_binaries(self):
+ binaries = [
+ "ar",
+ "c++filt",
+ "coffdump",
+ "dlltool",
+ "elfedit",
+ "gprof",
+ "ld",
+ "nm",
+ "objdump",
+ "ranlib",
+ "readelf",
+ "size",
+ "strings",
+ ]
+
+ # 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))
+
+ exe = which(installed_exe)
+ out = exe("--version", output=str.split, error=str.split)
+ assert version in out
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):