diff options
| author | ruki <[email protected]> | 2026-01-14 00:54:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-14 00:54:15 +0800 |
| commit | 530e5a95527fc004bc70027e413cb91d15aa0a8a (patch) | |
| tree | 0cc4106de597db0e76076df94ae160ae5103cd1b /tests/projects/package/requires_lock/test.lua | |
| parent | 02cd7a65f48466d73ea2ead486a55dfc9109149e (diff) | |
remove lockfile first
Diffstat (limited to 'tests/projects/package/requires_lock/test.lua')
| -rw-r--r-- | tests/projects/package/requires_lock/test.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/projects/package/requires_lock/test.lua b/tests/projects/package/requires_lock/test.lua index c912246cd..213b1ba60 100644 --- a/tests/projects/package/requires_lock/test.lua +++ b/tests/projects/package/requires_lock/test.lua @@ -55,6 +55,12 @@ function remove_zlib_packages() os.execv("xmake", {"lua", "private.xrepo", "remove", "--all", "-y", "zlib"}) end +-- helper function to remove existing lock file +function remove_lock_file(scriptdir) + local lockfile = path.join(scriptdir, "xmake-requires.lock") + os.tryrm(lockfile) +end + -- test lock file generation and basic content validation function test_lock_file_generation(scriptdir) local lockfile = path.join(scriptdir, "xmake-requires.lock") @@ -173,15 +179,18 @@ function main(t) -- only for x86/x64, because it will take too long time on ci with arm/mips if os.subarch():startswith("x") or os.subarch() == "i386" then + -- get script directory from context filename + local scriptdir = path.directory(t.filename) + + -- remove existing lock file before test + remove_lock_file(scriptdir) + -- remove installed packages using xmake lua private.xrepo to trigger reinstallation remove_zlib_packages() -- build project and generate requires lock t:build() - -- get script directory from context filename - local scriptdir = path.directory(t.filename) - -- test requires lock file generation and content test_lock_file_generation(scriptdir) |
