[Lldb-commits] [lldb] r256255 - test infra: fix lldbinline tests to work with rerun

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 22 09:14:47 PST 2015


Author: tfiala
Date: Tue Dec 22 11:14:47 2015
New Revision: 256255

URL: http://llvm.org/viewvc/llvm-project?rev=256255&view=rev
Log:
test infra: fix lldbinline tests to work with rerun

Fixes:
https://llvm.org/bugs/show_bug.cgi?id=25922

Added:
    lldb/trunk/packages/Python/lldbsuite/test/issue_verification/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/issue_verification/TestRerunInline.py.park
    lldb/trunk/packages/Python/lldbsuite/test/issue_verification/inline_rerun_inferior.cpp
Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
    lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py

Added: lldb/trunk/packages/Python/lldbsuite/test/issue_verification/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/issue_verification/Makefile?rev=256255&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/issue_verification/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/issue_verification/Makefile Tue Dec 22 11:14:47 2015
@@ -0,0 +1,4 @@
+LEVEL = ../make
+CXX_SOURCES := inline_rerun_inferior.cpp
+CXXFLAGS += -std=c++11
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/packages/Python/lldbsuite/test/issue_verification/TestRerunInline.py.park
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/issue_verification/TestRerunInline.py.park?rev=256255&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/issue_verification/TestRerunInline.py.park (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/issue_verification/TestRerunInline.py.park Tue Dec 22 11:14:47 2015
@@ -0,0 +1,13 @@
+"""Tests that the rerun mechanism respects lldbinline-created tests.
+
+The current implementation of this test is expected to fail both on
+the initial run and on the rerun, assuming --rerun-all-issues is provided
+to the dotest.py run.
+
+This test could be improved by doing something in the test inferior
+C++ program that could look for the "should an issue be raised" marker
+file, and then really pass on the rerun.
+"""
+import lldbsuite.test.lldbinline as lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())

Added: lldb/trunk/packages/Python/lldbsuite/test/issue_verification/inline_rerun_inferior.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/issue_verification/inline_rerun_inferior.cpp?rev=256255&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/issue_verification/inline_rerun_inferior.cpp (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/issue_verification/inline_rerun_inferior.cpp Tue Dec 22 11:14:47 2015
@@ -0,0 +1,14 @@
+//===-- main.cpp --------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+typedef int Foo;
+
+int main() {
+    Foo array[3] = {1,2,3};
+    return 0; //% self.expect("frame variable array --show-types --", substrs = ['(Foo [3]) wrong_type_here = {','(Foo) [0] = 1','(Foo) [1] = 2','(Foo) [2] = 3'])
+}

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=256255&r1=256254&r2=256255&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Tue Dec 22 11:14:47 2015
@@ -203,6 +203,8 @@ def MakeInlineTest(__file, __globals, de
 
     # Add the test case to the globals, and hide InlineTest
     __globals.update({test_name : test})
-    
+
+    # Store the name of the originating file.o
+    test.test_filename = __file
     return test
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py?rev=256255&r1=256254&r2=256255&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/result_formatter.py Tue Dec 22 11:14:47 2015
@@ -242,11 +242,18 @@ class EventBuilder(object):
         """
         test_class_name, test_name = EventBuilder._get_test_name_info(test)
 
+        # Determine the filename for the test case.  If there is an attribute
+        # for it, use it.  Otherwise, determine from the TestCase class path.
+        if hasattr(test, "test_filename"):
+            test_filename = test.test_filename
+        else:
+            test_filename = inspect.getfile(test.__class__)
+
         event = EventBuilder.bare_event(event_type)
         event.update({
             "test_class": test_class_name,
             "test_name": test_name,
-            "test_filename": inspect.getfile(test.__class__)
+            "test_filename": test_filename
         })
 
         return event




More information about the lldb-commits mailing list