[llvm-commits] [zorg] r150740 - in /zorg/trunk/lnt/lnt: testing/util/compilers.py tests/compile.py tests/nt.py

Daniel Dunbar daniel at zuster.org
Thu Feb 16 14:54:01 PST 2012


Author: ddunbar
Date: Thu Feb 16 16:54:01 2012
New Revision: 150740

URL: http://llvm.org/viewvc/llvm-project?rev=150740&view=rev
Log:
[lnt] lnt.testing.util.compilers: Lower run order inference into get_cc_info().
 - Also, update lnt.tests.compile to use the inferred order.

Modified:
    zorg/trunk/lnt/lnt/testing/util/compilers.py
    zorg/trunk/lnt/lnt/tests/compile.py
    zorg/trunk/lnt/lnt/tests/nt.py

Modified: zorg/trunk/lnt/lnt/testing/util/compilers.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/testing/util/compilers.py?rev=150740&r1=150739&r2=150740&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/testing/util/compilers.py (original)
+++ zorg/trunk/lnt/lnt/testing/util/compilers.py Thu Feb 16 16:54:01 2012
@@ -168,8 +168,35 @@
         info['cc_src_revision'] = cc_src_revision
     if cc_src_branch is not None:
         info['cc_src_branch'] = cc_src_branch
+
+    # Infer the run order from the other things we have computed.
+    info['inferred_run_order'] = '%7d' % (get_inferred_run_order(info),)
+
     return info
 
+def get_inferred_run_order(info):
+    # If the CC has a src revision, use that.
+    if info.get('cc_src_revision','').isdigit():
+        return int(info['cc_src_revision'])
+
+    # If this is a production compiler, look for a source tag. We don't accept 0
+    # or 9999 as valid source tag, since that is what llvm-gcc builds use when
+    # no build number is given.
+    if (info.get('cc_build') == 'PROD' and
+          info.get('cc_src_tag') != '0' and
+          info.get('cc_src_tag') != '00' and
+          info.get('cc_src_tag') != '9999' and
+          info.get('cc_src_tag','').split('.',1)[0].isdigit()):
+        return int(info['cc_src_tag'].split('.',1)[0])
+
+    # If that failed, infer from the LLVM revision.
+    if info.get('llvm_revision','').isdigit():
+        return int(info['llvm_revision'])
+
+    # Otherwise, force at least some value for run_order, as it is now
+    # generally required by parts of the "simple" schema.
+    return 0
+
 __all__ = [get_cc_info]
 
 if __name__ == '__main__':

Modified: zorg/trunk/lnt/lnt/tests/compile.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/compile.py?rev=150740&r1=150739&r2=150740&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/compile.py (original)
+++ zorg/trunk/lnt/lnt/tests/compile.py Thu Feb 16 16:54:01 2012
@@ -105,6 +105,9 @@
     cmd.append('-w')
 
     # Do a memory profiling run, if requested.
+    #
+    # FIXME: Doing this as a separate step seems silly. We shouldn't do any
+    # extra run just to get the memory statistics.
     if can_memprof and opts.memory_profiling:
         # Find the cc1 command, which we use to do memory profiling. To do this
         # we execute the compiler with '-###' to figure out what it wants to do.
@@ -567,13 +570,18 @@
         variables = {}
         variables['cc'] = opts.cc
         variables['run_count'] = opts.run_count
-        if not opts.run_order:
-            warning("run_order not set!")
-        else:
-            variables['run_order'] = opts.run_order
 
-        variables.update(
-            lnt.testing.util.compilers.get_cc_info(variables['cc']))
+        # Get compiler info.
+        cc_info = lnt.testing.util.compilers.get_cc_info(variables['cc'])
+        variables.update(cc_info)
+
+        # Set the run order from the user, if given.
+        if opts.run_order is not None:
+            variables['run_order'] = opts.run_order
+        else:
+            # Otherwise, use the inferred run order.
+            variables['run_order'] = cc_info['inferred_run_order']
+            note("inferred run order to be: %r" % (variables['run_order'],))
 
         if opts.verbose:
             format = pprint.pformat(variables)

Modified: zorg/trunk/lnt/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=150740&r1=150739&r2=150740&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/nt.py (original)
+++ zorg/trunk/lnt/lnt/tests/nt.py Thu Feb 16 16:54:01 2012
@@ -776,35 +776,8 @@
         run_info['run_order'] = opts.run_order
 
     else:
-        # Otherwise, try to infer something sensible.
-        #
-        # FIXME: Pretty lame, should we just require the user to specify this?
-
-        # If the CC has a src revision, use that.
-        if run_info.get('cc_src_revision','').isdigit():
-            run_info['run_order'] = run_info['cc_src_revision']
-
-        # Otherwise, if this is a production compiler, look for a source tag. We
-        # don't accept 0 or 9999 as valid source tag, since that is what
-        # llvm-gcc builds use when no build number is given.
-        elif (run_info.get('cc_build') == 'PROD' and
-              run_info.get('cc_src_tag') != '0' and
-              run_info.get('cc_src_tag') != '00' and
-              run_info.get('cc_src_tag') != '9999' and
-              run_info.get('cc_src_tag','').split('.',1)[0].isdigit()):
-            run_info['run_order'] = run_info['cc_src_tag'].split('.',1)[0]
-
-        # Otherwise, infer from the llvm revision.
-        elif run_info.get('llvm_revision','').isdigit():
-            run_info['run_order'] = run_info['llvm_revision']
-
-        # Otherwise, force at least some value for run_order, as it is now
-        # generally required by parts of the "simple" schema.
-        else:
-            run_info['run_order'] = "0"
-
-        if 'run_order' in run_info:
-            run_info['run_order'] = '%7d' % int(run_info['run_order'])
+        # Otherwise, use the inferred run order from the compiler.
+        run_info['run_order'] = cc_info['inferred_run_order']
 
     # Add any user specified parameters.
     for target,params in ((machine_info, opts.machine_parameters),





More information about the llvm-commits mailing list