diff options
author | Evan Martin <martine@danga.com> | 2011-12-20 20:13:11 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-12-20 20:13:11 (GMT) |
commit | 93c78361e30e33f950eef754742b236251e2c81e (patch) | |
tree | c054fb902a71b4892a76280e5e38adda8bc4b664 /src/disk_interface_test.cc | |
parent | bf9116ffbb9c9fdfa8a38fa681b25dd34092ad43 (diff) | |
download | Ninja-93c78361e30e33f950eef754742b236251e2c81e.zip Ninja-93c78361e30e33f950eef754742b236251e2c81e.tar.gz Ninja-93c78361e30e33f950eef754742b236251e2c81e.tar.bz2 |
windows: use GetFileAttributesEx instead of stat
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...
Diffstat (limited to 'src/disk_interface_test.cc')
-rw-r--r-- | src/disk_interface_test.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/disk_interface_test.cc b/src/disk_interface_test.cc index 0ca34ad..d0794fd 100644 --- a/src/disk_interface_test.cc +++ b/src/disk_interface_test.cc @@ -107,16 +107,21 @@ class DiskInterfaceTest : public testing::Test { RealDiskInterface disk_; }; -TEST_F(DiskInterfaceTest, Stat) { +TEST_F(DiskInterfaceTest, StatMissingFile) { EXPECT_EQ(0, disk_.Stat("nosuchfile")); +} +TEST_F(DiskInterfaceTest, StatBadPath) { #ifdef _WIN32 - // TODO: find something that stat fails on for Windows. + string bad_path = "cc:\\foo"; + EXPECT_EQ(-1, disk_.Stat(bad_path)); #else string too_long_name(512, 'x'); EXPECT_EQ(-1, disk_.Stat(too_long_name)); #endif +} +TEST_F(DiskInterfaceTest, StatExistingFile) { #ifdef _WIN32 ASSERT_EQ(0, system("cmd.exe /c echo hi > file")); #else |