From 8a9a7659238982d44ee3e56ffac996c86b8507de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Mon, 25 Mar 2024 10:09:31 +0100
Subject: [PATCH] feat(arbor): install tests/examples

---
 packages/arbor/package.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/packages/arbor/package.py b/packages/arbor/package.py
index 9b0cb883..e22c547c 100644
--- a/packages/arbor/package.py
+++ b/packages/arbor/package.py
@@ -131,7 +131,30 @@ class Arbor(CMakePackage, CudaPackage):
 
         return args
 
+    # install tests and examples for post-deployment testing
+    @run_after("install")
+    def install_all_the_binaries(self):
+        mkdirp(prefix.bin.arbor_extra)
+        install(join_path(self.build_directory, "bin", "*"), prefix.bin.arbor_extra)
+
     @run_after("install", when="+python")
     @on_package_attributes(run_tests=True)
-    def install_test(self):
+    def install_test_python(self):
+        # something like python -m unittest discover -v -s python
+        # also for MPI: mpirun -n 4 -oversubscribe python -m unittest discover -v -s python
         python("-c", "import arbor")
+
+    @run_after('install')
+    @on_package_attributes(run_tests=True)
+    def install_test(self):
+        with working_dir(self.build_directory):
+            # Unit tests
+            Executable("bin/unit")()
+            Executable("bin/unit_modcc")()
+            # MPI tests
+            # => there's also unit-mpi requiring mpi
+            # Examples
+            examples = Executable("scripts/run_cpp_examples.sh")
+            examples()
+            # examples("\"mpirun -n 4 -oversubscribe\"")
+            Executable("scripts/test_executables.sh")()
-- 
GitLab