# HG changeset patch # User Daniel Camara # Date 1327315720 -3600 # Node ID e5b0304a0eb2ad1ff526745f337d212c27a2bee8 # Parent bf151f3f14797055c69ed98fd8a5fb4100bd65b9 Hst G: changed test/source.py Tests and changes for the bake store server diff -r bf151f3f1479 -r e5b0304a0eb2 .project --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.project Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,17 @@ + + + Bake + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff -r bf151f3f1479 -r e5b0304a0eb2 .project_old --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.project_old Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,17 @@ + + + bake + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff -r bf151f3f1479 -r e5b0304a0eb2 .pydevproject --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.pydevproject Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,10 @@ + + + + +Default +python 3.0 + +/bake + + diff -r bf151f3f1479 -r e5b0304a0eb2 .pydevproject_old --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.pydevproject_old Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,10 @@ + + + + +Default +python 3.0 + +/bake + + diff -r bf151f3f1479 -r e5b0304a0eb2 _bakeconf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/_bakeconf.xml Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + class NscModuleBuild(InlineModuleBuild): + def __init__(self): + InlineModuleBuild.__init__(self) + def build(self, env, jobs): + env.run(['python', os.path.join(env.srcdir, 'scons.py'), + '-j', str(jobs), '--prefix=' + env.installdir, 'install'], + directory=env.srcdir) + def clean(self, env): + env.run(['python', os.path.join(env.srcdir, 'scons.py'), '-c'], + directory=env.srcdir) + def check_version(self, env): + return True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r bf151f3f1479 -r e5b0304a0eb2 bake/Configuration.py --- a/bake/Configuration.py Fri Nov 18 14:12:31 2011 +0100 +++ b/bake/Configuration.py Mon Jan 23 11:48:40 2012 +0100 @@ -334,7 +334,8 @@ self._relative_directory_root = root.get('relative_directory_root') original_bakefile = root.get('bakefile') metadata = root.find('metadata') - self._metadata_file = MetadataFile (metadata.get('filename'), + if metadata : + self._metadata_file = MetadataFile (metadata.get('filename'), h = metadata.get('hash')) # read which modules are enabled @@ -349,7 +350,10 @@ disabled = self.lookup(module.get('name')) self.disable(disabled) - return self._metadata_file.is_hash_ok() and original_bakefile == self._bakefile + if metadata: + return self._metadata_file.is_hash_ok() and original_bakefile == self._bakefile + else : + return True def set_installdir(self, installdir): self._installdir = installdir diff -r bf151f3f1479 -r e5b0304a0eb2 bake/ModuleBuild.py --- a/bake/ModuleBuild.py Fri Nov 18 14:12:31 2011 +0100 +++ b/bake/ModuleBuild.py Mon Jan 23 11:48:40 2012 +0100 @@ -2,7 +2,7 @@ import os from Utils import ModuleAttributeBase from Exceptions import NotImplemented -from bake.Exceptions import TaskError +from Exceptions import TaskError class ModuleBuild(ModuleAttributeBase): @@ -190,6 +190,21 @@ options = [] if self.attribute('cmake_arguments').value != '': options = self.attribute('cmake_arguments').value.split(' ') + + # if the object directory does not exist, it should create it, to + # avoid build error, since the cmake does not create the directory + # it also makes it orthogonal to waf, that creates the target object dir + try: + env.run(['mkdir', env.objdir], + directory=env.srcdir) + except TaskError as e: + # assume that if an error is thrown is because the directory already + # exist, otherwise re-propagates the error + if not "error 1" in e._reason : + raise TaskError(e._reason) + + directory=env.objdir + env.run(['cmake', env.srcdir, '-DCMAKE_INSTALL_PREFIX=' + env.installdir] + self._variables() + options, directory=env.objdir) diff -r bf151f3f1479 -r e5b0304a0eb2 bake/ModuleEnvironment.py --- a/bake/ModuleEnvironment.py Fri Nov 18 14:12:31 2011 +0100 +++ b/bake/ModuleEnvironment.py Mon Jan 23 11:48:40 2012 +0100 @@ -3,7 +3,7 @@ import sys import platform -from bake.Exceptions import TaskError +from Exceptions import TaskError class ModuleEnvironment: (HIGHER, LOWER, EQUAL) = range(0,3) diff -r bf151f3f1479 -r e5b0304a0eb2 bake/ModuleSource.py --- a/bake/ModuleSource.py Fri Nov 18 14:12:31 2011 +0100 +++ b/bake/ModuleSource.py Mon Jan 23 11:48:40 2012 +0100 @@ -144,6 +144,7 @@ # finally, rename the extraction directory to the target directory name. try: os.rename(os.path.join(tempdir, actual_extract_dir), env.srcdir) + os.remove(tempdir) except (OSError, IOError) as e: raise TaskError('Rename problem for module: %s, from: %s, to: %s, Error: %s' % (env._module_name,os.path.join(tempdir, actual_extract_dir),env.srcdir, e)) @@ -230,6 +231,7 @@ import os try: os.rename(os.path.join(tempdir, actual_checkout_dir), env.srcdir) + os.remove(tempdir) except AttributeError as e: raise TaskError('Atribute type error expected String, Error: %s' % e) diff -r bf151f3f1479 -r e5b0304a0eb2 bakeconfOK.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bakeconfOK.xml Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + class NscModuleBuild(InlineModuleBuild): + def __init__(self): + InlineModuleBuild.__init__(self) + def build(self, env, jobs): + env.run(['python', os.path.join(env.srcdir, 'scons.py'), + '-j', str(jobs), '--prefix=' + env.installdir, 'install'], + directory=env.srcdir) + def clean(self, env): + env.run(['python', os.path.join(env.srcdir, 'scons.py'), '-c'], + directory=env.srcdir) + def check_version(self, env): + return True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r bf151f3f1479 -r e5b0304a0eb2 bakeconfWorkingOnDCE.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bakeconfWorkingOnDCE.xml Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +hg clone http://code.nsnam.org/mathieu/readversiondef + +hg clone http://code.nsnam.org/furbani/ns-3-linux op + +hg clone http://code.nsnam.org/ns-3-dev -r cf417e0145eb + +git clone git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git net-next-2.6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + class NscModuleBuild(InlineModuleBuild): + def __init__(self): + InlineModuleBuild.__init__(self) + def build(self, env, jobs): + env.run(['python', os.path.join(env.srcdir, 'scons.py'), + '-j', str(jobs), '--prefix=' + env.installdir, 'install'], + directory=env.srcdir) + def clean(self, env): + env.run(['python', os.path.join(env.srcdir, 'scons.py'), '-c'], + directory=env.srcdir) + def check_version(self, env): + return True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r bf151f3f1479 -r e5b0304a0eb2 clone_and_compile_ns3_dce.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clone_and_compile_ns3_dce.sh Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,426 @@ + + + + + + + + + +furbani/ns-3-dce: utils/clone_and_compile_ns3_dce.sh@60a9cf52e24a + + + + + + + + + +
utils/clone_and_compile_ns3_dce.sh
+ +
+ + + + + + + + + + + + + + + + + + + + +
authorfrederic.urbani@inria.fr
Tue Dec 13 10:51:45 2011 +0100 (3 hours ago)
changeset 20460a9cf52e24a
parent 203 + +84a1955f45cf + +
permissions-rwxr-xr-x
+
+ +
+Fix kernel mode and tests. +
+ +
+ +
+
     1 #!/bin/bash
+
+
+
+
     2 # this script checkout NS3 and DCE sources, and build them.
+
+
+
+
     3 USE_KERNEL=NO
+
+
+
+
     4 cd `dirname $BASH_SOURCE`/../..
+
+
+
+
     5 SAVE_PATH=$PATH
+
+
+
+
     6 SAVE_LDLP=$LD_LIBRARY_PATH
+
+
+
+
     7 SAVE_PKG=$PKG_CONFIG_PATH
+
+
+
+
     8 #echo clone ns-3-dce : 
+
+
+
+
     9 #hg clone http://code.nsnam.org/furbani/ns-3-dce
+
+
+
+
    10 echo clone readversiondef
+
+
+
+
    11 hg clone http://code.nsnam.org/mathieu/readversiondef
+
+
+
+
    12 if [ "YES" == "$USE_KERNEL" ]
+
+
+
+
    13 then
+
+
+
+
    14 	echo clone ns-3-linux
+
+
+
+
    15  	hg clone http://code.nsnam.org/furbani/ns-3-linux
+
+
+
+
    16 fi	
+
+
+
+
    17 echo clone ns-3-dev
+
+
+
+
    18 hg clone http://code.nsnam.org/ns-3-dev -r 027aae146ae2
+
+
+
+
    19 mkdir build
+
+
+
+
    20 cd ns-3-dev
+
+
+
+
    21 patch -p1 <../ns-3-dce/utils/packet-socket-upgrade-exp.patch
+
+
+
+
    22 patch -p1 <../ns-3-dce/utils/0001-Replace-references-to-m_recvpktinfo-with-method-call.patch
+
+
+
+
    23 patch -p1 <../ns-3-dce/utils/0002-A-new-templated-static-method-Ipv4RoutingHelper-GetR.patch
