From 6a8b9c33205918a4a2536b9cbf39a9ff9042a70d Mon Sep 17 00:00:00 2001 From: liujia178 Date: Tue, 12 Dec 2023 17:07:12 +0800 Subject: [PATCH] [test] Modify the code check of the test linker Signed-off-by: liujia178 --- lldb/test/API/test_linker/TestLinkerLaunch.py | 18 ++++++++++-------- lldb/test/API/test_linker/main.c | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lldb/test/API/test_linker/TestLinkerLaunch.py b/lldb/test/API/test_linker/TestLinkerLaunch.py index e968bd951d87..223bc6c75c94 100644 --- a/lldb/test/API/test_linker/TestLinkerLaunch.py +++ b/lldb/test/API/test_linker/TestLinkerLaunch.py @@ -19,12 +19,14 @@ a remote-ohos connection, will skip on CI or remote = false. import subprocess import sys +import os import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import skipIf, skipUnlessPlatform +from lldbsuite.test.lldbtest import TestBase, PROCESS_IS_VALID, BREAKPOINT_HIT_ONCE from lldbsuite.test import lldbutil + class LaunchLinker(TestBase): NO_DEBUG_INFO_TESTCASE = True @@ -47,10 +49,10 @@ class LaunchLinker(TestBase): """Create target, breakpoint, launch a process, and then kill it.""" target = self.dbg.CreateTarget(self.exe) - breakpoint = target.BreakpointCreateByName("__dls2b") + bkpt_dls2b = target.BreakpointCreateByName("__dls2b") # The default state after breakpoint creation should be enabled. self.assertTrue( - breakpoint.IsEnabled(), "Breakpoint should be enabled after creation" + bkpt_dls2b.IsEnabled(), "Breakpoint should be enabled after creation" ) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) @@ -59,7 +61,7 @@ class LaunchLinker(TestBase): self.assertIsNotNone(thread) # The breakpoint should have a hit count of 1. - self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) + self.assertEqual(bkpt_dls2b.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) # Destroy process before TestBase.tearDown() self.dbg.GetSelectedTarget().GetProcess().Destroy() @@ -70,10 +72,10 @@ class LaunchLinker(TestBase): """Create target, breakpoint, launch a process, and then kill it.""" target = self.dbg.CreateTarget(self.exe) - breakpoint = target.BreakpointCreateByName("printf") + bkpt_printf = target.BreakpointCreateByName("printf") # The default state after breakpoint creation should be enabled. self.assertTrue( - breakpoint.IsEnabled(), "Breakpoint should be enabled after creation" + bkpt_printf.IsEnabled(), "Breakpoint should be enabled after creation" ) process = target.LaunchSimple(None, None, self.get_process_working_directory()) self.assertTrue(process, PROCESS_IS_VALID) @@ -82,7 +84,7 @@ class LaunchLinker(TestBase): self.assertIsNotNone(thread) # The breakpoint should have a hit count of 1. - self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) + self.assertEqual(bkpt_printf.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) # Destroy process before TestBase.tearDown() self.dbg.GetSelectedTarget().GetProcess().Destroy() diff --git a/lldb/test/API/test_linker/main.c b/lldb/test/API/test_linker/main.c index f404bb69b769..f93b92476b5a 100644 --- a/lldb/test/API/test_linker/main.c +++ b/lldb/test/API/test_linker/main.c @@ -15,8 +15,8 @@ #include -int main () +int main() { - printf("test musl/linker!\n"); - return 0; + printf("test musl/linker!\n"); + return 0; } -- Gitee