tools/run-cts: Add --validate flag

Default to no-validation.

Change-Id: I4b3506e2addf580256175b13efbeb47f8ef96aaf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117881
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2023-01-26 16:03:08 +00:00 committed by Dawn LUCI CQ
parent 78e4530f59
commit 42c5b2f675
2 changed files with 10 additions and 5 deletions

View File

@ -95,9 +95,10 @@ namespace wgpu::binding {
// wgpu::bindings::GPU
////////////////////////////////////////////////////////////////////////////////
GPU::GPU(Flags flags) : flags_(std::move(flags)) {
// TODO(dawn:1123): Disable in 'release'
instance_.EnableBackendValidation(true);
instance_.SetBackendValidationLevel(dawn::native::BackendValidationLevel::Full);
if (auto validate = flags_.Get("validate"); validate == "1" || validate == "true") {
instance_.EnableBackendValidation(true);
instance_.SetBackendValidationLevel(dawn::native::BackendValidationLevel::Full);
}
// Setting the DllDir changes where we load adapter DLLs from (e.g. d3dcompiler_47.dll)
if (auto dir = flags_.Get("dlldir")) {

View File

@ -132,7 +132,7 @@ func run() error {
unrollConstEvalLoopsDefault := runtime.GOOS != "windows"
var dawnNode, cts, node, npx, resultsPath, expectationsPath, logFilename, backend, adapterName, coverageFile string
var verbose, isolated, build, dumpShaders, unrollConstEvalLoops, genCoverage bool
var verbose, isolated, build, validate, dumpShaders, unrollConstEvalLoops, genCoverage bool
var numRunners int
var flags dawnNodeFlags
flag.StringVar(&dawnNode, "dawn-node", "", "path to dawn.node module")
@ -142,8 +142,9 @@ func run() error {
flag.StringVar(&resultsPath, "output", "", "path to write test results file")
flag.StringVar(&expectationsPath, "expect", "", "path to expectations file")
flag.BoolVar(&verbose, "verbose", false, "print extra information while testing")
flag.BoolVar(&build, "build", true, "attempt to build the CTS before running")
flag.BoolVar(&isolated, "isolate", false, "run each test in an isolated process")
flag.BoolVar(&build, "build", true, "attempt to build the CTS before running")
flag.BoolVar(&validate, "validate", false, "enable backend validation")
flag.BoolVar(&colors, "colors", colors, "enable / disable colors")
flag.IntVar(&numRunners, "j", runtime.NumCPU()/2, "number of concurrent runners. 0 runs serially")
flag.StringVar(&logFilename, "log", "", "path to log file of tests run and result")
@ -217,6 +218,9 @@ func run() error {
if adapterName != "" {
flags.Set("adapter=" + adapterName)
}
if validate {
flags.Set("validate=1")
}
// While running the CTS, always allow unsafe APIs so they can be tested.
disableDawnFeaturesFound := false