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

Daniel Dunbar daniel at zuster.org
Wed Sep 22 14:10:17 PDT 2010


Author: ddunbar
Date: Wed Sep 22 16:10:17 2010
New Revision: 114582

URL: http://llvm.org/viewvc/llvm-project?rev=114582&view=rev
Log:
LNT/nt: Change get_cc_info to pickup the 'as' and 'ld' versions as the compiler
would find them (using the flags under test). This makes sure we capture the
appropriate version and information even with things like sysroot flags, etc.

Modified:
    zorg/trunk/lnt/lnt/testing/util/compilers.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=114582&r1=114581&r2=114582&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/testing/util/compilers.py (original)
+++ zorg/trunk/lnt/lnt/testing/util/compilers.py Wed Sep 22 16:10:17 2010
@@ -1,8 +1,10 @@
 import hashlib
 import re
+import tempfile
 
-from commands import error
 from commands import capture
+from commands import error
+from commands import rm_f
 
 def get_cc_info(path, cc_flags=[]):
     """get_cc_info(path) -> { ... }
@@ -107,6 +109,19 @@
             error("unable to determine LLVM compiler target: %r: %r" %
                   (cc, target_cc_ll))
 
+    # Determine the binary tool versions for the assembler and the linker, as
+    # found by the compiler.
+    cc_as_version = capture([cc, "-c", '-Wa,-v'] + cc_flags +
+                            ['-x', 'assembler', '/dev/null'],
+                            include_stderr=True).strip()
+
+    tf = tempfile.NamedTemporaryFile(suffix='.c', delete=False)
+    print >>tf, "int main() { return 0; }"
+    tf.close()
+    cc_ld_version = capture([cc, "-Wl,-v"] + cc_flags + [tf.name],
+                            include_stderr=True).strip()
+    rm_f(tf.name)
+
     cc_exec_hash = hashlib.sha1()
     cc_exec_hash.update(open(cc,'rb').read())
 
@@ -120,6 +135,8 @@
              'cc_version' :cc_version,
              'cc_exec_hash' : cc_exec_hash.hexdigest(),
              'cc1_exec_hash' : cc1_exec_hash.hexdigest(),
+             'cc_as_version' : cc_as_version,
+             'cc_ld_version' : cc_ld_version,
              }
     if cc_src_tag is not None:
         info['cc_src_tag'] = cc_src_tag

Modified: zorg/trunk/lnt/lnt/tests/nt.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=114582&r1=114581&r2=114582&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/tests/nt.py (original)
+++ zorg/trunk/lnt/lnt/tests/nt.py Wed Sep 22 16:10:17 2010
@@ -443,11 +443,6 @@
     # Create the machine entry.
     machine = lnt.testing.Machine(nick, machine_info)
 
-    # Capture binary tool versions.
-    run_info['as_version'] = capture(["gcc", "-c", "-xassembler", "/dev/null",
-                                      "-Wa,-v"], include_stderr=True).strip()
-    run_info['ld_version'] = capture(["ld", "-v"], include_stderr=True).strip()
-
     # FIXME: Hack, use better method of getting versions. Ideally, from binaries
     # so we are more likely to be accurate.
     run_info['llvm_revision'] = llvm_source_version





More information about the llvm-commits mailing list