def test_fullclean(self): """Tests distclean command call. """ waf = ModuleBuild.create("waf") self.assertNotEqual(waf, None) self.assertEqual(waf.name(), "waf") # Environment settings mercurial = ModuleSource.create("mercurial") testResult = mercurial.check_version(self._env) self.assertTrue(testResult) mercurial.attribute("url").value = "http://code.nsnam.org/bhurd/openflow" self._env._module_name="openflow-ns3" self._env._module_dir="openflow-ns3" self._env._objdir = "/tmp/object_openflow" self._env._installdir = "/tmp/install_openflow" testStatus = commands.getoutput('rm -rf /tmp/source') self._logger.set_current_module(self._env._module_name) testResult = mercurial.download(self._env) self.assertEqual(testResult, None) self._env.start_build("openflow-ns3", "/tmp/source/openflow-ns3", True) waf.attribute('configure_arguments').value = 'configure --prefix='+ self._env.installdir + ' --destdir=' + self._env.installdir + ' --blddir=' + self._env.objdir try: testResult = waf.build(self._env, "1") except TaskError as t: print(t.reason) self.assertEqual(testResult, None) testStatus = os.path.isdir('/tmp/source/openflow-ns3') self.assertTrue(testStatus) testStatus = os.path.isdir('/tmp/object_openflow') self.assertTrue(testStatus) module = Module(self._env._module_name, mercurial, waf) module._module_supports_objdir = True self._env.end_build() try: testResult = module.fullclean(self._env) except TaskError as t: print(t.reason) self.assertTrue(testResult) testStatus = os.path.isdir('/tmp/source/openflow-ns3') self.assertFalse(testStatus) testStatus = os.path.isdir('/tmp/source/object_openflow') self.assertFalse(testStatus) testStatus = os.path.isdir('/tmp/source/install_openflow') self.assertFalse(testStatus)
def _read_metadata(self, et): """ Reads the elements from the xml configuration files and add it to the internal list of modules. """ # function designed to be called on two kinds of xml files. modules = et.findall('modules/module') for module_node in modules: name = module_node.get('name') installed = self._read_installed(module_node) source_node = module_node.find('source') source = self._create_obj_from_node(source_node, ModuleSource, 'source', name) build_node = module_node.find('build') build = self._create_obj_from_node(build_node, ModuleBuild, 'build', name) # self._read_libpath(build_node, build) dependencies = [] for dep_node in module_node.findall('depends_on'): dependencies.append( ModuleDependency( dep_node.get('name'), bool(dep_node.get('optional', '').upper() == 'TRUE'))) module = Module( name, source, build, dependencies=dependencies, built_once=bool( module_node.get('built_once', '').upper() == 'TRUE'), installed=installed) self._modules.append(module)