summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-01-21 16:41:54 -0500
committerGitHub <noreply@github.com>2019-01-21 16:41:54 -0500
commitbd815f02d846a50e16dab67e6512db2a6215c41f (patch)
tree01e391757bdb8f2d15bdc010227d522bddac3936 /tools
parent0a3ef7b4ae02983ea3f986ba8211e7c6af9d254b (diff)
Feature/file unique identity (#789)
* * Fix memory bug around expanding va_args - needed buffer to have space for terminating 0 * Fix problem with FileWriter defaults being globals, as memory they allocate, will only be freed after return from main - work around by making StdWriters RefObject derived, and kept in scope such the writers are destroyed before checks for leaks is found * Added SimplifyPathAndHash mode for CacheFileSystem - will simplify the path and see if simplified path is in cache before reading file (limiting amout of underlying file requests) * * Added calcReplaceChar * Renamed DefaultFileSystem to OSFileSystem * Made OSFileSystem convert windows \ to / on linux * Simplified logic for caching in CacheFileSystem. * Added pragma-once-c to add extra test, but also so there is an 'include' directory in preprocessor tests. * Small fixes in pragma once test. * Simplified cache handling path, so that paths/simplified paths area always added. * Improve naming of methods for different caches. * Removed references to 'canonicalPath' and made 'uniqueIdentity' * * Re-add support for canonicalPath to ISlangFileSystem -> not for uniqueIdentifier but as a way to display 'canonicalPath' * Added peliminary support for being able to display verbose paths in a diagnostic * Added 'clearCache' support * Added verbose path support to SourceManager (now needs a ISlangFileSystemExt to do this) * Added support for '-verbose-path' option to slangc and slang-test.
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/options.cpp4
-rw-r--r--tools/slang-test/options.h3
-rw-r--r--tools/slang-test/slang-test-main.cpp28
3 files changed, 27 insertions, 8 deletions
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp
index 0a6023733..70b7a4533 100644
--- a/tools/slang-test/options.cpp
+++ b/tools/slang-test/options.cpp
@@ -134,6 +134,10 @@ static bool _isSubCommand(const char* arg)
{
optionsOut->shouldBeVerbose = true;
}
+ else if (strcmp(arg, "-verbose-paths") == 0)
+ {
+ optionsOut->verbosePaths = true;
+ }
else if (strcmp(arg, "-generate-hlsl-baselines") == 0)
{
optionsOut->generateHLSLBaselines = true;
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
index 4858ffd03..77460e190 100644
--- a/tools/slang-test/options.h
+++ b/tools/slang-test/options.h
@@ -49,6 +49,9 @@ struct Options
// generate extra output (notably: command lines we run)
bool shouldBeVerbose = false;
+ // Use verbose paths
+ bool verbosePaths = false;
+
// force generation of baselines for HLSL tests
bool generateHLSLBaselines = false;
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index d0da4fc61..cbd2974da 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -519,6 +519,15 @@ String findExpectedPath(const TestInput& input, const char* postFix)
return "";
}
+static void _initSlangCompiler(TestContext* context, OSProcessSpawner& spawnerOut)
+{
+ spawnerOut.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
+
+ if (context->options.verbosePaths)
+ {
+ spawnerOut.pushArgument("-verbose-paths");
+ }
+}
TestResult runSimpleTest(TestContext* context, TestInput& input)
{
@@ -528,8 +537,8 @@ TestResult runSimpleTest(TestContext* context, TestInput& input)
auto outputStem = input.outputStem;
OSProcessSpawner spawner;
+ _initSlangCompiler(context, spawner);
- spawner.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
spawner.pushArgument(filePath999);
for( auto arg : input.testOptions->args )
@@ -699,6 +708,8 @@ static SlangCompileTarget _getCompileTarget(const UnownedStringSlice& name)
return SLANG_TARGET_UNKNOWN;
}
+
+
TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
{
// need to execute the stand-alone Slang compiler on the file
@@ -710,11 +721,11 @@ TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
OSProcessSpawner actualSpawner;
OSProcessSpawner expectedSpawner;
- actualSpawner.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
- expectedSpawner.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
-
+ _initSlangCompiler(context, actualSpawner);
+ _initSlangCompiler(context, expectedSpawner);
+
actualSpawner.pushArgument(filePath);
-
+
const auto& args = input.testOptions->args;
const UInt targetIndex = args.IndexOf("-target");
@@ -821,7 +832,8 @@ TestResult generateHLSLBaseline(TestContext* context, TestInput& input)
auto outputStem = input.outputStem;
OSProcessSpawner spawner;
- spawner.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
+ _initSlangCompiler(context, spawner);
+
spawner.pushArgument(filePath999);
for( auto arg : input.testOptions->args )
@@ -866,8 +878,8 @@ TestResult runHLSLComparisonTest(TestContext* context, TestInput& input)
// need to execute the stand-alone Slang compiler on the file, and compare its output to what we expect
OSProcessSpawner spawner;
+ _initSlangCompiler(context, spawner);
- spawner.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
spawner.pushArgument(filePath999);
for( auto arg : input.testOptions->args )
@@ -967,8 +979,8 @@ TestResult doGLSLComparisonTestRun(TestContext* context,
auto outputStem = input.outputStem;
OSProcessSpawner spawner;
+ _initSlangCompiler(context, spawner);
- spawner.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
spawner.pushArgument(filePath999);
if( langDefine )