summaryrefslogtreecommitdiffstats
path: root/tools/slang-test/test-context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/slang-test/test-context.cpp')
-rw-r--r--tools/slang-test/test-context.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/slang-test/test-context.cpp b/tools/slang-test/test-context.cpp
index 8d8c20adf..6c9c7f549 100644
--- a/tools/slang-test/test-context.cpp
+++ b/tools/slang-test/test-context.cpp
@@ -59,6 +59,26 @@ TestReporter* TestContext::getTestReporter()
return m_reporters[slangTestThreadIndex];
}
+SlangResult TestContext::locateFileCheck()
+{
+ DefaultSharedLibraryLoader* loader = DefaultSharedLibraryLoader::getSingleton();
+ ComPtr<ISlangSharedLibrary> library;
+ SLANG_RETURN_ON_FAIL(loader->loadSharedLibrary("slang-llvm", library.writeRef()));
+
+ if (!library)
+ {
+ return SLANG_FAIL;
+ }
+
+ using CreateFileCheckFunc = SlangResult (*)(const SlangUUID&, void**);
+ auto fn = reinterpret_cast<CreateFileCheckFunc>(library->findFuncByName("createLLVMFileCheck_V1"));
+ if(!fn)
+ {
+ return SLANG_FAIL;
+ }
+ return fn(SLANG_IID_PPV_ARGS(m_fileCheck.writeRef()));
+}
+
Result TestContext::init(const char* inExePath)
{
m_session = spCreateSession(nullptr);
@@ -68,6 +88,9 @@ Result TestContext::init(const char* inExePath)
}
exePath = inExePath;
SLANG_RETURN_ON_FAIL(TestToolUtil::getExeDirectoryPath(inExePath, exeDirectoryPath));
+
+ SLANG_RETURN_ON_FAIL(locateFileCheck());
+
return SLANG_OK;
}