示例#1
0
 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" ) ),
     )
示例#2
0
 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 )
示例#3
0
 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" ) ) )
示例#4
0
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
示例#5
0
文件: Loadable.py 项目: jacquev6/ViDE
 def __computeLoadDirectory( cls ):
     return os.path.join( ViDE.rootDirectory(), "Loadables", cls.__name__ + "s" )