forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptions.h
137 lines (103 loc) · 4.69 KB
/
options.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// options.h
#ifndef OPTIONS_H_INCLUDED
#define OPTIONS_H_INCLUDED
#include "../../source/core/slang-dictionary.h"
#include "../../source/core/slang-render-api-util.h"
#include "../../source/core/slang-smart-pointer.h"
#include "test-reporter.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;
};
enum class SpawnType
{
Default, ///< Default - typically uses shared library, on CI may use TestServer
UseExe, ///< Tests using executable (for example slangc)
UseSharedLibrary, ///< Runs testing in process (a crash tan take down the
UseTestServer, ///< Use the test server to isolate testing
UseFullyIsolatedTestServer, ///< Uses a test server for each test (slow!)
};
struct Options
{
char const* appName = "slang-test";
// Directory to use when looking for binaries to run. If empty it's not set.
Slang::String binDir;
// Root directory to use when looking for test cases
Slang::String testDir;
// only run test cases with names have one of these prefixes.
Slang::List<Slang::String> testPrefixes;
// generate extra output (notably: command lines we run)
bool shouldBeVerbose = false;
// When true results from ignored tests are not shown
bool hideIgnored = false;
// When true only tests that use an api that matches the enabledApis flags will run
bool apiOnly = false;
// Use verbose paths
bool verbosePaths = false;
// force generation of baselines for HLSL tests
bool generateHLSLBaselines = false;
// Whether to skip the step of creating test devices to check if an API is actually available.
bool skipApiDetection = false;
// Dump expected/actual output on failures, for debugging.
// This is especially intended for use in continuous
// integration builds.
bool dumpOutputOnFailure = false;
// Set the default spawn type to use
// Having tests isolated, slows down testing considerably, so using UseSharedLibrary is the most
// desirable default usually.
SpawnType defaultSpawnType = SpawnType::Default;
// 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. If is set to anything other than AllOf only tests
// that *require* the API will be run.
Slang::RenderApiFlags enabledApis = Slang::RenderApiFlag::AllOf;
// The subCommand to execute. Will be empty if there is no subCommand
Slang::String subCommand;
// Arguments to the sub command. Note that if there is a subCommand the first parameter is
// always the subCommand itself.
Slang::List<Slang::String> subCommandArgs;
// By default we potentially synthesize test for all
// TODO: Vulkan is disabled by default for now as the majority as vulkan synthesized tests
// CPU is disabled by default
// CUDA is disabled by default
Slang::RenderApiFlags synthesizedTestApis =
Slang::RenderApiFlag::AllOf & ~(Slang::RenderApiFlag::Vulkan | Slang::RenderApiFlag::CPU);
// The adapter to use. If empty will match first found adapter.
Slang::String adapter;
// If true, print detailed adapter information
bool showAdapterInfo = false;
// Maximum number of test servers to run.
int serverCount = 1;
bool emitSPIRVDirectly = true;
Slang::HashSet<Slang::String> expectedFailureList;
/// 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