def test_bm_rebuild(self): with Tempdir() as tmp_dir: options = builtinOptions() options.build_dir = tmp_dir num_src_files = 3 src_files = self.generateSourceFiles( tmp_dir, num_src_files, 201 ) bm = BuildManager() self.building_nodes = self.finished_nodes = 0 self.actual_nodes = self.outdated_nodes = 0 builder = ChecksumSingleBuilder( options, 0, 256 ) src_values = [] for s in src_files: src_values.append( FileChecksumValue( s ) ) node = Node( builder, src_values ) node = Node( builder, node ) node = Node( builder, node ) bm.add( node ) _build( bm ) self.assertEqual( self.building_nodes, num_src_files * 7 ) #//-------------------------------------------------------// self.actual_nodes = self.outdated_nodes = 0 bm = BuildManager() builder = ChecksumSingleBuilder( options, 0, 256 ) node = Node( builder, src_values ) bm.add( node ); bm.selfTest() bm.status(); bm.selfTest() self.assertEqual( self.outdated_nodes, 0 ) self.assertEqual( self.actual_nodes, num_src_files )
def test_bm_nodes(self): def _makeNodes( builder ): node1 = Node( builder, value1 ) copy_node1 = Node( builder, node1 ) copy2_node1 = Node( builder, copy_node1 ) node2 = Node( builder, value2 ) node3 = Node( builder, value3 ) copy_node3 = Node( builder, node3 ) copy2_node3 = Node( builder, copy_node3 ) copy2_node3.depends( [node1, copy_node1] ) return node1, node2, node3, copy_node1, copy_node3, copy2_node1, copy2_node3 with Tempdir() as tmp_dir: options = builtinOptions() options.build_dir = tmp_dir bm = BuildManager() value1 = SimpleValue( "http://aql.org/download1", name = "target_url1" ) value2 = SimpleValue( "http://aql.org/download2", name = "target_url2" ) value3 = SimpleValue( "http://aql.org/download3", name = "target_url3" ) builder = CopyValueBuilder( options ) bm.add( _makeNodes( builder ) ) self.finished_nodes = 0 bm.build( jobs = 1, keep_going = False ) bm.close() self.assertEqual( self.finished_nodes, 7 ) #// --------- // bm.add( _makeNodes( builder ) ) self.actual_nodes = 0 bm.status() bm.close() self.assertEqual( self.actual_nodes, 7 ) #// --------- // bm.add( _makeNodes( builder ) ) self.removed_nodes = 0 bm.clear() bm.close() self.assertEqual( self.removed_nodes, 7 ) #// --------- // bm.add( _makeNodes( builder ) ) self.actual_nodes = 0 self.outdated_nodes = 0 bm.status() bm.close() self.assertEqual( self.actual_nodes, 0 ) self.assertEqual( self.outdated_nodes, 3 ) #// --------- // nodes = _makeNodes( builder ) copy_node3 = nodes[4] bm.add( nodes ) self.finished_nodes = 0 bm.build( jobs = 1, keep_going = False, nodes = copy_node3 ) bm.close() self.assertEqual( self.finished_nodes, 2 ) #// --------- // nodes = _makeNodes( builder ) node2 = nodes[1]; copy_node3 = nodes[4] bm.add( nodes ) self.finished_nodes = 0 bm.build( jobs = 1, keep_going = False, nodes = [node2, copy_node3] ) bm.close() self.assertEqual( self.finished_nodes, 1 )