+
+
+
+
    24 ./waf configure --prefix=`pwd`/../build --enable-tests
+
+
+
+
    25 ./waf
+
+
+
+
    26 ./waf install
+
+
+
+
    27 cd ..
+
+
+
+
    28 export PATH=$SAVE_PATH:`pwd`/build/bin
+
+
+
+
    29 export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib
+
+
+
+
    30 export PKG_CONFIG_PATH=$SAVE_PKG:`pwd`/build/lib/pkgconfig
+
+
+
+
    31 cd readversiondef/
+
+
+
+
    32 make 
+
+
+
+
    33 make install PREFIX=`pwd`/../build/
+
+
+
+
    34 cd ..
+
+
+
+
    35 if [ "YES" == "$USE_KERNEL" ]
+
+
+
+
    36 then
+
+
+
+
    37 	cd ns-3-linux/
+
+
+
+
    38 # 	git clone git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git net-next-2.6
+
+
+
+
    39  	git clone git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git net-next-2.6
+
+
+
+
    40 	make unpatch
+
+
+
+
    41 	make  setup
+
+
+
+
    42 	make defconfig
+
+
+
+
    43 	make config
+
+
+
+
    44 	sed s/CONFIG_PACKET=m/CONFIG_PACKET=y/ config >c2
+
+
+
+
    45 	rm config
+
+
+
+
    46 	mv c2 config
+
+
+
+
    47 	make
+
+
+
+
    48 	cd ..
+
+
+
+
    49 #	wget http://devresources.linuxfoundation.org/dev/iproute2/download/iproute2-2.6.33.tar.bz2
+
+
+
+
    50 	wget http://www.linuxgrill.com/anonymous/iproute2/NEW-OSDL/iproute2-2.6.38.tar.bz2     
+
+
+
+
    51 #	tar jxf iproute2-2.6.33.tar.bz2
+
+
+
+
    52 	tar jxf iproute2-2.6.38.tar.bz2
+
+
+
+
    53 #	cd iproute2-2.6.33
+
+
+
+
    54 	cd iproute2-2.6.38
+
+
+
+
    55 	./configure
+
+
+
+
    56 	LDFLAGS=-pie make CCOPTS='-fpic -D_GNU_SOURCE -O0 -U_FORTIFY_SOURCE'
+
+
+
+
    57 	cd ../ns-3-dce
+
+
+
+
    58 	mkdir -p build/bin_dce
+
+
+
+
    59 	cd  build/bin_dce
+
+
+
+
    60 	ln -s ../../../ns-3-linux/libnet-next-2.6.so
+
+
+
+
    61 #	ln -s ../iproute2-2.6.33/ip/ip
+
+
+
+
    62 	ln -s ../../../iproute2-2.6.38/ip/ip
+
+
+
+
    63 	cd ../../example/ccnx
+
+
+
+
    64 	ln -s ../../build/bin_dce/libnet-next-2.6.so
+
+
+
+
    65 #	ln -s ../../ip
+
+
+
+
    66 	cd ../..
+
+
+
+
    67 fi
+
+
+
+
    68 cd ns-3-dce/
+
+
+
+
    69 if [ "YES" == "$USE_KERNEL" ]
+
+
+
+
    70 then
+
+
+
+
    71     WAF_KERNEL=--enable-kernel-stack=`pwd`/../ns-3-linux
+
+
+
+
    72 fi
+
+
+
+
    73 ./waf configure --prefix=`pwd`/../build --verbose $WAF_KERNEL
+
+
+
+
    74 ./waf
+
+
+
+
    75 ./waf install
+
+
+
+
    76 export LD_LIBRARY_PATH=$SAVE_LDLP:`pwd`/build/lib:`pwd`/build/bin:`pwd`/../build/lib
+
+
+
+
    77 . utils/setenv.sh
+
+
+
+
    78 echo Launch NS3TEST-DCE
+
+
+
+
    79 ./build/bin/ns3test-dce --verbose
+
+
+
+
    80 
+
+
+
+
    81 
+
+
+
+
    82 
+
+
+
+
    83 
+
+
+
+
    84 
