Skip to content

Commit

Permalink
tests/flibcpp: convert to new stand-alone test process (spack#37782)
Browse files Browse the repository at this point in the history
  • Loading branch information
tldahlgren committed May 28, 2023
1 parent 9f6d9df commit 935f862
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions var/spack/repos/builtin/packages/flibcpp/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class Flibcpp(CMakePackage):
git = "https://github.com/swig-fortran/flibcpp.git"
url = "https://github.com/swig-fortran/flibcpp/archive/v1.0.1.tar.gz"

test_requires_compiler = True

version("1.0.2", sha256="e2c11c1f58ca830eb7ac7f25d66fc3502c4a8d994192ee30c63a1c3b51aac241")
version("1.0.1", sha256="8569c71eab0257097a6aa666a6d86bdcb6cd6e31244d32cc5b2478d0e936ca7a")
version("0.5.2", sha256="b9b4eb6431d5b56a54c37f658df7455eafd3d204a5534903b127e0c8a1c9b827")
Expand Down Expand Up @@ -73,25 +75,18 @@ def cached_tests_work_dir(self):
"""The working directory for cached test sources."""
return join_path(self.test_suite.current_test_cache_dir, self.examples_src_dir)

def test(self):
"""Perform stand-alone/smoke tests."""
def test_examples(self):
"""build and run examples"""
cmake_args = [
self.define("CMAKE_PREFIX_PATH", self.prefix),
self.define("CMAKE_Fortran_COMPILER", self.compiler.fc),
]
cmake_args.append(self.cached_tests_work_dir)

self.run_test(
"cmake", cmake_args, purpose="test: calling cmake", work_dir=self.cached_tests_work_dir
)

self.run_test(
"make", [], purpose="test: building the tests", work_dir=self.cached_tests_work_dir
)

self.run_test(
"run-examples.sh",
[],
purpose="test: running the examples",
work_dir=self.cached_tests_work_dir,
)
cmake = which(self.spec["cmake"].prefix.bin.cmake)
make = which("make")
sh = which("sh")

with working_dir(self.cached_tests_work_dir):
cmake(*cmake_args)
make()
sh("run-examples.sh")

0 comments on commit 935f862

Please sign in to comment.