Commit 68d4ef85 authored by Yngve N. Pettersen's avatar Yngve N. Pettersen Committed by Commit Bot

Allow testfiles to be created on compressed filesystems

Some FileUtilTest tests fail if run on a Windows file system that is
being compressed. This CL filters the compressed file attribute away
before testing the file attributes.

Change-Id: I015ebc633920fe35902f2195452a26993c26c293
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1917216
Commit-Queue: Albert J. Wong <ajwong@chromium.org>
Reviewed-by: default avatarAlbert J. Wong <ajwong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719270}
parent 8d25f86a
......@@ -238,9 +238,12 @@ void SetReadOnly(const FilePath& path, bool read_only) {
FILE_ATTRIBUTE_READONLY)
: (attrs & (FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_DIRECTORY));
// Ignore FILE_ATTRIBUTE_NOT_CONTENT_INDEXED if present.
// Ignore FILE_ATTRIBUTE_NOT_CONTENT_INDEXED and FILE_ATTRIBUTE_COMPRESSED
// if present. These flags are set by the operating system, depending on
// local configurations, such as compressing the file system. Not filtering
// out these flags could cause tests to fail even though they should pass.
attrs = GetFileAttributes(path.value().c_str()) &
~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
~(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | FILE_ATTRIBUTE_COMPRESSED);
ASSERT_EQ(expected, attrs);
#else
// On all other platforms, it involves removing/setting the write bit.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment