Use a small, standalone testing framework for ninja instead of googletest.

@martine I'd be interested what you think about this. It's more RFC than pull request (motivated by me reading re2 source).

Ninja currently uses googletest for testing. That makes building ninja_test somewhat annoying since it requires that one passes `--with-gtest PATH` to configure. It turns out just implementing the bits of googletest that ninja uses needs about the same amount of code than making the `--with-gtest` flag in configure.py work and making googletest print test results in a way we want (!)

In addition to making configuration simpler, this also makes compiling tests much faster: On my system, touching src/build_test.cc (the slowest file to build in ninja) and rebuilding ninja_tests is twice as fast than without this patch. Building `all` is noticeably faster too: 5.6s with this patch, 9.1s without this patch (38% faster).

The most noticeable things missing: EXPECT_* and ASSERT_* don't support streaming notes to them with operator<<, and for failing tests the lhs and rhs are not printed. That's so that this header does not have to include sstream, which slows down building ninja_test almost 20%. It could be added with just a handful lines if this turns out to be very annoying, though.
|tests| could be the head of a list instead?

+1 for removing the gtest dependency

(I think I'd miss lhs/rhs printing in chrome due to general difficulty of
reproducing all the build configs, but if you don't miss it here, it seems
like not a big deal)
On Sep 14, 2014 8:25 PM, "Nico Weber" <notifications@github.com> wrote:

> In src/ninja_test.cc:
>
> >  #include "line_printer.h"
> >
> > +static testing::Test* (*tests[10000])();
>
> I think that doesn't work well because initialization order is undefined
> and tests are registered by static initializers – so it's not clear that
> the vector is initialized before all the tests register themselves :-/
>
> (I read your comment, thought "of course!", made that change, and then
> wondered why only 21 tests ran after the change.)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/martine/ninja/pull/812/files#r17525600>.
>