test infra: fix lldbinline tests to work with rerun

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

llvm-svn: 256255
This commit is contained in:
Todd Fiala 2015-12-22 17:14:47 +00:00
parent 677f3fb215
commit 5bdbef649b
5 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,4 @@
LEVEL = ../make
CXX_SOURCES := inline_rerun_inferior.cpp
CXXFLAGS += -std=c++11
include $(LEVEL)/Makefile.rules

View File

@ -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())

View File

@ -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'])
}

View File

@ -203,6 +203,8 @@ def MakeInlineTest(__file, __globals, decorators=None):
# 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

View File

@ -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