summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2013-03-16 15:00:51 +0000
committerAaron Ballman <aaron@aaronballman.com>2013-03-16 15:00:51 +0000
commitfcdf9a82409d7de6c54ccefe7e21761512bba797 (patch)
treeb9658a03fa17ee52e5ae36cabd6d8631bdf93e05
parentc089074aa57af8cb9cbef1ba351e828c46bab603 (diff)
downloadbcm5719-llvm-fcdf9a82409d7de6c54ccefe7e21761512bba797.tar.gz
bcm5719-llvm-fcdf9a82409d7de6c54ccefe7e21761512bba797.zip
Test case for graceful handling of long file names on Windows. Patch thanks to Paul Robinson!
llvm-svn: 177223
-rw-r--r--llvm/unittests/Support/Path.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index c31cb5306de..45112597979 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -224,6 +224,18 @@ TEST_F(FileSystemTest, TempFiles) {
// Make sure Temp1 doesn't exist.
ASSERT_NO_ERROR(fs::exists(Twine(TempPath), TempFileExists));
EXPECT_FALSE(TempFileExists);
+
+#ifdef LLVM_ON_WIN32
+ // Path name > 260 chars should get an error.
+ const char *Path270 =
+ "abcdefghijklmnopqrstuvwxyz9abcdefghijklmnopqrstuvwxyz8"
+ "abcdefghijklmnopqrstuvwxyz7abcdefghijklmnopqrstuvwxyz6"
+ "abcdefghijklmnopqrstuvwxyz5abcdefghijklmnopqrstuvwxyz4"
+ "abcdefghijklmnopqrstuvwxyz3abcdefghijklmnopqrstuvwxyz2"
+ "abcdefghijklmnopqrstuvwxyz1abcdefghijklmnopqrstuvwxyz0";
+ EXPECT_EQ(fs::unique_file(Twine(Path270), FileDescriptor, TempPath),
+ windows_error::path_not_found);
+#endif
}
TEST_F(FileSystemTest, DirectoryIteration) {
OpenPOWER on IntegriCloud