示例#1
0
    def test0(self):
        def fileCheck(*fpaths):
            for fpath in fpaths:
                self.assertTrue(fs.exists(fpath))
                self.assertTrue(fs.isfile(fpath))
                self.assertFalse(fs.isdir(fpath))

        def dirCheck(*fpaths):
            for fpath in fpaths:
                self.assertTrue(fs.exists(fpath))
                self.assertFalse(fs.isfile(fpath))
                self.assertTrue(fs.isdir(fpath))

        fs = MockFS()
        self.assertFalse(fs.exists('src/math/vector.c'))
        self.assertFalse(fs.isfile('src/math/vector.c'))
        self.assertFalse(fs.isdir('src/math/vector.c'))
        fs.mkdirs('src/math/utils')
        fs.write('README.txt', 'hello')
        self.assertEquals('hello', fs.read('README.txt'))
        fs.write('README.txt', 'Hello!')
        self.assertEquals('Hello!', fs.read('README.txt'))
        fs.write('src/main.c', '// main')
        self.assertEquals('// main', fs.read('src/main.c'))
        try:
            fs.mkdirs('src/main.c/utils')
            self.fail()
        except:
            pass
        print fs.show()
        fileCheck('README.txt', 'src/main.c')
        dirCheck('', 'src', 'src/math', 'src/math/', 'src/math/utils')
示例#2
0
    def test1(self):

        def createTasks(bldr):
            bldr.addTask(
                targets=['out/concat.txt'],
                fileDeps=['src/a.txt', 'src/b.txt'],
                upToDate=targetUpToDate,
                action=concat)
        
        def expectBuild():
            with createBldr(fs) as bldr:
                createTasks(bldr)
                self.assertEquals(
                    self.buildAndCheckOutput(
                        bldr,
                        'out/concat.txt',
                        mustHave=['INFO: Building out/concat.txt.', 'INFO: BUILD PASSED!'],
                        forbidden=['INFO: out/concat.txt is up-to-date.']), 0)
            
        def expectUpToDate():
            with createBldr(fs) as bldr:
                createTasks(bldr)
                self.assertEquals(
                    self.buildAndCheckOutput(
                        bldr,
                        'out/concat.txt',
                        mustHave=['INFO: out/concat.txt is up-to-date.', 'INFO: BUILD PASSED!'],
                        forbidden=['INFO: Building out/concat.txt.']), 0)

        print '>>>--- Test1 ---<<<'
        # setXDebug(True)
        fs = MockFS()
        fs.write('src/a.txt', "aFile\n", mkDirs=True)
        fs.write('src/b.txt', "bFile\n", mkDirs=True)
        expectBuild()
        # print fs.show()
        self.assertEquals("aFile\nbFile\n", fs.read('out/concat.txt'))
        # rebuild
        print '--- rebuild ---'
        expectUpToDate()
        self.assertEquals("aFile\nbFile\n", fs.read('out/concat.txt'))
        print '--- modify a source ---'
        fs.write('src/b.txt', "__bFile\n", mkDirs=True)
        # print fs.show()
        expectBuild()
        self.assertEquals("aFile\n__bFile\n", fs.read('out/concat.txt'))
        print '--- TODO: remove target ----'
        fs.remove('out/concat.txt')
        expectBuild()
        print '--- modify target ----'
        fs.write('out/concat.txt', "Lofasz es estifeny", mkDirs=True)
        expectBuild()
        self.assertEquals("aFile\n__bFile\n", fs.read('out/concat.txt'))
