summaryrefslogtreecommitdiff
path: root/tools/slang-test/options.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-12-14 15:24:21 -0500
committerGitHub <noreply@github.com>2018-12-14 15:24:21 -0500
commitd43c566fa29bbc0da1534aea236d54ee5ca104b8 (patch)
tree5a1878687364d28361a2c6aa722c5c8d9c75810e /tools/slang-test/options.h
parentec745c032a8dc16c3e689458c20541a4e7aa64d6 (diff)
Fix memory leaks around slang-test (#757)
* Remove circular reference to renderer on Vk & D3D12 DescriptorSetImpl * Refactor Stbi image loading such that memory is correctly freed when goes out of scope. Added Crt memory dump at termination. Reduced erroneous reporting by scoping TestContext. * Used capitalized acronym for STBImage to keep Tim happy. * Split out TestReporter - to just handle reporting test results Split out Options Made TestContext hold options, and the reporter Removed remaining memory leaks. * Small optimization for rawWrite, such that it directly writes over print.. * Improve comments on TestCategorySet * Fix typos in TestCategorySet
Diffstat (limited to 'tools/slang-test/options.h')
-rw-r--r--tools/slang-test/options.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
new file mode 100644
index 000000000..ccbd9aede
--- /dev/null
+++ b/tools/slang-test/options.h
@@ -0,0 +1,83 @@
+// options.h
+
+#ifndef OPTIONS_H_INCLUDED
+#define OPTIONS_H_INCLUDED
+
+#include "../../source/core/dictionary.h"
+
+#include "test-reporter.h"
+#include "render-api-util.h"
+#include "../../source/core/smart-pointer.h"
+
+// A category that a test can be tagged with
+struct TestCategory: public Slang::RefObject
+{
+ // The name of the category, from the user perspective
+ Slang::String name;
+
+ // The logical "super-category" of this category
+ TestCategory* parent;
+};
+
+struct TestCategorySet
+{
+public:
+ /// Find a category with the specified name. Returns nullptr if not found
+ 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);
+ /// Finds a category by name, else reports and writes an error
+ TestCategory* findOrError(Slang::String const& name);
+
+ Slang::RefPtr<TestCategory> defaultCategory; ///< The default category
+
+protected:
+ Slang::Dictionary<Slang::String, Slang::RefPtr<TestCategory> > m_categoryMap;
+};
+
+struct Options
+{
+ char const* appName = "slang-test";
+
+ // Directory to use when looking for binaries to run
+ char const* binDir = "";
+
+ // only run test cases with names that have this prefix
+ char const* testPrefix = nullptr;
+
+ // generate extra output (notably: command lines we run)
+ bool shouldBeVerbose = false;
+
+ // force generation of baselines for HLSL tests
+ bool generateHLSLBaselines = false;
+
+ // Dump expected/actual output on failures, for debugging.
+ // This is especially intended for use in continuous
+ // integration builds.
+ bool dumpOutputOnFailure = false;
+
+ // If set, will force using of executables (not shared library) for tests
+ bool useExes = false;
+
+ // kind of output to generate
+ TestOutputMode outputMode = TestOutputMode::Default;
+
+ // Only run tests that match one of the given categories
+ Slang::Dictionary<TestCategory*, TestCategory*> includeCategories;
+
+ // Exclude test that match one these categories
+ Slang::Dictionary<TestCategory*, TestCategory*> excludeCategories;
+
+ // By default we can test against all apis
+ RenderApiFlags enabledApis = RenderApiFlag::AllOf;
+
+ // By default we potentially synthesize test for all
+ // TODO: Vulkan is disabled by default for now as the majority as vulkan synthesized tests fail
+ RenderApiFlags synthesizedTestApis = RenderApiFlag::AllOf & ~RenderApiFlag::Vulkan;
+
+ /// 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);
+};
+
+#endif // OPTIONS_H_INCLUDED