summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/settings/TestSettings.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/settings/TestSettings.py74
1 files changed, 19 insertions, 55 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py b/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
index 8d68ff865d1..715cbab7c2a 100644
--- a/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
+++ b/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py
@@ -17,16 +17,8 @@ from lldbsuite.test import lldbutil
class SettingsCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
- @classmethod
- def classCleanup(cls):
- """Cleanup the test byproducts."""
- cls.RemoveTempFile("output1.txt")
- cls.RemoveTempFile("output2.txt")
- cls.RemoveTempFile("stderr.txt")
- cls.RemoveTempFile("stdout.txt")
-
- @no_debug_info_test
def test_apropos_should_also_search_settings_description(self):
"""Test that 'apropos' command should also search descriptions for the settings variables."""
@@ -35,7 +27,6 @@ class SettingsCommandTestCase(TestBase):
"environment variables",
"executable's environment"])
- @no_debug_info_test
def test_append_target_env_vars(self):
"""Test that 'append target.run-args' works."""
# Append the env-vars.
@@ -48,7 +39,6 @@ class SettingsCommandTestCase(TestBase):
self.expect('settings show target.env-vars',
substrs=['MY_ENV_VAR=YES'])
- @no_debug_info_test
def test_insert_before_and_after_target_run_args(self):
"""Test that 'insert-before/after target.run-args' works."""
# Set the run-args first.
@@ -70,7 +60,6 @@ class SettingsCommandTestCase(TestBase):
'[3]: "b"',
'[4]: "c"'])
- @no_debug_info_test
def test_replace_target_run_args(self):
"""Test that 'replace target.run-args' works."""
# Set the run-args and then replace the index-0 element.
@@ -88,7 +77,6 @@ class SettingsCommandTestCase(TestBase):
'[1]: "b"',
'[2]: "c"'])
- @no_debug_info_test
def test_set_prompt(self):
"""Test that 'set prompt' actually changes the prompt."""
@@ -106,7 +94,6 @@ class SettingsCommandTestCase(TestBase):
# Use '-r' option to reset to the original default prompt.
self.runCmd("settings clear prompt")
- @no_debug_info_test
def test_set_term_width(self):
"""Test that 'set term-width' actually changes the term-width."""
@@ -153,7 +140,8 @@ class SettingsCommandTestCase(TestBase):
substrs=[format_string])
self.runCmd("breakpoint set -n main")
- self.runCmd("run")
+ self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
+ RUN_SUCCEEDED)
self.expect("thread backtrace",
substrs=["`main", self.getSourceDir()])
@@ -231,13 +219,11 @@ class SettingsCommandTestCase(TestBase):
self.addTearDownHook(
lambda: self.runCmd("settings clear target.env-vars"))
- self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
+ RUN_SUCCEEDED)
# Read the output file produced by running the program.
- if lldb.remote_platform:
- self.runCmd('platform get-file "output2.txt" "output2.txt"')
- with open('output2.txt', 'r') as f:
- output = f.read()
+ output = lldbutil.read_file_from_process_wd(self, "output2.txt")
self.expect(
output,
@@ -272,13 +258,11 @@ class SettingsCommandTestCase(TestBase):
os.environ.pop("MY_HOST_ENV_VAR2")
self.addTearDownHook(unset_env_variables)
- self.runCmd("run", RUN_SUCCEEDED)
+ self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
+ RUN_SUCCEEDED)
# Read the output file produced by running the program.
- if lldb.remote_platform:
- self.runCmd('platform get-file "output1.txt" "output1.txt"')
- with open('output1.txt', 'r') as f:
- output = f.read()
+ output = lldbutil.read_file_from_process_wd(self, "output1.txt")
self.expect(
output,
@@ -296,8 +280,10 @@ class SettingsCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set the error-path and output-path and verify both are set.
- self.runCmd("settings set target.error-path stderr.txt")
- self.runCmd("settings set target.output-path stdout.txt")
+ self.runCmd("settings set target.error-path '{0}'".format(
+ lldbutil.append_to_process_working_directory(self, "stderr.txt")))
+ self.runCmd("settings set target.output-path '{0}".format(
+ lldbutil.append_to_process_working_directory(self, "stdout.txt")))
# And add hooks to restore the original settings during tearDown().
self.addTearDownHook(
lambda: self.runCmd("settings clear target.output-path"))
@@ -306,44 +292,26 @@ class SettingsCommandTestCase(TestBase):
self.expect("settings show target.error-path",
SETTING_MSG("target.error-path"),
- substrs=['target.error-path (file) = "stderr.txt"'])
+ substrs=['target.error-path (file)', 'stderr.txt"'])
self.expect("settings show target.output-path",
SETTING_MSG("target.output-path"),
- substrs=['target.output-path (file) = "stdout.txt"'])
-
- self.runCmd("run", RUN_SUCCEEDED)
-
- if lldb.remote_platform:
- self.runCmd('platform get-file "stderr.txt" "stderr.txt"')
- self.runCmd('platform get-file "stdout.txt" "stdout.txt"')
-
- # The 'stderr.txt' file should now exist.
- self.assertTrue(os.path.isfile("stderr.txt"),
- "'stderr.txt' exists due to target.error-path.")
+ substrs=['target.output-path (file)', 'stdout.txt"'])
- # Read the output file produced by running the program.
- with open('stderr.txt', 'r') as f:
- output = f.read()
+ self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
+ RUN_SUCCEEDED)
+ output = lldbutil.read_file_from_process_wd(self, "stderr.txt")
message = "This message should go to standard error."
if lldbplatformutil.hasChattyStderr(self):
self.expect(output, exe=False, substrs=[message])
else:
self.expect(output, exe=False, startstr=message)
- # The 'stdout.txt' file should now exist.
- self.assertTrue(os.path.isfile("stdout.txt"),
- "'stdout.txt' exists due to target.output-path.")
-
- # Read the output file produced by running the program.
- with open('stdout.txt', 'r') as f:
- output = f.read()
-
+ output = lldbutil.read_file_from_process_wd(self, "stdout.txt")
self.expect(output, exe=False,
startstr="This message should go to standard out.")
- @no_debug_info_test
def test_print_dictionary_setting(self):
self.runCmd("settings clear target.env-vars")
self.runCmd("settings set target.env-vars [\"MY_VAR\"]=some-value")
@@ -351,7 +319,6 @@ class SettingsCommandTestCase(TestBase):
substrs=["MY_VAR=some-value"])
self.runCmd("settings clear target.env-vars")
- @no_debug_info_test
def test_print_array_setting(self):
self.runCmd("settings clear target.run-args")
self.runCmd("settings set target.run-args gobbledy-gook")
@@ -359,7 +326,6 @@ class SettingsCommandTestCase(TestBase):
substrs=['[0]: "gobbledy-gook"'])
self.runCmd("settings clear target.run-args")
- @no_debug_info_test
def test_settings_with_quotes(self):
self.runCmd("settings clear target.run-args")
self.runCmd("settings set target.run-args a b c")
@@ -392,7 +358,6 @@ class SettingsCommandTestCase(TestBase):
'thread-format (format-string) = "abc def "')
self.runCmd('settings clear thread-format')
- @no_debug_info_test
def test_settings_with_trailing_whitespace(self):
# boolean
@@ -517,7 +482,6 @@ class SettingsCommandTestCase(TestBase):
substrs=['disassembly-format (format-string) = "foo "'])
self.runCmd("settings clear disassembly-format", check=False)
- @no_debug_info_test
def test_all_settings_exist(self):
self.expect("settings show",
substrs=["auto-confirm",
OpenPOWER on IntegriCloud