Пример #1
0
def   _addNodesToBM( builder, src_files, Node = Node ):
  bm = BuildManager()
  try:
    checksums_node = Node( builder, src_files )
    checksums_node2 = Node( builder, checksums_node )
    
    bm.add( checksums_node ); bm.selfTest()
    bm.add( checksums_node2 ); bm.selfTest()
  except Exception:
    bm.close()
    raise
  
  return bm
Пример #2
0
 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 )
Пример #3
0
 def test_bm_deps(self):
   
   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" )
   
   options = builtinOptions()
   
   builder = CopyValueBuilder( options )
   
   node0 = Node( builder, value1 )
   node1 = Node( builder, node0 )
   node2 = Node( builder, node1 )
   node3 = Node( builder, value2 )
   node4 = Node( builder, value3 )
   node5 = Node( builder, node4 )
   
   node6 = Node( builder, node5 )
   node6.depends( [node0, node1] )
   
   bm.add( node0 ); bm.selfTest(); self.assertEqual( len(bm), 1 )
   bm.add( node1 ); bm.selfTest(); self.assertEqual( len(bm), 2 )
   bm.add( node2 ); bm.selfTest(); self.assertEqual( len(bm), 3 )
   bm.add( node3 ); bm.selfTest(); self.assertEqual( len(bm), 4 )
   bm.add( node4 ); bm.selfTest(); self.assertEqual( len(bm), 5 )
   bm.add( node5 ); bm.selfTest(); self.assertEqual( len(bm), 6 )
   bm.add( node6 ); bm.selfTest(); self.assertEqual( len(bm), 7 )
   
   node0.depends( node3 ); bm.depends( node0, node3 ); bm.selfTest()
   node1.depends( node3 ); bm.depends( node1, node3 ); bm.selfTest()
   node2.depends( node3 ); bm.depends( node2, node3 ); bm.selfTest()
   node3.depends( node4 ); bm.depends( node3, node4 ); bm.selfTest()
   node0.depends( node5 ); bm.depends( node0, node5 ); bm.selfTest()
   node5.depends( node3 ); bm.depends( node5, node3 ); bm.selfTest()
   
   with self.assertRaises(ErrorNodeDependencyCyclic):
     node4.depends( node3 ); bm.depends( node4, node3 ); bm.selfTest()