summaryrefslogtreecommitdiff
path: root/tools/slang-test/slang-test-main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2021-11-10 17:33:22 -0500
committerGitHub <noreply@github.com>2021-11-10 17:33:22 -0500
commit8a9e518371df03b3f382e0fe869da83751fdda0b (patch)
tree749f9c1c79acd375ec3ee97e45a10007dd6632fa /tools/slang-test/slang-test-main.cpp
parent95e82acc0b32c81a9c6ac39708d18a423d8c7b1e (diff)
Interprocess communication via pipes (#2009)
* #include an absolute path didn't work - because paths were taken to always be relative. * Use 'Process' to communicate with an command line tool. * Remove slang-win-stream * Tidy up windows ProcessUtil. * First version of BufferedReadStream. * Windows working IPC for steams. * Test proxy count option. * Split Process/ProcessUtil. Process is platform dependant. ProcessUtil are functions that are platform independent. * First implementation of Unix Process interface. * Unix process compiles on cygwin. * Fix typo in unix process. * Separate unix pipe stream error of invalid access, from pipe availability. * Fix in standard line extraction. * Make fd non blocking. * Fix issues with Windows Process streams. * Added UnixPipe. * Some fixes around UnixPipeStream. * Make a unix stream closed explicit. * Hack to debug linux process/stream. * Revert to old linux pipe handling. * Pass executable path for unit tests. Split out CommandLine into own source. * Small improvements in process/command line. * Check process behavior with crash. * Make stderr and stdout unbuffered for crash testing. * Only turn disable buffering in crash test. * Disable crash test on CI. * Fix crash on clang/linux. * Enable crash test. Remove _appendBuffer as can use StreamUtil functionality.
Diffstat (limited to 'tools/slang-test/slang-test-main.cpp')
-rw-r--r--tools/slang-test/slang-test-main.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index ea2c322ad..e007d1978 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -536,7 +536,7 @@ Result spawnAndWaitExe(TestContext* context, const String& testPath, const Comma
if (options.shouldBeVerbose)
{
- String commandLine = ProcessUtil::getCommandLineString(cmdLine);
+ String commandLine = cmdLine.toString();
context->reporter->messageFormat(TestMessageType::Info, "%s\n", commandLine.begin());
}
@@ -570,8 +570,7 @@ Result spawnAndWaitSharedLibrary(TestContext* context, const String& testPath, c
testCmdLine.addArg(exeName);
testCmdLine.m_args.addRange(cmdLine.m_args);
- String testCmdLineString = ProcessUtil::getCommandLineString(testCmdLine);
- context->reporter->messageFormat(TestMessageType::Info, "%s\n", testCmdLineString.getBuffer());
+ context->reporter->messageFormat(TestMessageType::Info, "%s\n", testCmdLine.toString().getBuffer());
}
auto func = context->getInnerMainFunc(context->options.binDir, exeName);
@@ -636,14 +635,12 @@ Result spawnAndWaitProxy(TestContext* context, const String& testPath, const Com
// Make the first arg the name of the tool to invoke
cmdLine.m_args.insert(0, exeName);
-
- auto exePath = Path::combine(Path::getParentDirectory(inCmdLine.m_executable), String("test-proxy") + ProcessUtil::getExecutableSuffix());
- cmdLine.setExecutablePath(exePath);
+ cmdLine.setExecutable(context->exeDirectoryPath, "test-proxy");
const auto& options = context->options;
if (options.shouldBeVerbose)
{
- String commandLine = ProcessUtil::getCommandLineString(cmdLine);
+ String commandLine = cmdLine.toString();
context->reporter->messageFormat(TestMessageType::Info, "%s\n", commandLine.begin());
}
@@ -942,7 +939,7 @@ static RenderApiFlags _getAvailableRenderApiFlags(TestContext* context)
}
// Try starting up the device
CommandLine cmdLine;
- cmdLine.setExecutablePath(Path::combine(context->options.binDir, String("render-test") + ProcessUtil::getExecutableSuffix()));
+ cmdLine.setExecutable(context->options.binDir, "render-test");
_addRenderTestOptions(context->options, cmdLine);
// We just want to see if the device can be started up
cmdLine.addArg("-only-startup");
@@ -1086,7 +1083,7 @@ String findExpectedPath(const TestInput& input, const char* postFix)
static void _initSlangCompiler(TestContext* context, CommandLine& ioCmdLine)
{
- ioCmdLine.setExecutablePath(Path::combine(context->options.binDir, String("slangc") + ProcessUtil::getExecutableSuffix()));
+ ioCmdLine.setExecutable(context->options.binDir, "slangc");
if (context->options.verbosePaths)
{
@@ -1123,7 +1120,7 @@ static SlangResult _executeBinary(const UnownedStringSlice& hexDump, ExecuteResu
String fileName;
SLANG_RETURN_ON_FAIL(File::generateTemporary(UnownedStringSlice("slang-test"), fileName));
- fileName.append(ProcessUtil::getExecutableSuffix());
+ fileName.append(Process::getExecutableSuffix());
TemporaryFileSet temporaryFileSet;
temporaryFileSet.add(fileName);
@@ -1535,7 +1532,7 @@ TestResult runReflectionTest(TestContext* context, TestInput& input)
CommandLine cmdLine;
- cmdLine.setExecutablePath(Path::combine(options.binDir, String("slang-reflection-test") + ProcessUtil::getExecutableSuffix()));
+ cmdLine.setExecutable(options.binDir, "slang-reflection-test");
cmdLine.addArg(filePath);
for( auto arg : input.testOptions->args )
@@ -1820,7 +1817,7 @@ static TestResult runCPPCompilerExecute(TestContext* context, TestInput& input)
{
StringBuilder moduleExePath;
moduleExePath << modulePath;
- moduleExePath << ProcessUtil::getExecutableSuffix();
+ moduleExePath << Process::getExecutableSuffix();
File::remove(moduleExePath);
}
@@ -1855,7 +1852,7 @@ static TestResult runCPPCompilerExecute(TestContext* context, TestInput& input)
CommandLine cmdLine;
StringBuilder exePath;
- exePath << modulePath << ProcessUtil::getExecutableSuffix();
+ exePath << modulePath << Process::getExecutableSuffix();
cmdLine.setExecutablePath(exePath);
@@ -2321,7 +2318,7 @@ TestResult runPerformanceProfile(TestContext* context, TestInput& input)
CommandLine cmdLine;
- cmdLine.setExecutablePath(Path::combine(context->options.binDir, String("render-test") + ProcessUtil::getExecutableSuffix()));
+ cmdLine.setExecutable(context->options.binDir, "render-test");
cmdLine.addArg(input.filePath);
cmdLine.addArg("-performance-profile");
@@ -2474,7 +2471,7 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
CommandLine cmdLine;
- cmdLine.setExecutablePath(Path::combine(context->options.binDir, String("render-test") + ProcessUtil::getExecutableSuffix()));
+ cmdLine.setExecutable(context->options.binDir, "render-test");
cmdLine.addArg(filePath999);
_addRenderTestOptions(context->options, cmdLine);
@@ -2582,7 +2579,7 @@ TestResult doRenderComparisonTestRun(TestContext* context, TestInput& input, cha
CommandLine cmdLine;
- cmdLine.setExecutablePath(Path::combine(context->options.binDir, String("render-test") + ProcessUtil::getExecutableSuffix()));
+ cmdLine.setExecutable(context->options.binDir, "render-test");
cmdLine.addArg(filePath);
_addRenderTestOptions(context->options, cmdLine);
@@ -3424,6 +3421,8 @@ static SlangResult runUnitTestModule(TestContext* context, TestOptions& testOpti
unitTestContext.slangGlobalSession = context->getSession();
unitTestContext.workDirectory = "";
unitTestContext.enabledApis = context->options.enabledApis;
+ unitTestContext.executableDirectory = context->exeDirectoryPath.getBuffer();
+
auto testCount = testModule->getTestCount();
for (SlangInt i = 0; i < testCount; i++)