Repository: spack/spack

Issue:
spack test run ginkgo fails (possibly a package.py issue)
```bash
$ spack test run ginkgo
==> Spack test q2skanytquj7fei7exr63kh44vtnjc7n
==> Testing package ginkgo-1.4.0-2m4wbkc
==> Error: TestFailure: 1 tests failed.


Executable 'test_install' expected in prefix, found in ./test_install instead

/home/vanessa/Desktop/Code/spack-vsoch/lib/spack/spack/package.py:1911, in _run_test_helper:
       1908
       1909        if installed:
       1910            msg = "Executable '{0}' expected in prefix".format(runner.name)
  >>   1911            msg += ", found in {0} instead".format(runner.path)
       1912            assert runner.path.startswith(self.spec.prefix), msg
       1913
       1914        try:


/home/vanessa/Desktop/Code/spack-vsoch/lib/spack/spack/build_environment.py:1051, in _setup_pkg_and_run:
       1048        tb_string = traceback.format_exc()
       1049
       1050        # build up some context from the offending package so we can
  >>   1051        # show that, too.
       1052        package_context = get_package_context(tb)
       1053
       1054        logfile = None

See test log for details:
  /home/vanessa/.spack/test/q2skanytquj7fei7exr63kh44vtnjc7n/ginkgo-1.4.0-2m4wbkc-test-out.txt

==> Error: 1 test(s) in the suite failed.
```


Discussion:
The problem in this case is in how the test is called in the `test()` method.  The error message states that the package expects `test_install` to be installed, which means the path it resolves to is expected to contain `self.prefix`.

There are a couple of issues with this stand-alone test:
1) The tests should *not* be run from under `self.prefix`; and
2) The `f` variable should include the `self.prefix` in its path.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/ginkgo/package.py b/var/spack/repos/builtin/packages/ginkgo/package.py
--- a/var/spack/repos/builtin/packages/ginkgo/package.py
+++ b/var/spack/repos/builtin/packages/ginkgo/package.py
@@ -173,13 +173,21 @@ def test(self):
         if self.spec.satisfies('@:1.3.0'):
             print("SKIPPED: smoke tests not supported with this Ginkgo version.")
             return
+
+        # The installation process installs tests and associated data
+        # in a non-standard subdirectory. Consequently, those files must
+        # be manually copied to the test stage here.
+        install_tree(self.prefix.smoke_tests,
+                     self.test_suite.current_test_cache_dir)
+
+        # Perform the test(s) created by setup_build_tests.
         files = [('test_install', [r'REFERENCE',
                                    r'correctly detected and is complete']),
                  ('test_install_cuda', [r'CUDA',
                                         r'correctly detected and is complete']),
                  ('test_install_hip', [r'HIP',
                                        r'correctly detected and is complete'])]
-        smoke_test_path = join_path(self.prefix, 'smoke_tests')
         for f, expected in files:
-            self.run_test(f, [], expected, skip_missing=True, installed=True,
-                          work_dir=smoke_test_path)
+            self.run_test(f, [], expected, skip_missing=True, installed=False,
+                          purpose="test: Running {0}".format(f),
+                          work_dir=self.test_suite.current_test_cache_dir)


Test patch: