diff --git a/var/spack/repos/builtin/packages/improved-rdock/package.py b/var/spack/repos/builtin/packages/improved-rdock/package.py index 58aea89941a35e..1adef52b675ecd 100644 --- a/var/spack/repos/builtin/packages/improved-rdock/package.py +++ b/var/spack/repos/builtin/packages/improved-rdock/package.py @@ -63,33 +63,41 @@ def install(self, spec, prefix): def setup_run_environment(self, env): env.set("RBT_ROOT", self.prefix) - def test(self): + def test_rdock(self): + """improved-rdock test suite""" copy(join_path(self.prefix.example, "1sj0", "*"), ".") - opts = ["-r", "1sj0_rdock.prm", "-was"] - self.run_test("rbcavity", options=opts) - - mpiexe = self.spec["mpi"].prefix.bin.mpirun - opts = [ - self.prefix.bin.rbdock, - "-r", - "1sj0_rdock.prm", - "-p", - "dock.prm", - "-n", - "100", - "-i", - "1sj0_ligand.sd", - "-o", - "1sj0_docking_out", - "-s", - "1", - ] - self.run_test(str(mpiexe), options=opts) - - opts = [join_path(self.test_suite.current_test_data_dir, "test.sh")] - self.run_test("bash", options=opts) - - pythonexe = self.spec["python"].command.path - opts = [self.spec.prefix.bin.sdrmsd, "1sj0_ligand.sd", "1sj0_docking_out_sorted.sd"] - expected = ["1\t0.55", "100\t7.91"] - self.run_test(pythonexe, options=opts, expected=expected) + + with test_part(self, "test_rdock_rbcavity", purpose="Check rbcavity"): + rbcavity = which("rbcavity") + rbcavity("-r", "1sj0_rdock.prm", "-was") + + with test_part(self, "test_rdock_rbdock", purpose="Use mpirun to run rbdock in parallel"): + mpiexe = which(str(self.spec["mpi"].prefix.bin.mpirun)) + opts = [ + self.prefix.bin.rbdock, + "-r", + "1sj0_rdock.prm", + "-p", + "dock.prm", + "-n", + "100", + "-i", + "1sj0_ligand.sd", + "-o", + "1sj0_docking_out", + "-s", + "1", + ] + mpiexe(*opts) + + with test_part(self, "test_rdock_test_sh", purpose="Sort the output"): + bash = which("bash") + opts = [join_path(self.test_suite.current_test_data_dir, "test.sh")] + bash(*opts) + + with test_part(self, "test_rdock_sdrmsd", purpose="Check sdrmsd calculations"): + pythonexe = which(str(self.spec["python"].command.path)) + opts = [self.spec.prefix.bin.sdrmsd, "1sj0_ligand.sd", "1sj0_docking_out_sorted.sd"] + expected = ["1\t0.55", "100\t7.91"] + out = pythonexe(*opts, out=str.split, error=str.split) + check_outputs(expected, out)