ok, make tests really work

Here's how things work now:
    ~/skia (tests)> ninja -C out ok; and out/ok test
    ninja: Entering directory `out'
    [2/2] link ok
    112 ok../tests/TestConfigParsing.cpp:336
    configs[i]->getBackend().equals(expectedConfigs[i].backend)
    211 ok, 1 failed../tests/ShadowUtilsTest.cpp:25    Expected shadow
    tessellation to fail but it did not.
    ../tests/ShadowUtilsTest.cpp:30    Expected shadow tessellation to fail but it did not.
    ../tests/ShadowUtilsTest.cpp:36    Expected shadow tessellation to fail but it did not.
    ../tests/ShadowUtilsTest.cpp:42    Expected shadow tessellation to fail but it did not.
    637 ok, 2 failed

Change-Id: I84b108d4fabb538a2674831dd1ca64b149d7d265
Reviewed-on: https://skia-review.googlesource.com/10209
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-03-27 17:16:00 -04:00 committed by Skia Commit-Bot
parent 2084ffa9a3
commit 6105e4bf2d

View File

@ -10,22 +10,44 @@
struct TestStream : Stream {
const skiatest::TestRegistry* registry = skiatest::TestRegistry::Head();
bool extended = false, verbose = false;
static std::unique_ptr<Stream> Create(Options) {
static std::unique_ptr<Stream> Create(Options options) {
TestStream stream;
if (options("extended") != "") { stream.extended = true; }
if (options("verbose" ) != "") { stream.verbose = true; }
return move_unique(stream);
}
struct TestSrc : Src {
skiatest::Test test {"", false, nullptr};
bool extended, verbose;
std::string name() override { return test.name; }
SkISize size() override { return {0,0}; }
bool draw(SkCanvas*) override {
// TODO(mtklein): reporter, GrContext, return false on failure.
test.proc(nullptr, nullptr);
return true;
// TODO(mtklein): GrContext
struct : public skiatest::Reporter {
bool ok = true;
const char* name;
bool extended, verbose_;
void reportFailed(const skiatest::Failure& failure) override {
SkDebugf("%s: %s\n", name, failure.toString().c_str());
ok = false;
}
bool allowExtendedTest() const override { return extended; }
bool verbose() const override { return verbose_; }
} reporter;
reporter.name = test.name;
reporter.extended = extended;
reporter.verbose_ = verbose;
test.proc(&reporter, nullptr);
return reporter.ok;
}
};
@ -35,6 +57,8 @@ struct TestStream : Stream {
}
TestSrc src;
src.test = registry->factory();
src.extended = extended;
src.verbose = verbose;
registry = registry->next();
return move_unique(src);
}