summaryrefslogtreecommitdiffstats
path: root/tools/slang-unit-test/unit-test-lock-file.cpp
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-07-31 13:50:55 -0700
committerGitHub <noreply@github.com>2025-07-31 20:50:55 +0000
commit4a255d211834a5d0218cf1d166180930754b16cd (patch)
treee810b87edb4faf95d310b205eee073ca05fe4f56 /tools/slang-unit-test/unit-test-lock-file.cpp
parent8e1a6a1b4720eebceb98890b4905f044c7d620de (diff)
Fix bug in ci test (#8005)
This commit fixes two problems. 1. uninitialized file handle for lock-file test 2. uninitialized static variable for lock-file test The first bug is more of speculartive rather than actual bug. The second bug was causing heap corruption when it was retried, because the counter was not reset to zero on "retry" and it wrote data to an invalida range in an array.
Diffstat (limited to 'tools/slang-unit-test/unit-test-lock-file.cpp')
-rw-r--r--tools/slang-unit-test/unit-test-lock-file.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/slang-unit-test/unit-test-lock-file.cpp b/tools/slang-unit-test/unit-test-lock-file.cpp
index 6458d4b5f..6f1e0b6b8 100644
--- a/tools/slang-unit-test/unit-test-lock-file.cpp
+++ b/tools/slang-unit-test/unit-test-lock-file.cpp
@@ -37,11 +37,17 @@ SLANG_UNIT_TEST(lockFileSync)
SLANG_IGNORE_TEST
#endif
+ // Clean up any leftover lock file from previous runs
+ File::remove(fileName);
+
// Test using multiple threads.
{
static std::atomic<uint32_t> lockCounter;
static std::atomic<uint32_t> unlockCounter;
+ lockCounter = 0;
+ unlockCounter = 0;
+
struct LockTask
{
std::thread thread;