def check_install(self): spec = self.spec test_env = {} # Make sure the correct config is found test_env["BH_CONFIG"] = self.config_file # Remove the lib/spackenv directory from the PATH variable when # executing the tests, becauses it messes with the JIT compilation # inside Bohrium paths = os.environ['PATH'].split(':') paths = [p for p in paths if "spack/env" not in p] test_env["PATH"] = ":".join(paths) # Add the PYTHONPATH to bohrium to the PYTHONPATH environment pythonpaths = [p for p in os.environ["PYTHONPATH"].split(":")] pythonpaths.append( join_path(self.prefix, spec['python'].package.site_packages_dir)) test_env["PYTHONPATH"] = ":".join(pythonpaths) # Collect the stacks which should be available: stacks = ["default"] if "+openmp" in spec: stacks.append("openmp") if "+cuda" in spec: stacks.append("cuda") if "+opencl" in spec: stacks.append("opencl") # C++ compiler and compiler flags cxx = Executable(self.compiler.cxx) cxx_flags = [ "-I", self.prefix.include, "-I", self.prefix.include.bohrium, "-L", self.prefix.lib, "-lbh", "-lbhxx" ] # Compile C++ test program file_cxxadd = join_path(os.path.dirname(self.module.__file__), "cxxadd.cpp") cxx("-o", "test_cxxadd", file_cxxadd, *cxx_flags) test_cxxadd = Executable("./test_cxxadd") # Build python test commandline file_pyadd = join_path(os.path.dirname(self.module.__file__), "pyadd.py") test_pyadd = Executable(spec['python'].command.path + " " + file_pyadd) # Run tests for each available stack for bh_stack in stacks: tty.info("Testing with bohrium stack '" + bh_stack + "'") test_env["BH_STACK"] = bh_stack cpp_output = test_cxxadd(output=str, env=test_env) compare_output(cpp_output, "Success!\n") # Python test (if +python) if "+python" in spec: py_output = test_pyadd(output=str, env=test_env) compare_output(py_output, "Success!\n")
def check_install(self): spec = self.spec test_env = {} # Make sure the correct config is found test_env["BH_CONFIG"] = self.config_file # Remove the lib/spackenv directory from the PATH variable when # executing the tests, becauses it messes with the JIT compilation # inside Bohrium paths = os.environ['PATH'].split(':') paths = [p for p in paths if "spack/env" not in p] test_env["PATH"] = ":".join(paths) # Add the PYTHONPATH to bohrium to the PYTHONPATH environment pythonpaths = [p for p in os.environ["PYTHONPATH"].split(":")] pythonpaths.append(join_path(self.prefix, spec['python'].package.site_packages_dir)) test_env["PYTHONPATH"] = ":".join(pythonpaths) # Collect the stacks which should be available: stacks = ["default"] if "+openmp" in spec: stacks.append("openmp") if "+cuda" in spec: stacks.append("cuda") if "+opencl" in spec: stacks.append("opencl") # C++ compiler and compiler flags cxx = Executable(self.compiler.cxx) cxx_flags = ["-I", self.prefix.include, "-I", self.prefix.include.bohrium, "-L", self.prefix.lib, "-lbh", "-lbhxx"] # Compile C++ test program file_cxxadd = join_path(os.path.dirname(self.module.__file__), "cxxadd.cpp") cxx("-o", "test_cxxadd", file_cxxadd, *cxx_flags) test_cxxadd = Executable("./test_cxxadd") # Build python test commandline file_pyadd = join_path(os.path.dirname(self.module.__file__), "pyadd.py") test_pyadd = Executable(spec['python'].command.path + " " + file_pyadd) # Run tests for each available stack for bh_stack in stacks: tty.info("Testing with bohrium stack '" + bh_stack + "'") test_env["BH_STACK"] = bh_stack cpp_output = test_cxxadd(output=str, env=test_env) compare_output(cpp_output, "Success!\n") # Python test (if +python) if "+python" in spec: py_output = test_pyadd(output=str, env=test_env) compare_output(py_output, "Success!\n")