Author: Raphael Isemann Date: 2020-06-12T16:06:05+02:00 New Revision: f52e4129a7c748421543d6572806dfec2407bbd3
URL: https://github.com/llvm/llvm-project/commit/f52e4129a7c748421543d6572806dfec2407bbd3 DIFF: https://github.com/llvm/llvm-project/commit/f52e4129a7c748421543d6572806dfec2407bbd3.diff LOG: [lldb][NFC] Modernize TestPersistentVariables Added: Modified: lldb/test/API/commands/expression/persistent_variables/TestPersistentVariables.py lldb/test/API/commands/expression/persistent_variables/main.c Removed: ################################################################################ diff --git a/lldb/test/API/commands/expression/persistent_variables/TestPersistentVariables.py b/lldb/test/API/commands/expression/persistent_variables/TestPersistentVariables.py index 57c04b215e97..af909e95f7fd 100644 --- a/lldb/test/API/commands/expression/persistent_variables/TestPersistentVariables.py +++ b/lldb/test/API/commands/expression/persistent_variables/TestPersistentVariables.py @@ -15,38 +15,16 @@ class PersistentVariablesTestCase(TestBase): def test_persistent_variables(self): """Test that lldb persistent variables works correctly.""" self.build() - - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) - - self.runCmd("breakpoint set --source-pattern-regexp break") - - self.runCmd("run", RUN_SUCCEEDED) - - self.runCmd("expression int $i = i") - - self.expect("expression $i == i", - startstr="(bool) $0 = true") - - self.expect("expression $i + 1", - startstr="(int) $1 = 6") - - self.expect("expression $i + 3", - startstr="(int) $2 = 8") - - self.expect("expression $2 + $1", - startstr="(int) $3 = 14") - - self.expect("expression $3", - startstr="(int) $3 = 14") - - self.expect("expression $2", - startstr="(int) $2 = 8") - - self.expect("expression (int)-2", - startstr="(int) $4 = -2") - - self.expect("expression $4 > (int)31", - startstr="(bool) $5 = false") - - self.expect("expression (long)$4", - startstr="(long) $6 = -2") + lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.c")) + + self.runCmd("expr int $i = i") + self.expect_expr("$i == i", result_type="bool", result_value="true") + self.expect_expr("$i + 1", result_type="int", result_value="6") + self.expect_expr("$i + 3", result_type="int", result_value="8") + self.expect_expr("$1 + $2", result_type="int", result_value="14") + self.expect_expr("$3", result_type="int", result_value="14") + self.expect_expr("$2", result_type="int", result_value="8") + self.expect_expr("(int)-2", result_type="int", result_value="-2") + self.expect_expr("$4", result_type="int", result_value="-2") + self.expect_expr("$4 > (int)31", result_type="bool", result_value="false") + self.expect_expr("(long)$4", result_type="long", result_value="-2") diff --git a/lldb/test/API/commands/expression/persistent_variables/main.c b/lldb/test/API/commands/expression/persistent_variables/main.c index 970ee893510c..805df307ee98 100644 --- a/lldb/test/API/commands/expression/persistent_variables/main.c +++ b/lldb/test/API/commands/expression/persistent_variables/main.c @@ -1,5 +1,4 @@ -int main (int argc, char const *argv[]) -{ - int i = 5; - return 0; // Set breakpoint here +int main(int argc, char const *argv[]) { + int i = 5; + return 0; // break here } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits