summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-04-23 17:19:20 -0400
committerGitHub <noreply@github.com>2019-04-23 17:19:20 -0400
commit9cb75371f5ea45640ae0e3998eb27bcda0a22cd9 (patch)
tree8e4c18099888d88860c54c0a23c5fe345f3fd4b7 /tools
parent7a71b86aadda83d16dadf809be137c7551f31464 (diff)
Feature/premake build (#951)
* * Remove Makefile * Document how to create build using premake5 * Added support for finding the executable path * If binDir not set on command line use the executable path * Fix getting exe path on linux. * Removed CalcExecutablePath from Path:: interface, made implementation internal. * Documentation improvements. * Fixes based on review * Fix some typos * Removed unused/needed global
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/options.cpp10
-rw-r--r--tools/slang-test/options.h6
-rw-r--r--tools/slang-test/slang-test-main.cpp14
3 files changed, 20 insertions, 10 deletions
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp
index 2b9ec6c06..693d1939c 100644
--- a/tools/slang-test/options.cpp
+++ b/tools/slang-test/options.cpp
@@ -291,5 +291,15 @@ static bool _isSubCommand(const char* arg)
return SLANG_FAIL;
}
+ if (optionsOut->binDir.Length() == 0)
+ {
+ // If the binDir isn't set try using the path to the executable
+ String exePath = Path::GetExecutablePath();
+ if (exePath.Length())
+ {
+ optionsOut->binDir = Path::GetDirectoryName(exePath);
+ }
+ }
+
return SLANG_OK;
}
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
index 72dc66035..48c06463c 100644
--- a/tools/slang-test/options.h
+++ b/tools/slang-test/options.h
@@ -23,7 +23,7 @@ struct TestCategorySet
{
public:
/// Find a category with the specified name. Returns nullptr if not found
- TestCategory * find(Slang::String const& name);
+ TestCategory* find(Slang::String const& name);
/// Adds a category with the specified name, and parent. Returns the category object.
/// Parent can be nullptr
TestCategory* add(Slang::String const& name, TestCategory* parent);
@@ -40,8 +40,8 @@ struct Options
{
char const* appName = "slang-test";
- // Directory to use when looking for binaries to run
- char const* binDir = "";
+ // Directory to use when looking for binaries to run. If empty it's not set.
+ Slang::String binDir;
// only run test cases with names that have this prefix.
char const* testPrefix = nullptr;
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index e475d4b5a..232ec5d53 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -413,7 +413,7 @@ OSError spawnAndWaitSharedLibrary(TestContext* context, const String& testPath,
builder << "slang-test";
- if (options.binDir)
+ if (options.binDir.Length())
{
builder << " -bindir " << options.binDir;
}
@@ -430,7 +430,7 @@ OSError spawnAndWaitSharedLibrary(TestContext* context, const String& testPath,
context->reporter->messageFormat(TestMessageType::Info, "%s\n", builder.begin());
}
- auto func = context->getInnerMainFunc(String(context->options.binDir), exeName);
+ auto func = context->getInnerMainFunc(context->options.binDir, exeName);
if (func)
{
StringBuilder stdErrorString;
@@ -765,7 +765,7 @@ static RenderApiFlags _getAvailableRenderApiFlags(TestContext* context)
{
// Try starting up the device
OSProcessSpawner spawner;
- spawner.pushExecutablePath(String(context->options.binDir) + "render-test" + osGetExecutableSuffix());
+ spawner.pushExecutablePath(Path::Combine(context->options.binDir, String("render-test") + osGetExecutableSuffix()));
_addRenderTestOptions(context->options, spawner);
// We just want to see if the device can be started up
spawner.pushArgument("-only-startup");
@@ -895,7 +895,7 @@ String findExpectedPath(const TestInput& input, const char* postFix)
static void _initSlangCompiler(TestContext* context, OSProcessSpawner& spawnerOut)
{
- spawnerOut.pushExecutablePath(String(context->options.binDir) + "slangc" + osGetExecutableSuffix());
+ spawnerOut.pushExecutablePath(Path::Combine(context->options.binDir, String("slangc") + osGetExecutableSuffix()));
if (context->options.verbosePaths)
{
@@ -1007,7 +1007,7 @@ TestResult runReflectionTest(TestContext* context, TestInput& input)
OSProcessSpawner spawner;
- spawner.pushExecutablePath(String(options.binDir) + "slang-reflection-test" + osGetExecutableSuffix());
+ spawner.pushExecutablePath(Path::Combine(options.binDir, String("slang-reflection-test") + osGetExecutableSuffix()));
spawner.pushArgument(filePath);
for( auto arg : input.testOptions->args )
@@ -1471,7 +1471,7 @@ TestResult runComputeComparisonImpl(TestContext* context, TestInput& input, cons
OSProcessSpawner spawner;
- spawner.pushExecutablePath(String(context->options.binDir) + "render-test" + osGetExecutableSuffix());
+ spawner.pushExecutablePath(Path::Combine(context->options.binDir, String("render-test") + osGetExecutableSuffix()));
spawner.pushArgument(filePath999);
_addRenderTestOptions(context->options, spawner);
@@ -1589,7 +1589,7 @@ TestResult doRenderComparisonTestRun(TestContext* context, TestInput& input, cha
OSProcessSpawner spawner;
- spawner.pushExecutablePath(String(context->options.binDir) + "render-test" + osGetExecutableSuffix());
+ spawner.pushExecutablePath(Path::Combine(context->options.binDir, String("render-test") + osGetExecutableSuffix()));
spawner.pushArgument(filePath);
_addRenderTestOptions(context->options, spawner);