[Lldb-commits] [lldb] c93eb43 - [lldb] Fix TestFileHandle.lua

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 8 07:23:16 PST 2024


Author: Jonas Devlieghere
Date: 2024-11-08T07:23:11-08:00
New Revision: c93eb43a63d3b5c90e828608b5c2063644a3b161

URL: https://github.com/llvm/llvm-project/commit/c93eb43a63d3b5c90e828608b5c2063644a3b161
DIFF: https://github.com/llvm/llvm-project/commit/c93eb43a63d3b5c90e828608b5c2063644a3b161.diff

LOG: [lldb] Fix TestFileHandle.lua

 - Explicitly create an `SBFile`.
 - Add missing call to `close`.
 - Use `SetErrorFile` in TestLegacyFileErr.

Added: 
    

Modified: 
    lldb/test/API/lua_api/TestFileHandle.lua

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lua_api/TestFileHandle.lua b/lldb/test/API/lua_api/TestFileHandle.lua
index aed45be206ea62..8db5ccb2c4650a 100644
--- a/lldb/test/API/lua_api/TestFileHandle.lua
+++ b/lldb/test/API/lua_api/TestFileHandle.lua
@@ -2,7 +2,8 @@ _T = require('lua_lldb_test').create_test('TestFileHandle')
 
 function _T:TestLegacyFileOutScript()
     local f = io.open(self.output, 'w')
-    self.debugger:SetOutputFile(f)
+    local sbf = lldb.SBFile(f)
+    self.debugger:SetOutputFile(sbf)
     self:handle_command('script print(1+1)')
     self.debugger:GetOutputFileHandle():write('FOO\n')
     self.debugger:GetOutputFileHandle():flush()
@@ -15,7 +16,8 @@ end
 
 function _T:TestLegacyFileOut()
     local f = io.open(self.output, 'w')
-    self.debugger:SetOutputFile(f)
+    local sbf = lldb.SBFile(f)
+    self.debugger:SetOutputFile(sbf)
     self:handle_command('expression/x 3735928559', false)
     f:close()
 
@@ -26,8 +28,10 @@ end
 
 function _T:TestLegacyFileErr()
     local f = io.open(self.output, 'w')
-    self.debugger:SetErrorFile(f)
+    local sbf = lldb.SBFile(f)
+    self.debugger:SetErrorFile(sbf)
     self:handle_command('lol', false)
+    f:close()
 
     f = io.open(self.output, 'r')
     assertStrContains(f:read('*l'), 'is not a valid command')


        


More information about the lldb-commits mailing list