Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Mar 31, 2015
  1. @nico

    Let Stat() have an err outparam instead of writing to stderr.

    nico authored
    Also check for Stat() failure in a few more places.
    This way, ninja doesn't print two "ninja: error: " lines if stat() fails
    during a build.  It also makes it easier to keep the stat tests quiet.
    Every caller of Stat() needs to explicitly log the error string if
    that's desired.
Commits on Mar 19, 2015
  1. @nico

    Another crash fix for duplicate edges. Fixes #939.

    nico authored
    Patch #933 fixed a crash with duplicate edges by not adding edges to the
    graph if all the edge's outputs are already built by other edges.
    However, it added the edge to the out_edges of the edge's input nodes
    before deleting it, letting inputs refer to dead edges.
    To fix, move the check for deleting an edge above the code that adds
    inputs.  Expand VerifyGraph() to check that nodes don't refer to edges
    that aren't present in the state.
Commits on Mar 15, 2015
  1. @nico

    Build self-consistent graphs for dupe edges with multiple outputs.

    nico authored
    Fixes #867, both the crashes and "[stuck]" issues.
    The problem was that a duplicate edge would modify the in_edge of the
    outputs of the new build rule, but the edge corresponding to the old
    build rule would still think that the in_edge points to itself.
    `old_edge->outputs_[0]->in_edge()` would not return `old_edge`, which
    confused the scan logic.
    As fix, let `State::AddOut()` reject changing in_edge if it's already
    set.  This changes behavior in a minor way: Previously, if there were
    multiple edges for a single output, the last edge would be kept.  Now,
    the first edge is kept.  This only had mostly-well-defined semantics if
    all duplicate edges are the same (which is the only case I've seen in
    practice), and for that case the behavior doesn't change.
    For testing, add a VerifyGraph() function and call that every time any
    test graph is parsed.  That's a bit more code than just copying the test
    cases from the bug into, but it also yields better test
    coverage overall.
Commits on Nov 10, 2014
  1. @sgraham
Commits on Sep 18, 2014
  1. @nico

    Fix building tests on Windows again.

    nico authored
    Turns out gtest was pulling in sys/stat.h, and we were
    using stat() through that in tests. This doesn't work
    with old MSVCs, so we should probably replace that with
    RealDiskInterface in a follow-up.
  2. @nico

    Use a small, standalone testing framework instead of googletest.

    nico authored
    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 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/ (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%.
    If this turns out to be annoying, we can maybe add it.
Commits on Jun 19, 2014
  1. @nico

    make Stat() a const method

    nico authored
Commits on Apr 9, 2013
  1. add a test for the "deps out of date" case

    It touched the various remaining XXXes in the code, hooray.
Commits on Apr 8, 2013
  1. move test virtual time "now_" into VirtualFileSystem

    It's the only piece that cares about the current time.
Commits on Jul 9, 2012
  1. @tfarina

    Rename parsers.* to manifest_parser.*

    tfarina authored
    So it matches with the class name in there.
    Signed-off-by: Thiago Farina <>
Commits on Jun 15, 2012
  1. @nico

    Only store command hashes in the build log.

    nico authored
    .build_log load time 350ms -> 17ms, filesize 197MB -> 1.6MB on
    Mac. On Windows, it's 500ms -> 20ms.
    Makes the build log a lot less useful for scripts, but there could
    be a tool for use cases that need log information. A prototype of
    such a tool is in nico@1b243d3
    The hash function is 64bit murmurhash2. Assuming that that different
    commands get the same hash only by chance, it's is very unlikely
    for two different commands to hash to the same value with a 64bit
Commits on Feb 9, 2012
  1. Response files

    unknown authored
Commits on Jan 22, 2012
  1. windows: use _WIN32 define everywhere

    Rather than mixing use of WIN32 and _WIN32.
Commits on Jan 11, 2012
  1. @doctorlove

    GetTempPath() needs windows.h

    doctorlove authored committed
Commits on Jan 6, 2012
Commits on Jan 5, 2012
Commits on Jan 3, 2012
  1. @doctorlove
Commits on Dec 29, 2011
  1. switch the core ninja parser to use re2c for the lexer

    - Delete the old "Tokenizer" code.
    - Write separate tests for the lexer distinct from the parser.
    - Switch the parser to use the new code.
    - New lexer error output has file:line numbers so e.g. Emacs can
      jump your editor to the syntax error.
    - The EvalEnv ($-interpolation) code is now part of the lexer as well.
Commits on Dec 5, 2011
  1. disable the 'unused parameter' warning

    It was firing too often, and hadn't uncovered any bugs.
Commits on Nov 21, 2011
  1. @nicolasdespres
Commits on May 2, 2011
  1. @nicolasdespres

    Return non-zero status when errors occur.

    nicolasdespres authored
    Clean all was not returning non-zero when an error occur (like when
    failing to remove a directory). This patch fix the problem and add a test
    for it.
  2. @nicolasdespres

    Add a test for the clean tool.

    nicolasdespres authored
    It also fix a bug about the count of removed file reported.
Commits on Mar 6, 2011
  1. move test support into test.*

Something went wrong with that request. Please try again.