Imported Upstream version 1.8.1
authorHyunjee Kim <hj0426.kim@samsung.com>
Tue, 2 Jul 2019 00:43:21 +0000 (09:43 +0900)
committerHyunjee Kim <hj0426.kim@samsung.com>
Tue, 2 Jul 2019 00:43:21 +0000 (09:43 +0900)
doc/manual.asciidoc
src/includes_normalize_test.cc
src/version.cc

index 2410083..d54e097 100644 (file)
@@ -1,6 +1,6 @@
 The Ninja build system
 ======================
-v1.8.0, Sep 2017
+v1.8.1, Sep 2017
 
 
 Introduction
index 0bb14ec..eac36fd 100644 (file)
@@ -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));
 }
index ad2d09f..e2a9f49 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "util.h"
 
-const char* kNinjaVersion = "1.8.0";
+const char* kNinjaVersion = "1.8.1";
 
 void ParseVersion(const string& version, int* major, int* minor) {
   size_t end = version.find('.');