示例#3
0
 def testRace(self):
     '''This doesn't induce race condition.'''
     
     def createTasks(bldr):
         bldr.addTask(
             targets=['out/concat.txt'],
             fileDeps=['src/a.txt', 'src/b.txt'],
             upToDate=targetUpToDate,
             action=concat)
     
     fs = MockFS()
     fs.write('src/a.txt', "aFile\n", mkDirs=True)
     fs.write('src/b.txt', "bFile\n", mkDirs=True)
     with createBldr(fs) as bldr:
         createTasks(bldr)
         bldr.buildOne('out/concat.txt')
     print '--- rebuild ---'
     with createBldr(fs) as bldr:
         createTasks(bldr)
         bldr.buildOne('out/concat.txt')
     print '--- modify a source ---'
     fs.write('src/b.txt', "__bFile\n", mkDirs=True)
     # print fs.show()
     with createBldr(fs) as bldr:
         createTasks(bldr)
         bldr.buildOne('out/concat.txt')
     self.assertEquals("aFile\n__bFile\n", fs.read('out/concat.txt'))
     print '--- TODO: remove target ----'
     fs.remove('out/concat.txt')
     with createBldr(fs) as bldr:
         createTasks(bldr)
         bldr.buildOne('out/concat.txt')
     print '--- modify target ----'
     fs.write('out/concat.txt', "Lofasz es estifeny", mkDirs=True)
     with createBldr(fs) as bldr:
         createTasks(bldr)
         bldr.buildOne('out/concat.txt')
     self.assertEquals("aFile\n__bFile\n", fs.read('out/concat.txt'))
示例#4
0
    def test0(self):
        def createTasks(bldr, cont):
            return self.createTasks(bldr, cont)

        cont = ContentHelper(
            cEnts=['main', 'helper', 'mgr'],
            vEnts=['core', 'CzokCodec', 'SPI'],
            libPath='out/sw/liba.so',
            binPath='out/hw/a.bin',
            cfgPath='cfg/pupak.desc',
            cfg=('c: mp3\nc: ogg\nc: avi\nc:mp4\n'
                 'v:add8_8_C\nv:mul16_16\nv: CzokEngiene: 10'))
        print '--- clean all ---'
        fs = MockFS()
        cont.create(fs)
        # print 'FS content before build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            self.assertEquals(0, bldr.buildOne('all'))
            allTasks = bldr.db.taskIdSavedTaskDict.keys()
        self.assertEquals(A_BIN_REF, fs.read('out/hw/a.bin'))
        self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
        # print 'FS content after build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            # logger.setLevel(logging.DEBUG)
            self.cleanAndMatchOutput(
                bldr, 'all',
                ['INFO: Removed folder: gen', 'INFO: Removed folder: out'])
        print 'FS content after clean All:\n' + fs.show()
        # print str(fs.getFileList())
        for d in ('gen', 'out'):
            self.assertFalse(fs.isdir(d))
        files = [
            'cfg/pupak.desc', 'src/helper.c', 'src/main.c', 'src/mgr.c',
            'vhdl/CzokCodec.vhdl', 'vhdl/SPI.vhdl', 'vhdl/core.vhdl',
            'default.xbuild'
        ]
        for f in files:
            self.assertTrue(fs.isfile(f), '{} does not exist'.format(f))
        # check DB
        # print fs.read('default.xbuild')
        self.checkDB(fs, allTasks, allTasks)

        print '--- clean hwTask ---'
        fs = MockFS()
        cont.create(fs)
        # print 'FS content before build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            bldr.buildOne('all')
            allTasks = bldr.db.taskIdSavedTaskDict.keys()
        # print 'FS content after build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            # logger.setLevel(logging.DEBUG)
            self.cleanAndMatchOutput(bldr, 'hwTask',
                                     ['INFO: Removed folder: out/hw'])
        print 'FS content after clean All:\n' + fs.show()
        # print str(fs.getFileList())
        for d in ['out/hw']:
            self.assertFalse(fs.isdir(d))
        files = [
            'cfg/pupak.desc', 'gen/pupak/src/avi.c', 'gen/pupak/src/mp3.c',
            'gen/pupak/src/mp4.c', 'gen/pupak/src/ogg.c', 'out/sw/avi.o',
            'out/sw/helper.o', 'out/sw/liba.so', 'out/sw/main.o',
            'out/sw/mgr.o', 'out/sw/mp3.o', 'out/sw/mp4.o', 'out/sw/ogg.o',
            'src/helper.c', 'src/main.c', 'src/mgr.c', 'vhdl/CzokCodec.vhdl',
            'vhdl/SPI.vhdl', 'vhdl/core.vhdl', 'default.xbuild'
        ]
        for f in files:
            self.assertTrue(fs.isfile(f), '{} does not exist'.format(f))
        # print str(sorted(allTasks))
        removedTasks = [
            'hwTask', 'out/hw/CzokCodec.o', 'out/hw/CzokEngiene.o',
            'out/hw/SPI.o', 'out/hw/add8_8_C.o', 'out/hw/core.o',
            'out/hw/mul16_16.o'
        ]
        # check DB
        # print fs.read('default.xbuild')
        self.checkDB(fs, removedTasks, allTasks)
        print '--- clean out/hw/CzokEngiene.o ---'
        fs = MockFS()
        cont.create(fs)
        # print 'FS content before build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            bldr.buildOne('all')
            allTasks = bldr.db.taskIdSavedTaskDict.keys()
        # print 'FS content after build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            # logger.setLevel(logging.DEBUG)
            self.cleanAndMatchOutput(
                bldr, 'out/hw/CzokEngiene.o',
                ['INFO: Removed file: out/hw/CzokEngiene.o'])
        print 'FS content after clean out/hw/CzokEngiene.o:\n' + fs.show()
        # print str(fs.getFileList())
        # for d in ['out/hw']: self.assertFalse(fs.isdir(d))
        files = [
            'cfg/pupak.desc', 'gen/pupak/src/avi.c', 'gen/pupak/src/mp3.c',
            'gen/pupak/src/mp4.c', 'gen/pupak/src/ogg.c',
            'gen/pupak/vhdl/CzokEngiene.vhdl', 'gen/pupak/vhdl/add8_8_C.vhdl',
            'gen/pupak/vhdl/mul16_16.vhdl', 'out/hw/CzokCodec.o',
            'out/hw/SPI.o', 'out/hw/a.bin', 'out/hw/add8_8_C.o',
            'out/hw/core.o', 'out/hw/mul16_16.o', 'out/sw/avi.o',
            'out/sw/helper.o', 'out/sw/liba.so', 'out/sw/main.o',
            'out/sw/mgr.o', 'out/sw/mp3.o', 'out/sw/mp4.o', 'out/sw/ogg.o',
            'src/helper.c', 'src/main.c', 'src/mgr.c', 'vhdl/CzokCodec.vhdl',
            'vhdl/SPI.vhdl', 'vhdl/core.vhdl', 'default.xbuild'
        ]
        for f in files:
            self.assertTrue(fs.isfile(f), '{} does not exist'.format(f))
        # print str(sorted(allTasks))
        removedTasks = ['out/hw/CzokEngiene.o']
        # check DB
        # print fs.read('default.xbuild')
        self.checkDB(fs, removedTasks, allTasks)
        print '--- cleanAll() ---'
        fs = MockFS()
        cont.create(fs)
        # print 'FS content before build:\n' + fs.show()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            bldr.buildOne('all')
            allTasks = bldr.db.taskIdSavedTaskDict.keys()
        with Builder(fs=fs) as bldr:
            createTasks(bldr, cont)
            # logger.setLevel(logging.DEBUG)
            bldr.db.cleanAll()
        # TODO: asserts
        print 'FS content after cleanAll():\n' + fs.show()
        # print str(fs.getFileList())
        for d in ('gen', 'out'):
            self.assertFalse(fs.isdir(d))
        files = [
            'cfg/pupak.desc', 'src/helper.c', 'src/main.c', 'src/mgr.c',
            'vhdl/CzokCodec.vhdl', 'vhdl/SPI.vhdl', 'vhdl/core.vhdl',
            'default.xbuild'
        ]
        for f in files:
            self.assertTrue(fs.isfile(f), '{} does not exist'.format(f))
        # check DB
        # print fs.read('default.xbuild')
        self.checkDB(fs, allTasks, allTasks)
示例#5
0
        fileDeps=['cfg/cfg.txt'],
        action=generatorAction,
        taskFactory=taskFactory)
    # Create a task for concatenating the .size files
    bldr.addTask(
        name='concatSizeFiles',
        targets=['out/txtInfo.txt'],
        taskDeps=['generator'],
        dynFileDepFetcher=FetchDynFileDeps(EndFilter('.size'), fetchProv=True),
        action=concatAction)
    # Create a task for concatenating the .lines files
    bldr.addTask(
        name='concatLinesFiles',
        targets=['out/jsonInfo.txt'],
        taskDeps=['generator'],
        dynFileDepFetcher=FetchDynFileDeps(EndFilter('.lines'), fetchProv=True),
        action=concatAction)
    # Create a main task.
    bldr.addTask(
        name='all',
        fileDeps=['out/txtInfo.txt', 'out/jsonInfo.txt'])
    # Print the PlantUML representation of the before-build dependency graph.
    info('Before-build PlantUML:\n' + bldr.genPlantUML())
    # Build the main task.
    bldr.buildOne('all')
    # Print the target.
    info("Content of out/txtInfo.txt:\n{}".format(fs.read('out/txtInfo.txt')))
    info("Content of out/jsonInfo.txt:\n{}".format(fs.read('out/jsonInfo.txt')))
    # Print the PlantUML representation of the after-build dependency graph.
    info('After-build PlantUML:\n' + bldr.db.genPlantUML())
示例#6
0
 def test3(self):
     '''Testing when more targets depends on the same file.'''
     def createTasks(bldr):
         bldr.addTask(
             targets=['out/c1.txt'],
             fileDeps=['src/a.txt', 'src/b.txt'],
             upToDate=targetUpToDate,
             action=concat)
         bldr.addTask(
             targets=['out/c2.txt'],
             fileDeps=['src/b.txt', 'src/c.txt'],
             upToDate=targetUpToDate,
             action=concat)
         bldr.addTask(
             targets=['out/c3.txt'],
             fileDeps=['src/d.txt', 'src/e.txt'],
             upToDate=targetUpToDate,
             action=concat)
         bldr.addTask(
             name='all',
             fileDeps=['out/c1.txt', 'out/c2.txt', 'out/c3.txt'],
             upToDate=targetUpToDate)
 
     print '>>>--- Test3 ---<<<'
     fs = MockFS()
     fs.write('src/a.txt', 'aFile\n', mkDirs=True)
     fs.write('src/b.txt', 'bFile\n', mkDirs=True)
     fs.write('src/c.txt', 'cFile\n', mkDirs=True)
     fs.write('src/d.txt', 'dFile\n', mkDirs=True)
     fs.write('src/e.txt', 'eFile\n', mkDirs=True)
     with createBldr(fs) as bldr:
         createTasks(bldr)
         self.assertEquals(
             self.buildAndCheckOutput(
                 bldr,
                 'all',
                 mustHave=[
                     'INFO: Building out/c1.txt.',
                     'INFO: Building out/c2.txt.',
                     'INFO: Building out/c3.txt.',
                     'INFO: Building all.',
                     'INFO: BUILD PASSED!'],
                 forbidden=[]),
             0)
     self.assertEquals('aFile\nbFile\n', fs.read('out/c1.txt'))
     self.assertEquals('bFile\ncFile\n', fs.read('out/c2.txt'))
     self.assertEquals('dFile\neFile\n', fs.read('out/c3.txt'))
     print '--- rebuild ---'
     with createBldr(fs) as bldr:
         createTasks(bldr)
         self.assertEquals(
             self.buildAndCheckOutput(
                 bldr,
                 'all',
                 mustHave=[
                     'INFO: out/c1.txt is up-to-date.',
                     'INFO: out/c2.txt is up-to-date.',
                     'INFO: out/c3.txt is up-to-date.',
                     'INFO: all is up-to-date.',
                     'INFO: BUILD PASSED!'],
                 forbidden=[]),
             0)
     self.assertEquals('aFile\nbFile\n', fs.read('out/c1.txt'))
     self.assertEquals('bFile\ncFile\n', fs.read('out/c2.txt'))
     self.assertEquals('dFile\neFile\n', fs.read('out/c3.txt'))
     print '--- modify common depend file ---'
     fs.write('src/b.txt', 'brrrFile\n', mkDirs=True)
     with createBldr(fs) as bldr:
         createTasks(bldr)
         self.assertEquals(
             self.buildAndCheckOutput(
                 bldr,
                 'all',
                 mustHave=[
                     'INFO: out/c3.txt is up-to-date.',
                     'INFO: Building out/c1.txt.',
                     'INFO: Building out/c2.txt.',
                     'INFO: BUILD PASSED!'],
                 forbidden=[]),
             0)
     self.assertEquals('aFile\nbrrrFile\n', fs.read('out/c1.txt'))
     self.assertEquals('brrrFile\ncFile\n', fs.read('out/c2.txt'))
     self.assertEquals('dFile\neFile\n', fs.read('out/c3.txt'))
示例#7
0
    def test2(self):
        
        def countAction(bldr, task, **kwargs):
            
            def countChars(trg, fileDeps):
                res = ''
                for fileDep in fileDeps:
                    content = bldr.fs.read(fileDep)
                    res += 'fileName: {}, chars: {}\n'.format(fileDep, len(content))
                bldr.fs.write(trg, res, mkDirs=True)
            
            def calcHash(trg, fileDeps):
                res = ''
                for fileDep in fileDeps:
                    hashCode = HashEnt.calcHash(bldr.fs.read(fileDep))
                    res += 'fileName: {}, hash: {}\n'.format(fileDep, hashCode)
                bldr.fs.write(trg, res, mkDirs=True)
            
            fileDeps = task.getFileDeps()
            for trg in task.targets:
                if 'charCnt.txt' == bldr.fs.basename(trg):
                    countChars(trg, fileDeps)
                elif 'hash.txt' == bldr.fs.basename(trg):
                    calcHash(trg, fileDeps)
            return 0
            

        def createTasks(bldr):
            bldr.addTask(
                name='all',
                targets=['out/charCnt.txt', 'out/hash.txt'],
                fileDeps=['out/concat.txt', 'src/a.txt', 'src/b.txt'],
                upToDate=targetUpToDate,
                action=countAction)
            bldr.addTask(
                targets=['out/concat.txt'],
                fileDeps=['src/a.txt', 'src/b.txt'],
                upToDate=targetUpToDate,
                action=concat)
            return bldr
        
        print '>>>--- Test2 ---<<<'
        fs = MockFS()
        fs.write('src/a.txt', 'aFile\n', mkDirs=True)
        fs.write('src/b.txt', 'bFile\n', mkDirs=True)
        with createBldr(fs) as bldr:
            createTasks(bldr)
            self.assertEquals(
                self.buildAndCheckOutput(
                    bldr,
                    'out/hash.txt',
                    mustHave=['INFO: Building out/concat.txt.', 'INFO: Building all.', 'INFO: BUILD PASSED!'],
                    forbidden=[]),
                0)
        # print fs.show()
        self.assertEquals('aFile\nbFile\n', fs.read('out/concat.txt'))
        self.assertTrue(fs.isfile('out/hash.txt'))
        print "--- rebuild ---"
        with createBldr(fs) as bldr:
            createTasks(bldr)
            self.assertEquals(
                self.buildAndCheckOutput(
                    bldr,
                    'out/hash.txt',
                    mustHave=['INFO: out/concat.txt is up-to-date.', 'INFO: all is up-to-date.', 'INFO: BUILD PASSED!'],
                    forbidden=[]),
                0)
        print "--- modify a source ---"
        fs.write('src/b.txt', 'brrrr\n', mkDirs=True)
        with createBldr(fs) as bldr:
            createTasks(bldr)
            self.assertEquals(
                self.buildAndCheckOutput(
                    bldr,
                    'out/hash.txt',
                    mustHave=['INFO: Building out/concat.txt.', 'INFO: Building all.', 'INFO: BUILD PASSED!'],
                    forbidden=[]),
                0)
        # print fs.show()
        self.assertEquals('aFile\nbrrrr\n', fs.read('out/concat.txt'))
        self.assertTrue(fs.isfile('out/hash.txt'))
        print "--- remove a top level target ---"
        fs.remove('out/hash.txt')
        with createBldr(fs) as bldr:
            createTasks(bldr)
            self.assertEquals(
                self.buildAndCheckOutput(
                    bldr,
                    'out/hash.txt',
                    mustHave=['INFO: out/concat.txt is up-to-date.', 'INFO: Building all.', 'INFO: BUILD PASSED!'],
                    forbidden=[]),
                0)
