[Lldb-commits] [lldb] r197106 - Having binary files in a repository is not a good thing

Enrico Granata egranata at apple.com
Wed Dec 11 17:42:17 PST 2013


Author: enrico
Date: Wed Dec 11 19:42:17 2013
New Revision: 197106

URL: http://llvm.org/viewvc/llvm-project?rev=197106&view=rev
Log:
Having binary files in a repository is not a good thing

With this checkin, we use the installed clang compiler to build crashinfo.so from crashinfo.c upon every test suite execution
We also try to cleanup after ourselves, which of course will only work if the test suite does not actually crash


Removed:
    lldb/trunk/test/crashinfo.so
Modified:
    lldb/trunk/test/crashinfo.c
    lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/crashinfo.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/crashinfo.c?rev=197106&r1=197105&r2=197106&view=diff
==============================================================================
--- lldb/trunk/test/crashinfo.c (original)
+++ lldb/trunk/test/crashinfo.c Wed Dec 11 19:42:17 2013
@@ -10,9 +10,6 @@
 * and call crashinfo.setCrashReporterDescription("hello world")
 * The testCrashReporterDescription() API is simply there to let you test that this
 * is doing what it is intended to do without having to actually cons up a crash
-*
-* WARNING: LLDB is using the prebuilt crashinfo.so rather than rebuilding this
-* from scratch each time - rebuild manually if you need to change this module
 ******************************************************************************/
 
 #include <Python/Python.h>

Removed: lldb/trunk/test/crashinfo.so
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/crashinfo.so?rev=197105&view=auto
==============================================================================
Binary file - no diff available.

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=197106&r1=197105&r2=197106&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Wed Dec 11 19:42:17 2013
@@ -20,6 +20,7 @@ Type:
 for available options.
 """
 
+import atexit
 import commands
 import os
 import platform
@@ -388,6 +389,28 @@ def setCrashInfoHook_NonMac(text):
 
 setCrashInfoHook = None
 
+def deleteCrashInfoDylib(dylib_path):
+    try:
+        os.remove(dylib_path)
+    finally:
+        pass
+
+def setupCrashInfoHook():
+    global setCrashInfoHook
+    setCrashInfoHook = setCrashInfoHook_NonMac # safe default
+    if platform.system() == "Darwin":
+        test_dir = os.environ['LLDB_TEST']
+        if not test_dir or not os.path.exists(test_dir):
+            return
+        dylib_src = os.path.join(test_dir,"crashinfo.c")
+        dylib_dst = os.path.join(test_dir,"crashinfo.so")
+        cmd = "xcrun clang %s -o %s -framework Python -Xlinker -dylib -iframework /System/Library/Frameworks/ -Xlinker -F /System/Library/Frameworks/" % (dylib_src,dylib_dst)
+        if subprocess.call(cmd,shell=True) == 0 and os.path.exists(dylib_dst):
+            setCrashInfoHook = setCrashInfoHook_Mac
+            atexit.register(deleteCrashInfoDylib,dylib_dst)
+    else:
+        pass
+
 def parseOptionsAndInitTestdirs():
     """Initialize the list of directories containing our unittest scripts.
 
@@ -548,11 +571,6 @@ def parseOptionsAndInitTestdirs():
         else:
             archs = [platform_machine]
 
-    if platform_system == 'Darwin':
-        setCrashInfoHook = setCrashInfoHook_Mac
-    else:
-        setCrashInfoHook = setCrashInfoHook_NonMac
-
     if args.categoriesList:
         categoriesList = set(validate_categories(args.categoriesList))
         useCategories = True
@@ -1186,6 +1204,7 @@ if sys.platform.startswith("darwin"):
 #
 parseOptionsAndInitTestdirs()
 setupSysPath()
+setupCrashInfoHook()
 
 #
 # If '-l' is specified, do not skip the long running tests.
@@ -1579,6 +1598,9 @@ for ia in range(len(archs) if iterArchs
                 global setCrashInfoHook
                 setCrashInfoHook("%s at %s" % (str(test),inspect.getfile(test.__class__)))
                 self.counter += 1
+                #if self.counter == 4:
+                #    import crashinfo
+                #    crashinfo.testCrashReporterDescription(None)
                 test.test_number = self.counter
                 if self.showAll:
                     self.stream.write(self.fmt % self.counter)





More information about the lldb-commits mailing list