+
+
+
+ + + + + diff -r bf151f3f1479 -r e5b0304a0eb2 test.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test.xml Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,1 @@ + \ No newline at end of file diff -r bf151f3f1479 -r e5b0304a0eb2 test/build.py --- a/test/build.py Fri Nov 18 14:12:31 2011 +0100 +++ b/test/build.py Mon Jan 23 11:48:40 2012 +0100 @@ -190,11 +190,6 @@ created = re.compile('\d+').search(testStatus).group() self.assertNotEqual(created, "0") - - - - - # TODO: # test if the object dir is equal to the source dir, for the open flow # case it is not allowed but I am not sure for everyone else @@ -297,6 +292,65 @@ # testResult = waf._is_1_6_x(self._env) # self.assertFalse(testResult) + def test_CmakeModule(self): + """Tests the WafModuleBuild Class from ModuleBuild. """ + + cmake = ModuleBuild.create("cmake") + self.assertNotEqual(cmake, None) + self.assertEqual(cmake.name(), "cmake") + + # Environment settings + cvs = ModuleSource.create("cvs") + testResult = cvs.check_version(self._env) + self.assertTrue(testResult) + cvs.attribute("root").value = ":pserver:anoncvs:@www.gccxml.org:/cvsroot/GCC_XML" + cvs.attribute("module").value="gccxml" + cvs.attribute("date").value="2009-09-21" + + self._env._module_name="gccxml" + self._logger.set_current_module(self._env._module_name) +# bazaar.attribute("revision").value = "revno:795" + + testStatus = commands.getoutput('mkdir /tmp/source') + testResult = cvs.download(self._env) + self.assertEqual(testResult, None) + + #check that has the cmake version required is installed in the machine + testResult = cmake.check_version(self._env) + self.assertTrue(testResult) + + # Expected case test + + self._env.objdir = self._env.srcdir+"/object" + testStatus = commands.getoutput('rm -rf /tmp/source/gccxml/object') + testResult = cmake.build(self._env, "1") + self.assertEqual(testResult, None) + testStatus = commands.getoutput('ls /tmp/source/gccxml/object|wc') + created = re.compile('\d+').search(testStatus).group() + self.assertNotEqual(created, "0") + + # call the clean to remove the build + # TODO: Find a solution for the remaining directories + # - It is strange because the waf does not remove the directories, + # just the object files.... Should this be like that??!?! + testResult = cmake.clean(self._env) + self.assertEqual(testResult, None) + testStatus = commands.getoutput('ls /tmp/source/gccxml/object/GCC/gcc/CMakeFiles/backend.dir/*.o|wc') + created = re.compile('\d+').search(testStatus).group() + self.assertEqual(created, "0") + + # TODO: neighter the --generate-version appears but I couldn't also + # find a configuration argument for pybindgen :( + # Call with extra options + cmake.attribute("CFLAGS").value = "-g" +# waf.attribute("configure_arguments").value = "--enable-examples --enable-tests" + cmake.attribute("build_arguments").value = "--generate-version" + + testResult = cmake.build(self._env, "1") + self.assertEqual(testResult, None) + testStatus = commands.getoutput('ls -l /tmp/source/openflow-ns3/object|wc') + created = re.compile('\d+').search(testStatus).group() + self.assertNotEqual(created, "0") # main call for the tests if __name__ == '__main__': diff -r bf151f3f1479 -r e5b0304a0eb2 test/source.py --- a/test/source.py Fri Nov 18 14:12:31 2011 +0100 +++ b/test/source.py Mon Jan 23 11:48:40 2012 +0100 @@ -33,7 +33,7 @@ print (inst) # the exception instance self.fail("Could not execute command %s over directory %s failed" % (command, dir)) - def test_generalFailures(self): + def Disable_test_generalFailures(self): """Tests Some general failures that could happen in the Module Source. """ #Verifies the return of the creation of a non existent module @@ -183,7 +183,7 @@ # testStatus = commands.getoutput('chmod 755 /tmp/click-1.8.0; rm -rf /tmp/click-1.8.0') - def test_mercurial(self): + def Disable_test_mercurial(self): """Tests the MercurialModuleSource class. """ # it first needs to be able to create the class otherwise will not be @@ -308,7 +308,7 @@ # last clean up self.executeCommand(["rm", "-rf", "bake"], "/tmp") - def test_bazaar(self): + def Disable_test_bazaar(self): """Tests the BazaarModuleSource class. """ # checks if can create the class @@ -498,6 +498,7 @@ #after the test, clean the environment self.executeCommand(["rm", "-rf", "gccxml"], "/tmp") + # download a specific version cvs.attribute("date").value="2007-09-21" @@ -595,7 +596,7 @@ # last clean up self.executeCommand(["rm", "-rf", "gccxml"], "/tmp") - def test_git(self): + def Disable_test_git(self): """Tests the GitModuleSource. """ # checks if can create the class diff -r bf151f3f1479 -r e5b0304a0eb2 test2.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test2.xml Mon Jan 23 11:48:40 2012 +0100 @@ -0,0 +1,1 @@ + \ No newline at end of file