From af70651a4843b16dd24e14b5cedffe399ebeb862 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sat, 20 Aug 2022 01:03:06 -0700 Subject: Call `gfx` in slang program. (#2370) --- tools/slang-test/slang-test-main.cpp | 7 ++++++- tools/slang-test/slangc-tool.cpp | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'tools/slang-test') 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 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) { -- cgit v1.2.3