From f573f1ee56f495d896e59b1bfc11841e65a3463a Mon Sep 17 00:00:00 2001 From: Benjamin Winger Date: Tue, 16 Apr 2024 15:01:03 -0400 Subject: [PATCH] Fix cleaning up the test directory on windows/macos CI The windows and macos CI run multiple tests in different build directories as the same user. Since #3290 this means that the tests use the same temporary directory, and the cleanup_test may remove tests from other runs. This adds an environment variable KUZU_TEST_TMP_DIR which can be used to configure the temp directory, and uses it to create job-specific test directories on the runner machines --- .github/workflows/ci-workflow.yml | 10 +++++++++- test/include/test_helper/test_helper.h | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index ff5112859de..d98ecbae6db 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -237,6 +237,8 @@ jobs: - name: Test shell: cmd + env: + KUZU_TEST_TEMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }} run: | call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" make test @@ -370,7 +372,7 @@ jobs: steps: - uses: actions/checkout@v3 - + # For `napi.h` header. - name: Ensure Node.js dependencies run: npm install --include=dev @@ -417,6 +419,8 @@ jobs: run: make all - name: Test + env: + KUZU_TEST_TEMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }} run: | ulimit -n 10240 make test @@ -538,6 +542,8 @@ jobs: cat postgres_scanner.test - name: Extension test + env: + KUZU_TEST_TEMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }} run: | cd scripts/ && python3 http-server.py & make extension-test && make clean @@ -575,6 +581,8 @@ jobs: - name: Extension test shell: cmd + env: + KUZU_TEST_TEMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }} run: | call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" cd scripts/ && start /b python http-server.py && cd .. diff --git a/test/include/test_helper/test_helper.h b/test/include/test_helper/test_helper.h index c0fadd1bd30..111941ad009 100644 --- a/test/include/test_helper/test_helper.h +++ b/test/include/test_helper/test_helper.h @@ -50,7 +50,12 @@ class TestHelper { static std::string getMillisecondsSuffix(); inline static std::filesystem::path getTempDir() { - return std::filesystem::temp_directory_path() / "kuzu"; + auto tempDir = std::getenv("KUZU_TEST_TEMP_DIR"); + if (tempDir != nullptr) { + return std::filesystem::path(tempDir); + } else { + return std::filesystem::temp_directory_path() / "kuzu"; + } } inline static std::string getTempDir(const std::string& name) {