def test_collect_path_env(self):
     ''' makes sure the SDE can collect path env '''
     scopes = ("global", )
     tree = uefi_tree(self.workspace, create_platform=False)
     tree.create_path_env("testing_corebuild",
                          var_name="hey",
                          flags=[
                              "set_path",
                          ])
     tree.create_path_env("testing_corebuild2",
                          var_name="hey",
                          flags=[
                              "set_pypath",
                          ])
     tree.create_path_env("testing_corebuild3",
                          var_name="hey",
                          flags=[
                              "set_build_var",
                          ])
     tree.create_path_env("testing_corebuild4",
                          var_name="hey",
                          flags=[
                              "set_shell_var",
                          ])
     build_env, shell_env = self_describing_environment.BootstrapEnvironment(
         self.workspace, scopes)
     self.assertEqual(len(build_env.paths), 4)
 def test_init(self):
     WORKSPACE = self.get_temp_folder()
     tree = uefi_tree(WORKSPACE)
     settings_filepath = tree.get_settings_provider_path()
     sys.argv = ["stuart_update", "-c", settings_filepath]
     builder = Edk2Update()
     self.assertIsNotNone(builder)
 def test_collect_path_env_scoped(self):
     ''' makes sure the SDE can collect path env with the right scopes '''
     scopes = ("global", "testing")
     tree = uefi_tree(self.workspace, create_platform=False)
     tree.create_path_env("testing_corebuild", scope="testing")
     tree.create_path_env("testing_corebuild2", scope="not_valid")
     build_env, shell_env = self_describing_environment.BootstrapEnvironment(
         self.workspace, scopes)
     self.assertEqual(len(build_env.paths), 1)
예제 #4
0
 def test_duplicate_id_path_env(self):
     ''' check that the SDE will throw an exception if path_env have duplicate id's '''
     custom_scope = "global"
     scopes = (custom_scope,)
     tree = uefi_tree(self.workspace, create_platform=False)
     tree.create_path_env("testing_corebuild", dir_path="test1")
     tree.create_path_env("testing_corebuild")
     with self.assertRaises(RuntimeError):
         self_describing_environment.BootstrapEnvironment(self.workspace, scopes)
예제 #5
0
 def test_override_path_env(self):
     ''' checks the SDE descriptor override system '''
     custom_scope = "global"
     scopes = (custom_scope,)
     tree = uefi_tree(self.workspace, create_platform=False)
     tree.create_path_env("testing_corebuild", var_name="hey", dir_path="test1", scope=custom_scope)
     tree.create_path_env("testing_corebuild2", var_name="jokes", scope=custom_scope,
                          extra_data={"override_id": "testing_corebuild"})
     build_env, shell_env = self_describing_environment.BootstrapEnvironment(self.workspace, scopes)
     print(build_env.paths)
     print(tree.get_workspace())
     self.assertEqual(len(build_env.paths), 1)
 def test_bad_ext_dep(self):
     ''' makes sure we can do an update that will fail '''
     WORKSPACE = self.get_temp_folder()
     tree = uefi_tree(WORKSPACE)
     logging.getLogger().setLevel(logging.WARNING)
     # we know this version is bad
     tree.create_Edk2TestUpdate_ext_dep("0.0.0")
     # Do the update
     updater = self.invoke_update(tree.get_settings_provider_path(),
                                  failure_expected=True)
     build_env, shell_env, failure = updater.PerformUpdate()
     # we should have no failures
     self.assertEqual(failure, 1)
 def test_override_path_env_swapped_order(self):
     ''' checks the SDE descriptor override system with reversed paths so they are discovered in opposite order'''
     custom_scope = "global"
     scopes = (custom_scope, )
     tree = uefi_tree(self.workspace, create_platform=False)
     tree.create_path_env("testing_corebuild",
                          var_name="hey",
                          scope=custom_scope)
     tree.create_path_env(var_name="jokes",
                          dir_path="test1",
                          scope=custom_scope,
                          extra_data={"override_id": "testing_corebuild"})
     build_env, shell_env = self_describing_environment.BootstrapEnvironment(
         self.workspace, scopes)
     self.assertEqual(len(build_env.paths), 1)
 def test_multiple_extdeps(self):
     ''' makes sure we can do multiple ext_deps at the same time '''
     WORKSPACE = self.get_temp_folder()
     tree = uefi_tree(WORKSPACE)
     num_of_ext_deps = 5
     logging.getLogger().setLevel(logging.WARNING)
     tree.create_ext_dep("nuget", "NuGet.CommandLine", "5.2.0")
     tree.create_ext_dep("nuget", "NuGet.LibraryModel", "5.6.0")
     tree.create_ext_dep("nuget", "NuGet.Versioning", "5.6.0")
     tree.create_ext_dep("nuget", "NuGet.Packaging.Core", "5.6.0")
     tree.create_ext_dep("nuget", "NuGet.RuntimeModel", "4.2.0")
     # Do the update
     updater = self.invoke_update(tree.get_settings_provider_path())
     build_env, shell_env, failure = updater.PerformUpdate()
     # we should have no failures
     self.assertEqual(failure, 0)
     # we should have found two ext deps
     self.assertEqual(len(build_env.extdeps), num_of_ext_deps)
 def test_one_level_recursive(self):
     ''' makes sure we can do a recursive update '''
     WORKSPACE = self.get_temp_folder()
     tree = uefi_tree(WORKSPACE)
     logging.getLogger().setLevel(logging.WARNING)
     tree.create_Edk2TestUpdate_ext_dep()
     # Do the update
     updater = self.invoke_update(tree.get_settings_provider_path())
     # make sure it worked
     self.assertTrue(
         os.path.exists(
             os.path.join(WORKSPACE, "Edk2TestUpdate_extdep",
                          "NuGet.CommandLine_extdep", "extdep_state.json")))
     build_env, shell_env, failure = updater.PerformUpdate()
     # we should have no failures
     self.assertEqual(failure, 0)
     # we should have found two ext deps
     self.assertEqual(len(build_env.extdeps), 2)
 def test_multiple_override_path_env(self):
     ''' checks the SDE descriptor override system will throw an error on multiple overrides'''
     custom_scope = "global"
     scopes = (custom_scope, )
     tree = uefi_tree(self.workspace, create_platform=False)
     tree.create_path_env("testing_corebuild",
                          var_name="hey",
                          dir_path="test1",
                          scope=custom_scope)
     tree.create_path_env("testing_corebuild2",
                          var_name="jokes",
                          scope=custom_scope,
                          extra_data={"override_id": "testing_corebuild"})
     tree.create_path_env("testing_corebuild3",
                          var_name="laughs",
                          scope=custom_scope,
                          extra_data={"override_id": "testing_corebuild"})
     # we should get an exception because we have two overrides
     with self.assertRaises(RuntimeError):
         build_env, shell_env = self_describing_environment.BootstrapEnvironment(
             self.workspace, scopes)
         self.fail()
예제 #11
0
 def setUp(self):
     TestEdk2CiSetup.restart_logging()
     tree = uefi_tree()
     self.minimalTree = tree.get_workspace()
     print(self.minimalTree)
     pass
예제 #12
0
 def setUp(self):
     TestEdk2PlatBuild.restart_logging()
     tree = uefi_tree()
     self.minimalTree = tree.get_workspace()
     pass