<s> import os <EOL> import subprocess <EOL> import shutil <EOL> from bento . core import PackageDescription <EOL> from bootstrap import main <EOL> main ( ) <EOL> tests = [ ] <EOL> for root , d , files in os . walk ( "<STR_LIT>" ) : <EOL> if os . path . exists ( os . path . join ( root , "<STR_LIT>" ) ) : <EOL> if not os . path . exists ( os . path . join ( root , os . pardir , "<STR_LIT>" ) ) : <EOL> tests . append ( root ) <EOL> def use_waf ( d ) : <EOL> old_cwd = os . getcwd ( ) <EOL> try : <EOL> os . chdir ( d ) <EOL> package = PackageDescription . from_file ( "<STR_LIT>" ) <EOL> return "<STR_LIT>" in package . use_backends <EOL> finally : <EOL> os . chdir ( old_cwd ) <EOL> def test_package ( d ) : <EOL> def _run ( ) : <EOL> for bcmd in [ [ "<STR_LIT>" ] , [ "<STR_LIT>" ] , [ "<STR_LIT>" , "<STR_LIT>" ] ] : <EOL> cmd = [ bentomaker ] + bcmd <EOL> p = subprocess . Popen ( cmd , cwd = test , stdout = subprocess . PIPE , stderr = subprocess . STDOUT ) <EOL> p . wait ( ) <EOL> if p . returncode : <EOL> print ( p . stdout . read ( ) . decode ( ) ) <EOL> return False <EOL> return True <EOL> if use_waf ( d ) and not "<STR_LIT>" in os . environ : <EOL> print ( "<STR_LIT>" ) <EOL> return True <EOL> if os . path . exists ( os . path . join ( d , "<STR_LIT>" ) ) : <EOL> shutil . rmtree ( os . path . join ( d , "<STR_LIT>" ) ) <EOL> if _run ( ) : <EOL> return _run ( ) <EOL> else : <EOL> return False <EOL> nerrors = <NUM_LIT:0> <EOL> bentomaker = os . path . join ( os . getcwd ( ) , "<STR_LIT>" ) <EOL> for test in tests : <EOL> print ( "<STR_LIT>" % test ) <EOL> if not test_package ( test ) : <EOL> print ( "<STR_LIT>" ) <EOL> nerrors += <NUM_LIT:1> <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> print ( "<STR_LIT>" % ( nerrors , len ( tests ) ) ) </s>
