diff options
author | Philip Craig <philip@pobox.com> | 2011-05-28 08:28:01 (GMT) |
---|---|---|
committer | Philip Craig <philip@pobox.com> | 2011-05-28 08:28:01 (GMT) |
commit | 41a4e2604ba4a4add4dc5f2fd6213ef5c2243ca4 (patch) | |
tree | 6324a5ae48a17f8fc77d5bce1a01888dbf22c528 /src/build_log_test.cc | |
parent | 511613ce2552528c00719ca59c8b2411518f12db (diff) | |
download | Ninja-41a4e2604ba4a4add4dc5f2fd6213ef5c2243ca4.zip Ninja-41a4e2604ba4a4add4dc5f2fd6213ef5c2243ca4.tar.gz Ninja-41a4e2604ba4a4add4dc5f2fd6213ef5c2243ca4.tar.bz2 |
Tests now build on a native Windows build (tested with VS2010)
All tests except SubProcess pass on a native Windows build
Tests continue not to build on a platform=mingw build
Diffstat (limited to 'src/build_log_test.cc')
-rwxr-xr-x[-rw-r--r--] | src/build_log_test.cc | 11 |
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)); |