summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2024-08-26 13:54:10 -0500
committerGitHub <noreply@github.com>2024-08-26 11:54:10 -0700
commit76999788902a8c50e8e5d0e867763e5ea2f10042 (patch)
tree3c1e3375504df9995e7b4c040e2a0d467c898384 /source
parentb2ca2d5a4efeae807d3c3f48f60235e47413b559 (diff)
Feature/record unit test (#4910)
* Fix the slang-test bug Since we reorganize the build directory, now the libraries are located at different directory with executables in non-Windows platform, we have to change the code on how to find the dll directory. * Integrate the record/replay test into slang-unit-test We create a unit-test-record-replay.cpp to run the converted slang examples in child process as our tests for the record-replay layer. * Disable the test on Apple Due to the limitation of current examples, we temporarily disable them on apples. Change the ci to make this test only be run on the gpu-equipped runners, for other runners we add a white-list file "expected-failure-record-replay-tests.txt". * Remove 'hello-world' example from unit test "hello-world" doesn't use gfx abstract library, instead it uses vk directly, it's not a preferable way. So we will drop this test, instead, we will use cpu-hello-world example.
Diffstat (limited to 'source')
-rw-r--r--source/core/slang-test-tool-util.cpp18
-rw-r--r--source/core/slang-test-tool-util.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/source/core/slang-test-tool-util.cpp b/source/core/slang-test-tool-util.cpp
index dad06effe..9a0ebe4f1 100644
--- a/source/core/slang-test-tool-util.cpp
+++ b/source/core/slang-test-tool-util.cpp
@@ -107,6 +107,24 @@ static SlangResult _addCUDAPrelude(const String& rootPath, slang::IGlobalSession
return SLANG_OK;
}
+/* static */SlangResult TestToolUtil::getDllDirectoryPath(const char* exePath, String& outDllDirectoryPath)
+{
+ String canonicalPath;
+ SLANG_RETURN_ON_FAIL(Path::getCanonical(exePath, canonicalPath));
+
+ // Get the directory
+ String binPath = Path::getParentDirectory(canonicalPath);
+
+ // Windows puts the dlls in the same directory as the exe, while on other platforms they are in a 'lib' directory
+#ifdef _WIN32
+ outDllDirectoryPath = binPath;
+#else
+ String binaryRootPath = Path::getParentDirectory(binPath);
+ outDllDirectoryPath = Path::combine(binaryRootPath, "lib");
+#endif
+ return SLANG_OK;
+}
+
/* static */SlangResult TestToolUtil::getRootPath(const char* inExePath, String& outExePath)
{
// Get the directory holding the exe
diff --git a/source/core/slang-test-tool-util.h b/source/core/slang-test-tool-util.h
index 1e56500d2..03f3b768e 100644
--- a/source/core/slang-test-tool-util.h
+++ b/source/core/slang-test-tool-util.h
@@ -66,6 +66,8 @@ struct TestToolUtil
/// Returns true if the StdLib should not be initialized immediately (eg when doing a -load-stdlib).
static bool hasDeferredStdLib(Index numArgs, const char*const* args);
+
+ static SlangResult getDllDirectoryPath(const char* exePath, String& outDllDirectoryPath);
};
} // namespace Slang