def test_test_package_configs(self): client = TestClient() name = "Hello0" files = multi_config_files(name, test=True) client.save(files, clean_first=True) client.run("create . user/testing") self.assertIn("Hello Release Hello0", client.out) self.assertIn("Hello Debug Hello0", client.out)
def test_package_configs_test(self): client = TestClient() name = "Hello0" files = multi_config_files(name, test=True) client.save(files, clean_first=True) client.run("create . user/testing") self.assertIn("Hello Release Hello0", client.user_io.out) self.assertIn("Hello Debug Hello0", client.user_io.out)
def cmake_multi_test(self): if platform.system() not in ["Windows", "Darwin"]: return client = TestClient() client.save(multi_config_files("Hello0", test=False), clean_first=True) client.run("export . lasote/testing") client.run("install Hello0/0.1@lasote/testing --build=missing") client.save(package_files("Hello1", ["Hello0"]), clean_first=True) client.run("export . lasote/testing") if platform.system() == "Windows": generator = "Visual Studio 14 Win64" debug_install = '-s compiler="Visual Studio" -s compiler.version=14 -s compiler.runtime=MDd' release_install = '-s compiler="Visual Studio" -s compiler.version=14 -s compiler.runtime=MD' elif platform.system() == "Darwin": generator = "Xcode" debug_install = '' release_install = '' # better in one test instead of two, because install time is amortized for cmake_file in (cmake, cmake_targets, ): client.save({"conanfile.txt": conanfile, "CMakeLists.txt": cmake_file, "main.cpp": main}, clean_first=True) client.run('install . -s build_type=Debug %s --build=missing' % debug_install) client.run('install . -s build_type=Release %s --build=missing' % release_install) client.runner('cmake . -G "%s"' % generator, cwd=client.current_folder) self.assertNotIn("WARN: Unknown compiler '", client.user_io.out) self.assertNotIn("', skipping the version check...", client.user_io.out) client.runner('cmake --build . --config Debug', cwd=client.current_folder) hello_comand = os.sep.join([".", "Debug", "say_hello"]) client.runner(hello_comand, cwd=client.current_folder) self.assertIn("Hello0:Debug Hello1:Debug", client.user_io.out) self.assertIn("Hello0Def:Debug Hello1Def:Debug", client.user_io.out) self.assertIn("Hello Debug Hello1", client.user_io.out) self.assertIn("Hello Debug Hello0", client.user_io.out) client.runner('cmake --build . --config Release', cwd=client.current_folder) hello_comand = os.sep.join([".", "Release", "say_hello"]) client.runner(hello_comand, cwd=client.current_folder) self.assertIn("Hello0:Release Hello1:Release", client.user_io.out) self.assertIn("Hello0Def:Release Hello1Def:Release", client.user_io.out) self.assertIn("Hello Release Hello1", client.user_io.out) self.assertIn("Hello Release Hello0", client.user_io.out) if cmake_file == cmake_targets: self.assertIn("Conan: Using cmake targets configuration", client.user_io.out) else: self.assertIn("Conan: Using cmake global configuration", client.user_io.out)
def cmake_multi_test(self): if platform.system() not in ["Windows", "Darwin"]: return client = TestClient() client.save(multi_config_files("Hello0", test=False), clean_first=True) client.run("export . lasote/testing") client.run("install Hello0/0.1@lasote/testing --build=missing") client.save(package_files("Hello1", ["Hello0"]), clean_first=True) client.run("export . lasote/testing") if platform.system() == "Windows": generator = "Visual Studio 14 Win64" debug_install = '-s compiler="Visual Studio" -s compiler.version=14 -s compiler.runtime=MDd' release_install = '-s compiler="Visual Studio" -s compiler.version=14 -s compiler.runtime=MD' elif platform.system() == "Darwin": generator = "Xcode" debug_install = '' release_install = '' # better in one test instead of two, because install time is amortized for cmake_file in (cmake, cmake_targets, ): client.save({"conanfile.txt": conanfile, "CMakeLists.txt": cmake_file, "main.cpp": main}, clean_first=True) client.run('install . -s build_type=Debug %s --build=missing' % debug_install) client.run('install . -s build_type=Release %s --build=missing' % release_install) client.runner('cmake . -G "%s"' % generator, cwd=client.current_folder) self.assertNotIn("WARN: Unknown compiler '", client.user_io.out) self.assertNotIn("', skipping the version check...", client.user_io.out) client.runner('cmake --build . --config Debug', cwd=client.current_folder) hello_comand = os.sep.join([".", "Debug", "say_hello"]) client.runner(hello_comand, cwd=client.current_folder) self.assertIn("Hello0:Debug Hello1:Debug", client.user_io.out) self.assertIn("Hello0Def:Debug Hello1Def:Debug", client.user_io.out) self.assertIn("Hello Debug Hello1", client.user_io.out) self.assertIn("Hello Debug Hello0", client.user_io.out) client.runner('cmake --build . --config Release', cwd=client.current_folder) hello_comand = os.sep.join([".", "Release", "say_hello"]) client.runner(hello_comand, cwd=client.current_folder) self.assertIn("Hello0:Release Hello1:Release", client.user_io.out) self.assertIn("Hello0Def:Release Hello1Def:Release", client.user_io.out) self.assertIn("Hello Release Hello1", client.user_io.out) self.assertIn("Hello Release Hello0", client.user_io.out) if cmake_file == cmake_targets: self.assertIn("Conan: Using cmake targets configuration", client.user_io.out) else: self.assertIn("Conan: Using cmake global configuration", client.user_io.out)
def cmake_multi_test(self): client = TestClient() deps = None for name in ["Hello0", "Hello1", "Hello2"]: files = multi_config_files(name, test=False, deps=deps) client.save(files, clean_first=True) deps = [name] if name != "Hello2": client.run("export . lasote/stable") client.run('install . --build missing') client.run("build .") cmd = os.sep.join([".", "bin", "say_hello"]) client.runner(cmd, cwd=client.current_folder) self.assertIn("Hello Release Hello2 Hello Release Hello1 Hello Release Hello0", " ".join(str(client.user_io.out).splitlines())) client.runner(cmd + "_d", cwd=client.current_folder) self.assertIn("Hello Debug Hello2 Hello Debug Hello1 Hello Debug Hello0", " ".join(str(client.user_io.out).splitlines()))
def cmake_multi_test(self): client = TestClient() deps = None for name in ["Hello0", "Hello1", "Hello2"]: files = multi_config_files(name, test=False, deps=deps) client.save(files, clean_first=True) deps = [name] if name != "Hello2": client.run("export lasote/stable") client.run('install . --build missing') client.run("build") cmd = os.sep.join([".", "bin", "say_hello"]) client.runner(cmd, cwd=client.current_folder) self.assertIn("Hello Release Hello2 Hello Release Hello1 Hello Release Hello0", " ".join(str(client.user_io.out).splitlines())) client.runner(cmd + "_d", cwd=client.current_folder) self.assertIn("Hello Debug Hello2 Hello Debug Hello1 Hello Debug Hello0", " ".join(str(client.user_io.out).splitlines()))