forked from OSchip/llvm-project
Add a test case to exercise 'target variable' command before and after running the inferior.
Currently it fails after the inferior is run. rdar://problem/9763907 llvm-svn: 135009
This commit is contained in:
parent
10bc1e5452
commit
af6e82f611
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Test some target commands: create, list, select.
|
Test some target commands: create, list, select, variable.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import unittest2
|
import unittest2
|
||||||
|
@ -21,19 +21,31 @@ class targetCommandTestCase(TestBase):
|
||||||
def test_target_command_with_dwarf(self):
|
def test_target_command_with_dwarf(self):
|
||||||
"""Test some target commands: create, list, select."""
|
"""Test some target commands: create, list, select."""
|
||||||
da = {'C_SOURCES': 'a.c', 'EXE': 'a.out'}
|
da = {'C_SOURCES': 'a.c', 'EXE': 'a.out'}
|
||||||
self.buildDefault(dictionary=da)
|
self.buildDwarf(dictionary=da)
|
||||||
self.addTearDownCleanup(dictionary=da)
|
self.addTearDownCleanup(dictionary=da)
|
||||||
|
|
||||||
db = {'C_SOURCES': 'b.c', 'EXE': 'b.out'}
|
db = {'C_SOURCES': 'b.c', 'EXE': 'b.out'}
|
||||||
self.buildDefault(dictionary=db)
|
self.buildDwarf(dictionary=db)
|
||||||
self.addTearDownCleanup(dictionary=db)
|
self.addTearDownCleanup(dictionary=db)
|
||||||
|
|
||||||
dc = {'C_SOURCES': 'c.c', 'EXE': 'c.out'}
|
dc = {'C_SOURCES': 'c.c', 'EXE': 'c.out'}
|
||||||
self.buildDefault(dictionary=dc)
|
self.buildDwarf(dictionary=dc)
|
||||||
self.addTearDownCleanup(dictionary=dc)
|
self.addTearDownCleanup(dictionary=dc)
|
||||||
|
|
||||||
self.do_target_command()
|
self.do_target_command()
|
||||||
|
|
||||||
|
# rdar://problem/9763907
|
||||||
|
# 'target variable' command fails if the target program has been run
|
||||||
|
#@unittest2.expectedFailure
|
||||||
|
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
|
||||||
|
def test_target_variable_command_with_dsym(self):
|
||||||
|
"""Test 'target variable' command before and after starting the inferior."""
|
||||||
|
d = {'C_SOURCES': 'globals.c', 'EXE': 'globals'}
|
||||||
|
self.buildDsym(dictionary=d)
|
||||||
|
self.addTearDownCleanup(dictionary=d)
|
||||||
|
|
||||||
|
self.do_target_variable_command('globals')
|
||||||
|
|
||||||
def do_target_command(self):
|
def do_target_command(self):
|
||||||
"""Exercise 'target create', 'target list', 'target select' commands."""
|
"""Exercise 'target create', 'target list', 'target select' commands."""
|
||||||
exe_a = os.path.join(os.getcwd(), "a.out")
|
exe_a = os.path.join(os.getcwd(), "a.out")
|
||||||
|
@ -87,6 +99,24 @@ class targetCommandTestCase(TestBase):
|
||||||
|
|
||||||
self.runCmd("target list")
|
self.runCmd("target list")
|
||||||
|
|
||||||
|
def do_target_variable_command(self, exe_name):
|
||||||
|
"""Exercise 'target variable' command before and after starting the inferior."""
|
||||||
|
self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
|
||||||
|
|
||||||
|
self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
|
||||||
|
substrs = ["my_global_char", "'X'"])
|
||||||
|
self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
|
||||||
|
substrs = ['my_global_str', '"abc"'])
|
||||||
|
|
||||||
|
self.runCmd("run")
|
||||||
|
|
||||||
|
# rdar://problem/9763907
|
||||||
|
# 'target variable' command fails if the target program has been run
|
||||||
|
self.expect("target variable my_global_char", VARIABLES_DISPLAYED_CORRECTLY,
|
||||||
|
substrs = ["my_global_char", "'X'"])
|
||||||
|
self.expect("target variable my_global_str", VARIABLES_DISPLAYED_CORRECTLY,
|
||||||
|
substrs = ['my_global_str', '"abc"'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import atexit
|
import atexit
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
//===-- main.c --------------------------------------------------*- C++ -*-===//
|
||||||
|
//
|
||||||
|
// The LLVM Compiler Infrastructure
|
||||||
|
//
|
||||||
|
// This file is distributed under the University of Illinois Open Source
|
||||||
|
// License. See LICENSE.TXT for details.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
char my_global_char = 'X';
|
||||||
|
const char* my_global_str = "abc";
|
||||||
|
|
||||||
|
int main (int argc, char const *argv[])
|
||||||
|
{
|
||||||
|
printf("global char: %c\n", my_global_char);
|
||||||
|
|
||||||
|
printf("global str: %s\n", my_global_str);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue