summaryrefslogtreecommitdiffstats
path: root/src/disk_interface_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Fix stat when subdirectory is a file"Fredrik Medley2018-04-091-21/+0
| | | | | This reverts commit 6c864097ef11da366fb4070e6ab9f34d6a293766 and fixes the broken Appveyor builds on GitHub.
* Fix stat when subdirectory is a fileFredrik Medley2017-12-191-0/+21
| | | | | | Make sure that stat on Windows, both with and without cache, returns "missing file" when running stat on notadir/foo where notadir is a file.
* Fix disk_interface_test.cc on Windows for 64-bit timestampFredrik Medley2017-12-191-1/+10
| | | | | subdir/subsubdir/.. seems to get the time of subdir/subsubdir on NTFS (Windows 7), not the time of subdir.
* Refactor RecomputeDirty to take a node instead of an edgeBrad King2017-06-191-4/+4
| | | | | | All call sites have a node on which they call `in_edge()` to call RecomputeDirty. Simplify call sites by taking the node directly and calling `in_edge()` internally.
* Expose more details in FileReader::ReadFile signatureBrad King2016-02-031-5/+11
| | | | | | 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.
* Let Stat() have an err outparam instead of writing to stderr.Nico Weber2015-03-311-31/+62
| | | | | | | | | 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.
* Make failing stat() calls abort the build.Nico Weber2015-03-191-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | Fixes #830, fixes #904. In practice, this either happens with 64-bit inodes and a 32-bit userspace when building without -D_FILE_OFFSET_BITS=64 in CFLAGS, or when a filename is longer than the system file length limit. Since DiskInterface::Stat() returns -1 on error, and Node used -1 on "stat state unknown", not aborting the build lead to ninja stat()ing the same file over and over again, until it finally ran out of stack. That's now fixed. * Change RecomputeOutputsDirty() to return success instead of dirty state (like RecomputeDirty()) and return the dirty state in a bool outparam * Node::Stat()s old return value wasn't used anywhere, change the function to return success instead and add an |err| outparam * Node::StatIfNecessary()'s old return value was used only in one place. Change that place to explicitly check status_known() and make StatIfNecessary() return success and add an |err| outparam * Plan::CleanNode() can now fail, make it return bool and add an |err| outparam
* Use a small, standalone testing framework instead of googletest.Nico Weber2014-09-181-2/+2
| | | | | | | | | | | | | | | | | | | | | 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.
* add more tests for stat()ing a directoryNico Weber2014-06-271-1/+16
|
* add a test for stat()ing a directoryNico Weber2014-06-271-0/+6
|
* make Stat() a const methodNico Weber2014-06-191-4/+4
|
* add some statcache testsNico Weber2014-06-151-0/+27
|
* Support both slashes on Windows when making output dirsScott Graham2014-04-031-1/+12
|
* make DiskInterfaceTest.StatBadPath quietEvan Martin2013-04-191-0/+2
| | | | | | Add a flag to temporarily suppress error output. Fixes issue #281.
* plumb DepsLog load through BuilderEvan Martin2013-04-081-1/+1
|
* fix all "class" -> "struct"Evan Martin2012-12-291-2/+1
|
* move BuildLog to DependencyScanEvan Martin2012-09-041-1/+1
| | | | | | | The build log is needed in computing whether an edge is dirty, so I think it belongs here. (It's a bit weird that Builder needs to reach into it to record completed commands, maybe it will become cleaner with more thought.)
* split out dirty recomputation logic from Edge classEvan Martin2012-09-021-4/+7
| | | | | | | | | | Rather than passing States and DiskInterfaces through all the calls, put the necessary ambient information in a new DependencyScan object and move the code accordingly. Note: I didn't move the source location of the functions to preserve history, though this does result in a sort of weird order for the functions in graph.cc.
* Put & operator with the type rather than the variable name.Thiago Farina2012-04-281-1/+1
| | | | Signed-off-by: Thiago Farina <tfarina@chromium.org>
* Fix StatBadPath for Windows 7Qingning Huo2012-03-131-2/+5
| | | | | | | The StatBadPath test expects both Windows and Linux to reject a path name with 512 characters. However, it seems that such path is actually acceptable to Windows 7. The change constructs a different path name that is invalid on Windows.
* Treat paths of the form "existing-file/something" as non-existentPeter Collingbourne2012-03-071-12/+14
| | | | | | | | Some people like to construct phony target names by appending a "/something" suffix to an existing target "foo". But if "foo" is an existing file, stat will report ENOTDIR for this path, causing ninja to spew errors. Fix this by treating ENOTDIR in the same way as we do ENOENT -- as a non-existent path.
* Fix tabs, typosPetrWolf2012-02-141-2/+2
|
* Response filesunknown2012-02-091-0/+4
|
* migrate tempdir code to test.ccEvan Martin2012-01-061-71/+4
|
* convert all time_t to a new TimeStamp typeEvan Martin2012-01-051-4/+4
|
* windows: handle ERROR_PATH_NOT_FOUNDEvan Martin2011-12-231-5/+6
| | | | From Frances <frances.buontempo@gmail.com>.
* windows: use GetFileAttributesEx instead of statEvan Martin2011-12-201-2/+7
| | | | | | | | | From a Hacker News comment: "Recent finding, that sped up our systems from 15->3sec on 300,000+ files filestamp check was to move from _stat to GetFileAttributesEx." I do recall reading that calls to stat() on Windows were one of the potential reasons Subversion is so slow on Windows...
* make Node::in_edge_ privateEvan Martin2011-12-071-8/+4
|
* make Node::dirty_ privateEvan Martin2011-12-071-6/+6
|
* merge FileStat into NodeEvan Martin2011-12-071-4/+4
| | | | | | The two were always one-to-one anyway. I started adding accessors to FileStat and then realized most users wanted them on Node and that forwarding them through was silly.
* disable the 'unused parameter' warningEvan Martin2011-12-051-3/+3
| | | | It was firing too often, and hadn't uncovered any bugs.
* Fix compilation warning in Ninja's test suite.Nicolas Despres2011-11-211-3/+3
|
* Split ninja_test.cc into state_test.cc and disk_interface_test.ccThiago Farina2011-09-111-0/+99
| | | | Signed-off-by: Thiago Farina <tfarina@chromium.org>
* Fix windows build by moving mkdtemp() implementation from ninja_test.cc to ↵Thiago Farina2011-09-081-0/+29
| | | | | | disk_interface_test.cc Signed-off-by: Thiago Farina <tfarina@chromium.org>
* Move DiskInterfaceTest into its own source file.Thiago Farina2011-09-071-0/+131
TEST=ninja_test --gtest_filter=DiskInterface* Signed-off-by: Thiago Farina <tfarina@chromium.org>