summaryrefslogtreecommitdiffstats
path: root/src/build_log_test.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-28 19:07:21 (GMT)
committerEvan Martin <martine@danga.com>2011-05-28 19:07:21 (GMT)
commit7fa1410f29aaa964a4f3730b13748f1e5462394f (patch)
tree6324a5ae48a17f8fc77d5bce1a01888dbf22c528 /src/build_log_test.cc
parent511613ce2552528c00719ca59c8b2411518f12db (diff)
parent41a4e2604ba4a4add4dc5f2fd6213ef5c2243ca4 (diff)
downloadNinja-7fa1410f29aaa964a4f3730b13748f1e5462394f.zip
Ninja-7fa1410f29aaa964a4f3730b13748f1e5462394f.tar.gz
Ninja-7fa1410f29aaa964a4f3730b13748f1e5462394f.tar.bz2
Merge pull request #50 from philipcraig/master
Fixes to let native builds on Visual Studio 2010 build, pass tests
Diffstat (limited to 'src/build_log_test.cc')
-rwxr-xr-x[-rw-r--r--]src/build_log_test.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/build_log_test.cc b/src/build_log_test.cc
index 8bb2bfa..1df28db 100644..100755
--- a/src/build_log_test.cc
+++ b/src/build_log_test.cc
@@ -16,6 +16,10 @@
#include "test.h"
+#ifdef WIN32
+#include <fcntl.h>
+#endif
+
static const char kTestFilename[] = "BuildLogTest-tempfile";
struct BuildLogTest : public StateTestWithBuiltinRules {
@@ -90,7 +94,14 @@ TEST_F(BuildLogTest, Truncate) {
// For all possible truncations of the input file, assert that we don't
// crash or report an error when parsing.
for (off_t size = statbuf.st_size; size > 0; --size) {
+#ifndef WIN32
ASSERT_EQ(0, truncate(kTestFilename, size));
+#else
+ int fh;
+ ASSERT_EQ(0, _sopen_s(&fh, kTestFilename, _O_RDWR | _O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE));
+ ASSERT_EQ(0, _chsize(fh, size));
+ _close(fh);
+#endif
BuildLog log2;
EXPECT_TRUE(log2.Load(kTestFilename, &err));