diff options
Diffstat (limited to 'tools/slang-test')
| -rw-r--r-- | tools/slang-test/options.cpp | 10 | ||||
| -rw-r--r-- | tools/slang-test/options.h | 3 | ||||
| -rw-r--r-- | tools/slang-test/slang-test-main.cpp | 23 | ||||
| -rw-r--r-- | tools/slang-test/test-context.cpp | 6 | ||||
| -rw-r--r-- | tools/slang-test/test-context.h | 4 |
5 files changed, 15 insertions, 31 deletions
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index eee099965..27b759a0e 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -266,16 +266,6 @@ static bool _isSubCommand(const char* arg) return res; } } - else if (strcmp(arg, "-nvapi-path") == 0) - { - if (argCursor == argEnd) - { - stdError.print("error: expected operand for '%s'\n", arg); - return SLANG_FAIL; - } - - optionsOut->nvapiPath = *argCursor++; - } else { stdError.print("unknown option '%s'\n", arg); diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h index 220293ba0..a8c2e3852 100644 --- a/tools/slang-test/options.h +++ b/tools/slang-test/options.h @@ -98,9 +98,6 @@ struct Options // The adapter to use. If empty will match first found adapter. Slang::String adapter; - // The path to NVAPI if available. - Slang::String nvapiPath; - /// Parse the args, report any errors into stdError, and write the results into optionsOut static SlangResult parse(int argc, char** argv, TestCategorySet* categorySet, Slang::WriterHelper stdError, Options* optionsOut); }; diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 1144b4034..b2e2bb55c 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -495,6 +495,7 @@ Result spawnAndWaitSharedLibrary(TestContext* context, const String& testPath, c if (options.shouldBeVerbose) { CommandLine testCmdLine; + testCmdLine.setExecutableFilename("slang-test"); if (options.binDir.getLength()) @@ -531,8 +532,10 @@ Result spawnAndWaitSharedLibrary(TestContext* context, const String& testPath, c stdWriters.setWriter(SLANG_WRITER_CHANNEL_DIAGNOSTIC, &stdError); } + String exePath = Path::combine(context->exeDirectoryPath, exeName); + List<const char*> args; - args.add(exeName.getBuffer()); + args.add(exePath.getBuffer()); for (Index i = 0; i < cmdLine.m_args.getCount(); ++i) { args.add(cmdLine.m_args[i].value.getBuffer()); @@ -3191,7 +3194,7 @@ SlangResult innerMain(int argc, char** argv) // The context holds useful things used during testing TestContext context; - SLANG_RETURN_ON_FAIL(SLANG_FAILED(context.init())) + SLANG_RETURN_ON_FAIL(SLANG_FAILED(context.init(argv[0]))) auto& categorySet = context.categorySet; @@ -3272,19 +3275,9 @@ SlangResult innerMain(int argc, char** argv) Options& options = context.options; - // Set up the prelude - { - TestToolUtil::PreludeInfo info; - info.exePath = argv[0]; - - if (options.nvapiPath.getLength()) - { - info.nvapiPath = options.nvapiPath.getBuffer(); - } - - TestToolUtil::setSessionDefaultPrelude(info, context.getSession()); - } - + // Set up the prelude/s + TestToolUtil::setSessionDefaultPreludeFromExePath(argv[0], context.getSession()); + if (options.outputMode == TestOutputMode::TeamCity) { // On TeamCity CI there is an issue with unix/linux targets where test system may be different from the build system diff --git a/tools/slang-test/test-context.cpp b/tools/slang-test/test-context.cpp index 8fa5cb345..2872ddb47 100644 --- a/tools/slang-test/test-context.cpp +++ b/tools/slang-test/test-context.cpp @@ -5,6 +5,8 @@ #include "../../source/core/slang-string-util.h" #include "../../source/core/slang-shared-library.h" +#include "../../source/core/slang-test-tool-util.h" + #include <stdio.h> #include <stdlib.h> @@ -15,14 +17,14 @@ TestContext::TestContext() m_session = nullptr; } -Result TestContext::init() +Result TestContext::init(const char* exePath) { m_session = spCreateSession(nullptr); if (!m_session) { return SLANG_FAIL; } - + SLANG_RETURN_ON_FAIL(TestToolUtil::getExeDirectoryPath(exePath, exeDirectoryPath)); return SLANG_OK; } diff --git a/tools/slang-test/test-context.h b/tools/slang-test/test-context.h index ab0a00b40..46a42f3fa 100644 --- a/tools/slang-test/test-context.h +++ b/tools/slang-test/test-context.h @@ -83,7 +83,7 @@ class TestContext /// Get the slang session SlangSession* getSession() const { return m_session; } - SlangResult init(); + SlangResult init(const char* exePath); /// Get the inner main function (from shared library) InnerMainFunc getInnerMainFunc(const Slang::String& dirPath, const Slang::String& name); @@ -126,6 +126,8 @@ class TestContext Slang::RefPtr<Slang::DownstreamCompilerSet> compilerSet; + Slang::String exeDirectoryPath; + protected: struct SharedLibraryTool { |
