Accept processor test seed from command line
Also adds support for uint32_t CLI flags, parsed as octal, hex, or dec.
Bug: skia:
Change-Id: I87112beb6506a65d6f541c7ca4cfb38641d55aa5
Reviewed-on: https://skia-review.googlesource.com/158040
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index cc35f90..6e241a2 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -221,6 +221,8 @@
#include "SkCommandLineFlags.h"
DEFINE_bool(randomProcessorTest, false, "Use non-deterministic seed for random processor tests?");
+DEFINE_uint32(processorSeed, 0, "Use specific seed for processor tests. Overridden by " \
+ "--randomProcessorTest.");
#if GR_TEST_UTILS
@@ -314,13 +316,13 @@
auto resourceProvider = context->contextPriv().resourceProvider();
using FPFactory = GrFragmentProcessorTestFactory;
- uint32_t seed = 0;
+ uint32_t seed = FLAGS_processorSeed;
if (FLAGS_randomProcessorTest) {
std::random_device rd;
seed = rd();
}
// If a non-deterministic bot fails this test, check the output to see what seed it used, then
- // hard-code that value here:
+ // use --processorSeed <seed> (without --randomProcessorTest) to reproduce.
SkRandom random(seed);
// Make the destination context for the test.