188 self.assertEqual(testResult, None) |
188 self.assertEqual(testResult, None) |
189 testStatus = commands.getoutput('ls -l /tmp/source/openflow-ns3/object|wc') |
189 testStatus = commands.getoutput('ls -l /tmp/source/openflow-ns3/object|wc') |
190 created = re.compile('\d+').search(testStatus).group() |
190 created = re.compile('\d+').search(testStatus).group() |
191 self.assertNotEqual(created, "0") |
191 self.assertNotEqual(created, "0") |
192 |
192 |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 # TODO: |
193 # TODO: |
199 # test if the object dir is equal to the source dir, for the open flow |
194 # test if the object dir is equal to the source dir, for the open flow |
200 # case it is not allowed but I am not sure for everyone else |
195 # case it is not allowed but I am not sure for everyone else |
201 try: |
196 try: |
202 testResult = waf.build(self._env, "1") |
197 testResult = waf.build(self._env, "1") |
295 # non existing path |
290 # non existing path |
296 # need to find a good case of test for this |
291 # need to find a good case of test for this |
297 # testResult = waf._is_1_6_x(self._env) |
292 # testResult = waf._is_1_6_x(self._env) |
298 # self.assertFalse(testResult) |
293 # self.assertFalse(testResult) |
299 |
294 |
|
295 def test_CmakeModule(self): |
|
296 """Tests the WafModuleBuild Class from ModuleBuild. """ |
|
297 |
|
298 cmake = ModuleBuild.create("cmake") |
|
299 self.assertNotEqual(cmake, None) |
|
300 self.assertEqual(cmake.name(), "cmake") |
|
301 |
|
302 # Environment settings |
|
303 cvs = ModuleSource.create("cvs") |
|
304 testResult = cvs.check_version(self._env) |
|
305 self.assertTrue(testResult) |
|
306 cvs.attribute("root").value = ":pserver:anoncvs:@www.gccxml.org:/cvsroot/GCC_XML" |
|
307 cvs.attribute("module").value="gccxml" |
|
308 cvs.attribute("date").value="2009-09-21" |
|
309 |
|
310 self._env._module_name="gccxml" |
|
311 self._logger.set_current_module(self._env._module_name) |
|
312 # bazaar.attribute("revision").value = "revno:795" |
|
313 |
|
314 testStatus = commands.getoutput('mkdir /tmp/source') |
|
315 testResult = cvs.download(self._env) |
|
316 self.assertEqual(testResult, None) |
|
317 |
|
318 #check that has the cmake version required is installed in the machine |
|
319 testResult = cmake.check_version(self._env) |
|
320 self.assertTrue(testResult) |
|
321 |
|
322 # Expected case test |
|
323 |
|
324 self._env.objdir = self._env.srcdir+"/object" |
|
325 testStatus = commands.getoutput('rm -rf /tmp/source/gccxml/object') |
|
326 testResult = cmake.build(self._env, "1") |
|
327 self.assertEqual(testResult, None) |
|
328 testStatus = commands.getoutput('ls /tmp/source/gccxml/object|wc') |
|
329 created = re.compile('\d+').search(testStatus).group() |
|
330 self.assertNotEqual(created, "0") |
|
331 |
|
332 # call the clean to remove the build |
|
333 # TODO: Find a solution for the remaining directories |
|
334 # - It is strange because the waf does not remove the directories, |
|
335 # just the object files.... Should this be like that??!?! |
|
336 testResult = cmake.clean(self._env) |
|
337 self.assertEqual(testResult, None) |
|
338 testStatus = commands.getoutput('ls /tmp/source/gccxml/object/GCC/gcc/CMakeFiles/backend.dir/*.o|wc') |
|
339 created = re.compile('\d+').search(testStatus).group() |
|
340 self.assertEqual(created, "0") |
|
341 |
|
342 # TODO: neighter the --generate-version appears but I couldn't also |
|
343 # find a configuration argument for pybindgen :( |
|
344 # Call with extra options |
|
345 cmake.attribute("CFLAGS").value = "-g" |
|
346 # waf.attribute("configure_arguments").value = "--enable-examples --enable-tests" |
|
347 cmake.attribute("build_arguments").value = "--generate-version" |
|
348 |
|
349 testResult = cmake.build(self._env, "1") |
|
350 self.assertEqual(testResult, None) |
|
351 testStatus = commands.getoutput('ls -l /tmp/source/openflow-ns3/object|wc') |
|
352 created = re.compile('\d+').search(testStatus).group() |
|
353 self.assertNotEqual(created, "0") |
300 |
354 |
301 # main call for the tests |
355 # main call for the tests |
302 if __name__ == '__main__': |
356 if __name__ == '__main__': |
303 unittest.main() |
357 unittest.main() |