<s> import qisys . error <EOL> import qibuild . config <EOL> import qibuild . cmake_builder <EOL> from qibuild import find <EOL> from qibuild . test . conftest import QiBuildAction <EOL> from qitoolchain . test . conftest import QiToolchainAction <EOL> import pytest <EOL> def test_find_target_in_project_cmake ( qibuild_action , record_messages ) : <EOL> qibuild_action . add_test_project ( "<STR_LIT>" ) <EOL> qibuild_action . add_test_project ( "<STR_LIT:hello>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:hello>" ) <EOL> record_messages . reset ( ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:hello>" , "<STR_LIT>" ) <EOL> assert record_messages . find ( "<STR_LIT>" ) <EOL> def test_find_target_in_toolchain_package_cmake ( cd_to_tmpdir , record_messages ) : <EOL> qibuild_action = QiBuildAction ( ) <EOL> qitoolchain_action = QiToolchainAction ( ) <EOL> build_worktree = qibuild_action . build_worktree <EOL> qibuild_action . add_test_project ( "<STR_LIT>" ) <EOL> qibuild_action . add_test_project ( "<STR_LIT:hello>" ) <EOL> world_package = qibuild_action ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> qitoolchain_action ( "<STR_LIT>" , "<STR_LIT:foo>" ) <EOL> qibuild . config . add_build_config ( "<STR_LIT:foo>" , toolchain = "<STR_LIT:foo>" ) <EOL> qitoolchain_action ( "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" , world_package ) <EOL> build_worktree . worktree . remove_project ( "<STR_LIT>" , from_disk = True ) <EOL> record_messages . reset ( ) <EOL> qibuild_action . chdir ( "<STR_LIT:hello>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" ) <EOL> assert record_messages . find ( "<STR_LIT>" ) <EOL> def test_find_target_in_build_dir ( qibuild_action , record_messages ) : <EOL> qibuild_action . add_test_project ( "<STR_LIT>" ) <EOL> qibuild_action . add_test_project ( "<STR_LIT:hello>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:hello>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:hello>" ) <EOL> record_messages . reset ( ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:hello>" , "<STR_LIT>" ) <EOL> assert record_messages . find ( find . library_name ( "<STR_LIT>" ) ) <EOL> rc = qibuild_action ( "<STR_LIT>" , "<STR_LIT:hello>" , "<STR_LIT>" , retcode = True ) <EOL> assert rc == <NUM_LIT:1> <EOL> def test_not_configured ( qibuild_action ) : <EOL> world_proj = qibuild_action . add_test_project ( "<STR_LIT>" ) <EOL> qibuild_action . chdir ( world_proj . path ) <EOL> with pytest . raises ( qibuild . cmake_builder . NotConfigured ) : <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_find_target_in_toolchain_package ( cd_to_tmpdir , record_messages ) : <EOL> qibuild_action = QiBuildAction ( ) <EOL> qitoolchain_action = QiToolchainAction ( ) <EOL> qibuild_action . add_test_project ( "<STR_LIT>" ) <EOL> qibuild_action . add_test_project ( "<STR_LIT:hello>" ) <EOL> world_package = qibuild_action ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> qitoolchain_action ( "<STR_LIT>" , "<STR_LIT:foo>" ) <EOL> qibuild . config . add_build_config ( "<STR_LIT:foo>" , toolchain = "<STR_LIT:foo>" ) <EOL> qitoolchain_action ( "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" , world_package ) <EOL> qibuild_action . chdir ( "<STR_LIT:hello>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" ) <EOL> record_messages . reset ( ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" ) <EOL> assert record_messages . find ( find . library_name ( "<STR_LIT>" ) ) <EOL> record_messages . reset ( ) <EOL> qibuild_action ( "<STR_LIT>" , "<STR_LIT:hello>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" ) <EOL> assert record_messages . find ( find . binary_name ( "<STR_LIT:hello>" ) ) <EOL> rc = qibuild_action ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:-c>" , "<STR_LIT:foo>" , retcode = True ) <EOL> assert rc == <NUM_LIT:1> </s>
