summaryrefslogtreecommitdiffstats
path: root/src/test.cc
Commit message (Collapse)AuthorAgeFilesLines
* fix building ninja_test on AIX 6.1ky0ko2019-08-051-0/+9
|
* Factor ManifestParser options into a structureBrad King2017-09-071-2/+3
| | | | | | This will allow more options to be added without updating everywhere that constructs a ManifestParser. Also extend the AssertParse function to take the options so tests can control them.
* Add <stdlib.h> includes for clang++/libc++ on UbuntuDan Willemsen2016-04-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | There are a number of stdlib.h uses in these files without including stdlib.h: hash_collision_bench.cc: rand, RAND_MAX, srand manifest_parser_perftest.cc: system, exit ninja_test.cc: EXIT_SUCCESS, EXIT_FAILURE test.cc: getenv, mkdtemp, system This works on a Ubuntu g++/libstdc++ build, as the <algorithm> header pulls in stdlib.h, and on a OSX clang++/libc++ build the <map> and <string> headers pull in stdlib.h. But a Ubuntu clang++/libc++ build does not pull in stdlib.h with any of these other headers. $ apt-get install clang-3.6 libc++-dev $ CXX=clang++-3.6 CFLAGS=-stdlib=libc++ LDFLAGS=-stdlib=libc++ \ ./configure.py $ ninja ninja_test hash_collision_bench manifest_parser_perftest This was originally discovered using the host toolchain provided with Android, but the Ubuntu version is much easier to reproduce.
* Expose more details in FileReader::ReadFile signatureBrad King2016-02-031-4/+9
| | | | | | Return a status so callers can distinguish a missing file from an empty file. This allows our VirtualFileSystem test infrastructure to report as missing any file for which it has no entry.
* dupe_edge_should_err from bool to enumScott Graham2016-01-271-1/+1
|
* Make dupbuild=err work in subninjaScott Graham2016-01-271-1/+1
|
* Remove unnecessary `std::`Tetsuo Kiso2016-01-101-1/+1
|
* Let Stat() have an err outparam instead of writing to stderr.Nico Weber2015-03-311-2/+4
| | | | | | | | | 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.
* Another crash fix for duplicate edges. Fixes #939.Nico Weber2015-03-191-2/+14
| | | | | | | | | | | 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.
* Build self-consistent graphs for dupe edges with multiple outputs.Nico Weber2015-03-151-0/+22
| | | | | | | | | | | | | | | | | | | | | | 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 build_test.cc, but it also yields better test coverage overall.
* make all GetNode explicit, add DepsLog canonicalize testScott Graham2014-11-101-1/+2
|
* Fix building tests on Windows again.Nico Weber2014-09-181-5/+8
| | | | | | | 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.
* Use a small, standalone testing framework instead of googletest.Nico Weber2014-09-181-1/+3
| | | | | | | | | | | | | | | | | | | | | 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%. If this turns out to be annoying, we can maybe add it.
* make Stat() a const methodNico Weber2014-06-191-2/+2
|
* add a test for the "deps out of date" caseEvan Martin2013-04-091-1/+5
| | | | It touched the various remaining XXXes in the code, hooray.
* move test virtual time "now_" into VirtualFileSystemEvan Martin2013-04-081-3/+3
| | | | It's the only piece that cares about the current time.
* Rename parsers.* to manifest_parser.*Thiago Farina2012-07-091-1/+1
| | | | | | So it matches with the class name in there. Signed-off-by: Thiago Farina <tfarina@chromium.org>
* Only store command hashes in the build log.Nico Weber2012-06-151-0/+5
| | | | | | | | | | | | | | .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 https://github.com/nico/ninja/commit/1b243d311 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 hash.
* Response filesunknown2012-02-091-0/+6
|
* windows: use _WIN32 define everywhereEvan Martin2012-01-221-1/+1
| | | | Rather than mixing use of WIN32 and _WIN32.
* GetTempPath() needs windows.hFrances Buontempo2012-01-111-0/+4
|
* migrate tempdir code to test.ccEvan Martin2012-01-061-0/+91
|
* convert all time_t to a new TimeStamp typeEvan Martin2012-01-051-1/+1
|
* Include <algorithm> for std::find in test.ccFrances Buontempo2012-01-031-0/+2
|
* switch the core ninja parser to use re2c for the lexerEvan Martin2011-12-291-1/+1
| | | | | | | | | - 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.
* disable the 'unused parameter' warningEvan Martin2011-12-051-1/+1
| | | | It was firing too often, and hadn't uncovered any bugs.
* Fix compilation warning in Ninja's test suite.Nicolas Despres2011-11-211-1/+1
|
* Return non-zero status when errors occur.Nicolas Despres2011-05-021-3/+6
| | | | | | 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.
* Add a test for the clean tool.Nicolas Despres2011-05-021-0/+11
| | | | It also fix a bug about the count of removed file reported.
* move VirtualFileSystem into test.*Evan Martin2011-03-061-0/+26
|
* move test support into test.*Evan Martin2011-03-061-0/+34