summaryrefslogtreecommitdiff
path: root/tools/slang-test/test-context.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-12-12 08:57:48 -0500
committerGitHub <noreply@github.com>2018-12-12 08:57:48 -0500
commit49ed6b60d662906f290578f802f80b0ead1a2b9d (patch)
treee47050f6508a4b3a4d38b756e9b3c53e0d159507 /tools/slang-test/test-context.h
parent62d3e387774255be4d507cca045ac97dabac9970 (diff)
Running tests in slang-test process (#740)
* First pass at having an interface to write text to that can be replaced. Simplifed and made more rigerous the interface used to write formatted strings. * Added AppContext to simplify setting up and parsing around of streams. * Added more simplified way to get the std error/out from AppContext. * Work in progress using dll for tools to speed up testing. * First pass at ISlangWriter interface. * Added support for writing VaArgs. Added NullWriter. * Use ISlangWriter for output. * Use ISlangWriter for output - replacing OutputCallback. Make IRDump go to ISlangWriter * SlangWriterTargetType -> SlangWriterChannel Improvements around AppContext * Shared library working with slang-reflection-test. * Dll testing working for render-test. * Include va_list definintion from header. * Fix errors from clang. * Fix typo for linux. * Added -usexes option * Fix typo. * Fix arguments problem on linux. * Fix typo for linux. * Add windows tool shared library projects. * Fix warning from x86 win build. Fix signed warning from slang-test/main.cpp * First attempt at getting premake to work on travis, and run tests. * Try moving build out into script. * Invoke bash scripts so they don't have to be executable. * Drive configuration/tests from env parameters set by travis * Try using source to run travis tests. * Remove the build.linux directory - but doing so will overwrite Makefile. * Made -fno-delete-null-pointer-checks gcc only. * Try to fix warning from -fno-delete-null-pointer-checks * Turn of warnings for unknown switches. * Try to make premake choose the correct tooling. * Disabled missing braces warning. * Disable -Wundefined-var-template on clang. * -Wunused-function disabled for clang. * Fix typo due to SlangBool. * Remove this nullptr tests. * "-Wno-unused-private-field" for clang. * Added "-Wno-undefined-bool-conversion" * Add DominatorList::end fix. * Split scripts into travis_build.sh travis_test.sh * Fix gcc/clang template pre-declaration issue around QualType. * Fix premake to build such that pthread correctly links with slang-glslang
Diffstat (limited to 'tools/slang-test/test-context.h')
-rw-r--r--tools/slang-test/test-context.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/slang-test/test-context.h b/tools/slang-test/test-context.h
index a81473efa..cf047cec7 100644
--- a/tools/slang-test/test-context.h
+++ b/tools/slang-test/test-context.h
@@ -1,6 +1,10 @@
// test-context.h
#include "../../source/core/slang-string-util.h"
+#include "../../source/core/platform.h"
+#include "../../source/core/slang-app-context.h"
+#include "../../source/core/dictionary.h"
+
#define SLANG_CHECK(x) TestContext::get()->addResultWithLocation((x), #x, __FILE__, __LINE__);
@@ -54,6 +58,7 @@ enum class TestMessageType
class TestContext
{
public:
+ typedef SlangResult(*InnerMainFunc)(Slang::AppContext* appContext, SlangSession* session, int argc, const char*const* argv);
struct TestInfo
{
@@ -124,6 +129,9 @@ class TestContext
/// Returns true if all run tests succeeded
bool didAllSucceed() const;
+ /// Get the InnerMain function from a shared library tool
+ InnerMainFunc getInnerMainFunc(const Slang::String& dirPath, const Slang::String& name);
+
/// Get the slang session
SlangSession* getSession() const { return m_session; }
@@ -134,7 +142,6 @@ class TestContext
/// Dtor
~TestContext();
-
static TestResult combine(TestResult a, TestResult b) { return (a > b) ? a : b; }
static TestContext* get() { return s_context; }
@@ -155,9 +162,17 @@ class TestContext
bool m_dumpOutputOnFailure;
bool m_isVerbose;
+ bool m_useExes;
+
void outputSummary();
protected:
+ struct SharedLibraryTool
+ {
+ Slang::SharedLibrary::Handle m_sharedLibrary;
+ InnerMainFunc m_func;
+ };
+
void _addResult(const TestInfo& info);
Slang::StringBuilder m_currentMessage;
@@ -168,7 +183,9 @@ protected:
bool m_inTest;
SlangSession* m_session;
-
+
+ Slang::Dictionary<Slang::String, SharedLibraryTool> m_sharedLibTools;
+
static TestContext* s_context;
};