From 74b8b0cbadf434516ab5c91d73c02ec170215b7b Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 29 Aug 2024 18:35:23 -0300 Subject: tests: some testing environment cleanups --- spec/unit/build_spec.lua | 3 +++ spec/upload_spec.lua | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/unit/build_spec.lua b/spec/unit/build_spec.lua index e8f13940..7993cf9b 100644 --- a/spec/unit/build_spec.lua +++ b/spec/unit/build_spec.lua @@ -307,10 +307,13 @@ describe("LuaRocks build #unit", function() else os.execute("cl " .. fdir .. "\\fixturedep.c /link /export:fixturedep_fn /out:" .. fdir .. "\\fixturedep.dll /implib:" .. fdir .. "\\fixturedep.lib") end + finally(function() os.remove(fdir .. "\\libfixturedep.dll") end) elseif test_env.TEST_TARGET_OS == "linux" then os.execute("gcc -shared -o " .. fdir .. "/libfixturedep.so " .. fdir .. "/fixturedep.c") + finally(function() os.remove(fdir .. "/libfixturedep.so") end) elseif test_env.TEST_TARGET_OS == "osx" then os.execute("cc -dynamiclib -o " .. fdir .. "/libfixturedep.dylib " .. fdir .. "/fixturedep.c") + finally(function() os.remove(fdir .. "/libfixturedep.dylib") end) end local rockspec = { diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index cc0b606c..5f33c8d5 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -43,8 +43,12 @@ describe("luarocks upload #integration", function() end) it("#gpg rockspec with --sign", function() - os.remove(testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec.asc") - os.remove(testing_paths.testrun_dir .. "/a_rock-1.0-1.src.rock.asc") + local function cleanup() + os.remove(testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec.asc") + os.remove(testing_paths.testrun_dir .. "/a_rock-1.0-1.src.rock.asc") + end + cleanup() + finally(cleanup) print(run.luarocks("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.openssl_dirs .. " --api-key=123 --sign", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"})) end) -- cgit v1.2.3-55-g6feb