summaryrefslogtreecommitdiff
path: root/tools/slang-test
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-20 01:03:06 -0700
committerGitHub <noreply@github.com>2022-08-20 01:03:06 -0700
commitaf70651a4843b16dd24e14b5cedffe399ebeb862 (patch)
treea6aefd5db94a048114b9a8d7ed3f826533105fab /tools/slang-test
parent6412c4913b6a063438bb11863f2c154d3ae42dfe (diff)
Call `gfx` in slang program. (#2370)
Diffstat (limited to 'tools/slang-test')
-rw-r--r--tools/slang-test/slang-test-main.cpp7
-rw-r--r--tools/slang-test/slangc-tool.cpp4
2 files changed, 10 insertions, 1 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index ec4db492a..8e6e6f3e1 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -1409,7 +1409,12 @@ TestResult runExecutableTest(TestContext* context, TestInput& input)
}
}
ExecuteResult exeRes;
- TEST_RETURN_ON_DONE(spawnAndWait(context, outputStem, input.spawnType, cmdLine, exeRes));
+
+ // TODO(Yong) HACK:
+ // Just use shared library now, TestServer spawn mode seems to cause slangc to fail to find its own
+ // executable path, and thus failed to find the `gfx.slang` file sitting along side `slangc.exe`.
+ // We need to figure out what happened to `Path::getExecutablePath()` inside test-server.
+ TEST_RETURN_ON_DONE(spawnAndWait(context, outputStem, SpawnType::UseSharedLibrary, cmdLine, exeRes));
String actualOutput;
diff --git a/tools/slang-test/slangc-tool.cpp b/tools/slang-test/slangc-tool.cpp
index 25b973421..e538cde09 100644
--- a/tools/slang-test/slangc-tool.cpp
+++ b/tools/slang-test/slangc-tool.cpp
@@ -3,6 +3,7 @@
#include "../../source/core/slang-exception.h"
#include "../../source/core/slang-test-tool-util.h"
+#include "../../source/core/slang-io.h"
using namespace Slang;
@@ -31,6 +32,9 @@ SlangResult SlangCTool::innerMain(StdWriters* stdWriters, slang::IGlobalSession*
ComPtr<slang::ICompileRequest> compileRequest;
SLANG_RETURN_ON_FAIL(session->createCompileRequest(compileRequest.writeRef()));
+ auto compilerExecutablePath = Path::getParentDirectory(Path::getExecutablePath());
+ compileRequest->addSearchPath(compilerExecutablePath.getBuffer());
+
// Do any app specific configuration
for (int i = 0; i < SLANG_WRITER_CHANNEL_COUNT_OF; ++i)
{