[Lldb-commits] [lldb] 9c144b3 - [lldb/test] Fix InvalidScriptedThread windows test failure
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 6 18:00:25 PST 2021
Author: Med Ismail Bennani
Date: 2021-12-06T17:59:29-08:00
New Revision: 9c144b3b0d6a995c2a1eecb53db06f3896e878ff
URL: https://github.com/llvm/llvm-project/commit/9c144b3b0d6a995c2a1eecb53db06f3896e878ff
DIFF: https://github.com/llvm/llvm-project/commit/9c144b3b0d6a995c2a1eecb53db06f3896e878ff.diff
LOG: [lldb/test] Fix InvalidScriptedThread windows test failure
This patch should fix a Windows test failure for the
InvalidScriptedThread test:
https://lab.llvm.org/buildbot/#/builders/83/builds/12571
This refactors the test to stop using python `tempfile` since it's not
supported on Windows and creates a logfile at runtime in the test folder.
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Added:
Modified:
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
Removed:
################################################################################
diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
index 87ea860f436d..603dc7fa6c12 100644
--- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -47,6 +47,9 @@ def test_invalid_scripted_register_context(self):
self.build()
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
self.assertTrue(target, VALID_TARGET)
+ log_file = self.getBuildArtifact('thread.log')
+ self.runCmd("log enable lldb thread -f " + log_file)
+ self.assertTrue(os.path.isfile(log_file))
os.environ['SKIP_SCRIPTED_PROCESS_LAUNCH'] = '1'
def cleanup():
@@ -61,17 +64,18 @@ def cleanup():
launch_info.SetProcessPluginName("ScriptedProcess")
launch_info.SetScriptedProcessClassName("invalid_scripted_process.InvalidScriptedProcess")
error = lldb.SBError()
- with tempfile.NamedTemporaryFile() as log_file:
- self.runCmd("log enable lldb thread -f " + log_file.name)
- process = target.Launch(launch_info, error)
- self.assertTrue(error.Success(), error.GetCString())
- self.assertTrue(process, PROCESS_IS_VALID)
- self.assertEqual(process.GetProcessID(), 666)
- self.assertEqual(process.GetNumThreads(), 0)
+ process = target.Launch(launch_info, error)
+
+ self.assertTrue(error.Success(), error.GetCString())
+ self.assertTrue(process, PROCESS_IS_VALID)
+ self.assertEqual(process.GetProcessID(), 666)
+ self.assertEqual(process.GetNumThreads(), 0)
+
+ with open(log_file, 'r') as f:
+ log = f.read()
- self.assertIn("Failed to get scripted thread registers data.".encode(),
- log_file.read())
+ self.assertIn("Failed to get scripted thread registers data.", log)
@skipIf(archs=no_match(['x86_64']))
def test_scripted_process_and_scripted_thread(self):
More information about the lldb-commits
mailing list