def allFiles( self ): return itertools.chain( self.walkDirectory( os.path.join( ViDE.rootDirectory(), "lib" ) ), self.walkDirectory( os.path.join( ViDE.rootDirectory(), "BuildKits" ) ), self.walkDirectory( os.path.join( ViDE.rootDirectory(), "TestProjects" ) ), self.walkDirectory( os.path.join( ViDE.rootDirectory(), "ToolSets", "Tools" ) ), )
def setUp( self ): os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", project ) ) self.__shell = Shell() self.__shell.execute( [ "test", "--silent", "--buildkit", bkName, "make" ] ) self.__targets = set() for source in whatIfs: for target in whatIfs[ source ]: self.__targets.add( target )
def test( self ): os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", "CompilationError" ) ) shutil.rmtree( "build", True ) shell = Shell() shell.execute( [ "test", "--silent", "--buildkit", bkName, "make", "-k" ] ) time.sleep( 0.5 ) self.assertFalse( os.path.exists( cppObjFile( "a" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "b" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "c" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "d" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "e" ) ) ) self.assertTrue( os.path.exists( cppObjFile( "main" ) ) ) self.assertFalse( os.path.exists( exeFile( "hello" ) ) )
def TestMake( project, whatIfs ): shutil.rmtree( os.path.join( ViDE.rootDirectory(), "TestProjects", project, "build" ), True ) class TestCase( unittest.TestCase ): # def __init__( self ): # unittest.TestCase.__init__( self ) def setUp( self ): os.chdir( os.path.join( ViDE.rootDirectory(), "TestProjects", project ) ) self.__shell = Shell() self.__shell.execute( [ "test", "--silent", "--buildkit", bkName, "make" ] ) self.__targets = set() for source in whatIfs: for target in whatIfs[ source ]: self.__targets.add( target ) def testMake( self ): for target in self.__targets: self.assertTrue( os.path.exists( target ), project + " " + target ) def testWhatIf( self ): for source in whatIfs: before = dict() for target in self.__targets: before[ target ] = os.stat( target ).st_mtime self.__shell.execute( [ "test", "--buildkit", bkName, "make", "--touch", "--new-file", source ] ) after = dict() for target in self.__targets: after[ target ] = os.stat( target ).st_mtime updatedTargets = set() for target in self.__targets: if after[ target ] != before[ target ]: updatedTargets.add( target ) self.assertEquals( updatedTargets, set( whatIfs[source] ), project + " " + source + " " + str( updatedTargets ) + " != " + str( whatIfs[source] ) ) return TestCase
def __computeLoadDirectory( cls ): return os.path.join( ViDE.rootDirectory(), "Loadables", cls.__name__ + "s" )