From 480f89984598f46445380ee26599887d2a7c0455 Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Mon, 4 Sep 2017 16:18:32 +0900 Subject: fix normalizer test for _MAX_PATH --- src/includes_normalize_test.cc | 53 ++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/includes_normalize_test.cc b/src/includes_normalize_test.cc index 0bb14ec..eac36fd 100644 --- a/src/includes_normalize_test.cc +++ b/src/includes_normalize_test.cc @@ -108,36 +108,33 @@ TEST(IncludesNormalize, LongInvalidPath) { normalizer.Normalize(kLongInputString, &result, &err)); EXPECT_EQ("path too long", err); - const char kExactlyMaxPath[] = - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "012345678\\" - "0123456789"; + + // Construct max size path having cwd prefix. + // kExactlyMaxPath = "$cwd\\a\\aaaa...aaaa\0"; + char kExactlyMaxPath[_MAX_PATH + 1]; + ASSERT_NE(_getcwd(kExactlyMaxPath, sizeof kExactlyMaxPath), NULL); + + int cwd_len = strlen(kExactlyMaxPath); + ASSERT_LE(cwd_len + 3 + 1, _MAX_PATH) + kExactlyMaxPath[cwd_len] = '\\'; + kExactlyMaxPath[cwd_len + 1] = 'a'; + kExactlyMaxPath[cwd_len + 2] = '\\'; + + kExactlyMaxPath[cwd_len + 3] = 'a'; + + for (int i = cwd_len + 4; i < _MAX_PATH; ++i) { + if (i > cwd_len + 4 && i < _MAX_PATH - 1 && i % 10 == 0) + kExactlyMaxPath[i] = '\\'; + else + kExactlyMaxPath[i] = 'a'; + } + + kExactlyMaxPath[_MAX_PATH] = '\0'; + EXPECT_EQ(strlen(kExactlyMaxPath), _MAX_PATH); + string forward_slashes(kExactlyMaxPath); replace(forward_slashes.begin(), forward_slashes.end(), '\\', '/'); // Make sure a path that's exactly _MAX_PATH long is canonicalized. - EXPECT_EQ(forward_slashes, + EXPECT_EQ(forward_slashes.substr(cwd_len + 1), NormalizeAndCheckNoError(kExactlyMaxPath)); } -- cgit v0.12 From 7738c19dc42f63bedb5cb728d6ebde71b8fdaaf4 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 6 Sep 2017 15:00:43 -0400 Subject: mark this 1.8.1.git --- src/version.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.cc b/src/version.cc index 758af15..3ee95b2 100644 --- a/src/version.cc +++ b/src/version.cc @@ -18,7 +18,7 @@ #include "util.h" -const char* kNinjaVersion = "1.8.0.git"; +const char* kNinjaVersion = "1.8.1.git"; void ParseVersion(const string& version, int* major, int* minor) { size_t end = version.find('.'); -- cgit v0.12