emacs: convert to new stand-alone test process (#37725)

This commit is contained in:
Tamara Dahlgren 2023-05-16 21:25:35 -07:00 committed by GitHub
parent 67e74da3ba
commit ffa5962356
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import sys import sys
from spack.package import * from spack.package import *
@ -97,18 +98,32 @@ def configure_args(self):
return args return args
def _test_check_versions(self): def run_version_check(self, bin):
"""Perform version checks on installed package binaries.""" """Runs and checks output of the installed binary."""
checks = ["ctags", "ebrowse", "emacs", "emacsclient", "etags"] exe_path = join_path(self.prefix.bin, bin)
if not os.path.exists(exe_path):
raise SkipTest(f"{exe_path} is not installed")
for exe in checks: exe = which(exe_path)
expected = str(self.spec.version) out = exe("--version", output=str.split, error=str.split)
reason = "test version of {0} is {1}".format(exe, expected) assert str(self.spec.version) in out
self.run_test(
exe, ["--version"], expected, installed=True, purpose=reason, skip_missing=True
)
def test(self): def test_ctags(self):
"""Perform smoke tests on the installed package.""" """check ctags version"""
# Simple version check tests on known binaries self.run_version_check("ctags")
self._test_check_versions()
def test_ebrowse(self):
"""check ebrowse version"""
self.run_version_check("ebrowse")
def test_emacs(self):
"""check emacs version"""
self.run_version_check("emacs")
def test_emacsclient(self):
"""check emacsclient version"""
self.run_version_check("emacsclient")
def test_etags(self):
"""check etags version"""
self.run_version_check("etags")