Skip to content

Commit db95970

Browse files
fix: remove DWARF debug info as well if it's generated
1 parent b97c217 commit db95970

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

lua/competitest/runner.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,30 @@ function TCRunner:run_testcases(tctbl, compile)
192192
mut = math.min(tc_size, mut)
193193
self.next_tc = 1
194194

195+
local function rmdir(dir)
196+
local d = luv.fs_opendir(dir)
197+
if d then
198+
while true do
199+
local content = luv.fs_readdir(d, nil, 1)
200+
if not content then
201+
break
202+
end
203+
for _, entry in ipairs(content) do
204+
if entry.name ~= "." or entry.name ~= ".." then
205+
local path = dir .. "/" .. entry.name
206+
if entry.type == 'directory' then
207+
rmdir(path)
208+
elseif entry.type == 'file' then
209+
luv.fs_unlink(path)
210+
end
211+
end
212+
end
213+
end
214+
luv.fs_closedir(d)
215+
end
216+
luv.fs_rmdir(dir)
217+
end
218+
195219
function self.run_next_tc(tcnum)
196220
if tcnum then
197221
if tcnum == 1 and self.compile then
@@ -206,6 +230,12 @@ function TCRunner:run_testcases(tctbl, compile)
206230
local rc_exec = self.running_directory .. sep .. self.rc.exec
207231
if self.compile and self.config.remove_compiled_binary and vim.fn.filereadable(rc_exec) then
208232
os.remove(rc_exec)
233+
if vim.fn.has("mac") then
234+
local dsym = rc_exec .. ".dSYM"
235+
if vim.fn.isdirectory(dsym) then
236+
rmdir(dsym)
237+
end
238+
end
209239
end
210240
return
211241
end

0 commit comments

Comments
 (0)