示例#8
0
# Let's create some static files for input.
fs.write('src/a.txt', "aFile\n", mkDirs=True)
fs.write('src/b.txt', "bFile\n", mkDirs=True)
# Creating a generator configuration file.
# Here content 3 means the number of files, the generator creates.
fs.write('cfg/cfg.txt', '3', mkDirs=True)
# Create a Builder.
with Builder(fs=fs) as bldr:
    # Create the generator task.
    bldr.addTask(name='generator',
                 fileDeps=['cfg/cfg.txt'],
                 action=generatorAction)
    # Create a task for concatenating files.
    bldr.addTask(
        name='all',  # It is just a short alias name for the task.
        targets=['out/concat.txt'],
        fileDeps=['src/a.txt', 'src/b.txt'],
        taskDeps=['generator'
                  ],  # Note: this task depends on the generator task too.
        dynFileDepFetcher=
        fetchAllDynFileDeps,  # It is the default, you can skip it.
        action=concat)
    # Print the PlantUML representation of the before-build dependency graph.
    print "Before-build PlantUML:\n" + bldr.genPlantUML()
    # Build the target. It is the same as bldr.buildOne('out/concat.txt')
    bldr.buildOne('all')
    # Print the target.
    print "Content of target:\n{}".format(fs.read('out/concat.txt'))
    # Print the PlantUML representation of the after-build dependency graph.
    print "After-build PlantUML:\n" + bldr.db.genPlantUML()
示例#9
0
文件: test_gen0.py 项目: ebak/xbuild
    def test0(self):

        def createTasks(bldr, cont):
            return self.createTasks(bldr, cont)

        print '--- 1st build ---'
        cont = self.createContent()
        fs = MockFS()
        cont.create(fs)
        # print 'FS content before build:\n' + fs.show()
        with createBldr(fs) as bldr:
            createTasks(bldr, cont)
            bldr.buildOne('all')
        # hwTask = bldr._getTaskByName('hwTask')
        # print 'FS content after build:\n' + fs.show()
        # print 'a.bin:\n' + fs.read('out/hw/a.bin')
        self.assertEquals(A_BIN_REF, fs.read('out/hw/a.bin'))
        self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
        if True:
            print '--- rebuild ---'
            with createBldr(fs) as bldr:
                createTasks(bldr, cont)
                self.buildAndCheckOutput(
                    bldr, 'all',
                    mustHave=[
                        'INFO: generator is up-to-date.',
                        'INFO: out/hw/core.o is up-to-date.',
                        'INFO: out/hw/SPI.o is up-to-date.',
                        'INFO: out/hw/CzokCodec.o is up-to-date.',
                        'INFO: hwTask is up-to-date.',
                        'INFO: out/sw/main.o is up-to-date.',
                        'INFO: out/sw/helper.o is up-to-date.',
                        'INFO: out/sw/mgr.o is up-to-date.',
                        'INFO: swTask is up-to-date.',
                        'INFO: all is up-to-date.',
                        'INFO: BUILD PASSED!'],
                    forbidden=[])
            self.assertEquals(A_BIN_REF, fs.read('out/hw/a.bin'))
            self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
        if True:
            print '--- modify static dependency ---'
            fs.write('vhdl/SPI.vhdl', 'lofasz es estifeny\n')
            with createBldr(fs) as bldr:
                createTasks(bldr, cont)
                self.buildAndCheckOutput(
                    bldr, 'all',
                    mustHave=[
                        'INFO: generator is up-to-date.',
                        'INFO: out/hw/core.o is up-to-date.',
                        'INFO: Building out/hw/SPI.o.',
                        'INFO: out/hw/CzokCodec.o is up-to-date.',
                        'INFO: Building hwTask.',
                        'INFO: out/sw/main.o is up-to-date.',
                        'INFO: out/sw/helper.o is up-to-date.',
                        'INFO: out/sw/mgr.o is up-to-date.',
                        'INFO: swTask is up-to-date.',
                        'INFO: all is up-to-date.',
                        'INFO: BUILD PASSED!'],
                    forbidden=[])
            # print fs.read('out/hw/a.bin')
            self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
            self.assertEquals(A_BIN_SPI_HACK, fs.read('out/hw/a.bin'))

        if True:
            print '--- modify config ---'
            fs.write(
                'cfg/pupak.desc',
                ('c: mp3\nc: ogg\nc: avi\nc:mp4\n'
                'v:add8_8_C\nv:mul16_16\nv: ALU: 10'))
            with createBldr(fs) as bldr:
                createTasks(bldr, cont)
                self.buildAndCheckOutput(
                    bldr, 'all',
                    mustHave=[
                        'INFO: Building generator.',
                        'INFO: out/hw/core.o is up-to-date.',
                        'INFO: out/hw/SPI.o is up-to-date.',
                        'INFO: out/hw/CzokCodec.o is up-to-date.',
                        'INFO: Building out/hw/ALU.o.',
                        'INFO: out/hw/add8_8_C.o is up-to-date.',
                        'INFO: out/hw/mul16_16.o is up-to-date.',
                        'INFO: Building hwTask.',
                        'INFO: out/sw/main.o is up-to-date.',
                        'INFO: out/sw/helper.o is up-to-date.',
                        'INFO: out/sw/mgr.o is up-to-date.',
                        'INFO: out/sw/mp3.o is up-to-date.',
                        'INFO: out/sw/ogg.o is up-to-date.',
                        'INFO: out/sw/avi.o is up-to-date.',
                        'INFO: out/sw/mp4.o is up-to-date.',
                        'INFO: swTask is up-to-date.',
                        'INFO: all is up-to-date.',
                        'INFO: BUILD PASSED!'],
                    forbidden=[])
            self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
            self.assertEquals(A_BIN_SPI_HACK2, fs.read('out/hw/a.bin'))

        if True:
            print '--- modify source of dynamic dependency ---'
            fs.write('gen/pupak/vhdl/ALU.vhdl', 'Macsonya bacsi')
            with createBldr(fs) as bldr:
                createTasks(bldr, cont)
                # bldr.showDepGraph()
                self.buildAndCheckOutput(
                    bldr, 'all',
                    mustHave=[
                        'INFO: Building generator.',
                        'INFO: out/hw/core.o is up-to-date.',
                        'INFO: out/hw/SPI.o is up-to-date.',
                        'INFO: out/hw/CzokCodec.o is up-to-date.',
                        'INFO: out/hw/ALU.o is up-to-date.',
                        'INFO: out/hw/add8_8_C.o is up-to-date.',
                        'INFO: out/hw/mul16_16.o is up-to-date.',
                        'INFO: hwTask is up-to-date.',
                        'INFO: out/sw/main.o is up-to-date.',
                        'INFO: out/sw/helper.o is up-to-date.',
                        'INFO: out/sw/mgr.o is up-to-date.',
                        'INFO: out/sw/mp3.o is up-to-date.',
                        'INFO: out/sw/ogg.o is up-to-date.',
                        'INFO: out/sw/avi.o is up-to-date.',
                        'INFO: out/sw/mp4.o is up-to-date.',
                        'INFO: swTask is up-to-date.',
                        'INFO: all is up-to-date.',
                        'INFO: BUILD PASSED!'],
                    forbidden=[])
            # bldr.db.showDepGraph()
            self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
            self.assertEquals(A_BIN_SPI_HACK2, fs.read('out/hw/a.bin'))

        if True:
            print '--- modify object of dynamic dependency ---'
            fs.write('out/hw/ALU.o', 'Macsonya bacsi')
            with createBldr(fs) as bldr:
                createTasks(bldr, cont)
                self.buildAndCheckOutput(
                    bldr, 'all',
                    mustHave=[
                        'INFO: generator is up-to-date.',
                        'INFO: out/hw/core.o is up-to-date.',
                        'INFO: out/hw/SPI.o is up-to-date.',
                        'INFO: out/hw/CzokCodec.o is up-to-date.',
                        'INFO: Building out/hw/ALU.o.',
                        'INFO: out/hw/add8_8_C.o is up-to-date.',
                        'INFO: out/hw/mul16_16.o is up-to-date.',
                        'INFO: hwTask is up-to-date.',
                        'INFO: out/sw/main.o is up-to-date.',
                        'INFO: out/sw/helper.o is up-to-date.',
                        'INFO: out/sw/mgr.o is up-to-date.',
                        'INFO: out/sw/mp3.o is up-to-date.',
                        'INFO: out/sw/ogg.o is up-to-date.',
                        'INFO: out/sw/avi.o is up-to-date.',
                        'INFO: out/sw/mp4.o is up-to-date.',
                        'INFO: swTask is up-to-date.',
                        'INFO: all is up-to-date.',
                        'INFO: BUILD PASSED!'],
                    forbidden=[])
            self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
            self.assertEquals(A_BIN_SPI_HACK2, fs.read('out/hw/a.bin'))

        if True:
            print '--- remove object of dynamic dependency ---'
            fs.remove('out/hw/ALU.o')
            with createBldr(fs) as bldr:
                createTasks(bldr, cont)
                # print bldr.show()
                self.buildAndCheckOutput(
                    bldr, 'all',
                    mustHave=[
                        'INFO: generator is up-to-date.',
                        'INFO: out/hw/core.o is up-to-date.',
                        'INFO: out/hw/SPI.o is up-to-date.',
                        'INFO: out/hw/CzokCodec.o is up-to-date.',
                        'INFO: Building out/hw/ALU.o.',
                        'INFO: out/hw/add8_8_C.o is up-to-date.',
                        'INFO: out/hw/mul16_16.o is up-to-date.',
                        'INFO: hwTask is up-to-date.',
                        'INFO: out/sw/main.o is up-to-date.',
                        'INFO: out/sw/helper.o is up-to-date.',
                        'INFO: out/sw/mgr.o is up-to-date.',
                        'INFO: out/sw/mp3.o is up-to-date.',
                        'INFO: out/sw/ogg.o is up-to-date.',
                        'INFO: out/sw/avi.o is up-to-date.',
                        'INFO: out/sw/mp4.o is up-to-date.',
                        'INFO: swTask is up-to-date.',
                        'INFO: all is up-to-date.',
                        'INFO: BUILD PASSED!'],
                    forbidden=[])
            self.assertEquals(LIBA_SO_REF, fs.read('out/sw/liba.so'))
            self.assertEquals(A_BIN_SPI_HACK2, fs.read('out/hw/a.bin'))