Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r83916 - trunk/tools/build/v2/test
From: steven_at_[hidden]
Date: 2013-04-15 12:30:23


Author: steven_watanabe
Date: 2013-04-15 12:30:23 EDT (Mon, 15 Apr 2013)
New Revision: 83916
URL: http://svn.boost.org/trac/boost/changeset/83916

Log:
Add extra debug information with --verbose.
Text files modified:
   trunk/tools/build/v2/test/MockToolset.py | 41 +++++++++++++++++++++++++++++++++++++--
   1 files changed, 38 insertions(+), 3 deletions(-)

Modified: trunk/tools/build/v2/test/MockToolset.py
==============================================================================
--- trunk/tools/build/v2/test/MockToolset.py (original)
+++ trunk/tools/build/v2/test/MockToolset.py 2013-04-15 12:30:23 EDT (Mon, 15 Apr 2013)
@@ -27,14 +27,16 @@
 cwd = os.environ["JAM_CWD"]
 
 class MockInfo(object):
- def __init__(self):
+ def __init__(self, verbose=False):
     self.files = dict()
     self.commands = list()
+ self.verbose = verbose
   def source_file(self, name, pattern):
     self.files[name] = pattern
   def action(self, command, status=0):
     self.commands.append((command, status))
   def check(self, command):
+ print "Testing command", command
     for (raw, status) in self.commands:
       if self.matches(raw, command):
         return status
@@ -42,7 +44,11 @@
     (expected_options, expected_args) = parser.parse_args(raw.split())
     options = command[0]
     input_files = list(command[1])
+ if self.verbose:
+ print " - matching against", (expected_options, expected_args)
     if len(expected_args) != len(input_files):
+ if self.verbose:
+ print " argument list sizes differ"
       return False
     for arg in expected_args:
       if arg.startswith('$'):
@@ -58,17 +64,25 @@
         if matching_file is not None:
           input_files.remove(matching_file)
         else:
+ if self.verbose:
+ print " Failed to match input file contents: %s" % arg
           return False
       else:
         if arg in input_files:
           input_files.remove(arg)
         else:
+ if self.verbose:
+ print " Failed to match input file: %s" % arg
           return False
 
     if options.language != expected_options.language:
+ if self.verbose:
+ print " Failed to match -c"
       return False
 
     if options.compile != expected_options.compile:
+ if self.verbose:
+ print " Failed to match -x"
       return False
 
     # Normalize a path for comparison purposes
@@ -82,6 +96,9 @@
       expected_options.includes = []
     if map(adjust_path, options.includes) != \
         map(adjust_path, expected_options.includes):
+ if self.verbose:
+ print " Failed to match -I ", map(adjust_path, options.includes), \
+ " != ", map(adjust_path, expected_options.includes)
       return False
 
     if options.library_path is None:
@@ -90,18 +107,29 @@
       expected_options.library_path = []
     if map(adjust_path, options.library_path) != \
         map(adjust_path, expected_options.library_path):
+ if self.verbose:
+ print " Failed to match -L ", map(adjust_path, options.library_path), \
+ " != ", map(adjust_path, expected_options.library_path)
       return False
 
     if options.static_libraries != expected_options.static_libraries:
+ if self.verbose:
+ print " Failed to match --static-lib"
       return False
 
     if options.shared_libraries != expected_options.shared_libraries:
+ if self.verbose:
+ print " Failed to match --shared-lib"
       return False
 
     if options.dll != expected_options.dll:
+ if self.verbose:
+ print " Failed to match --dll"
       return False
 
     if options.archive != expected_options.archive:
+ if self.verbose:
+ print " Failed to match --archive"
       return False
 
     # The output must be handled after everything else
@@ -117,11 +145,17 @@
           with open(options.output_file, 'w') as output:
             output.write(fileid)
       else:
+ if self.verbose:
+ print "Failed to match -o"
         return False
     elif options.output_file is not None:
+ if self.verbose:
+ print "Failed to match -o"
       return False
 
     # if we've gotten here, then everything matched
+ if self.verbose:
+ print " Matched"
     return True
 ''')
 
@@ -205,11 +239,12 @@
 ''' % sys.executable.replace('\\', '\\\\'))
 
 def set_expected(t, markup):
+ verbose = "True" if t.verbose else "False"
   t.write('markup.py', '''
 import mockinfo
-info = mockinfo.MockInfo()
+info = mockinfo.MockInfo(%s)
 def source_file(name, contents):
   info.source_file(name, contents)
 def action(command, status=0):
   info.action(command, status)
-''' + markup)
+''' % verbose + markup)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk