<div dir="ltr">Isn't this fixed in r<span style="font-size:12.8000001907349px">232972? </span></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 25, 2015 at 3:24 AM, Hannes Weisbach <span dir="ltr"><<a href="mailto:hannes.weisbach@mailbox.tu-dresden.de" target="_blank">hannes.weisbach@mailbox.tu-dresden.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I experienced some test failures under Linux, probably caused by r232936:<br>
<br>
In the test SanitizerCommon-Unit ::<br>
Sanitizer-i386-Test/MemoryMappingLayout.CodeRange the temporary test<br>
file was opened write-only, but was read from, what subsequently<br>
failed:<br>
<br>
Note: Google Test filter = MemoryMappingLayout.CodeRange<br>
[==========] Running 1 test from 1 test case.<br>
[----------] Global test environment set-up.<br>
[----------] 1 test from MemoryMappingLayout<br>
[ RUN      ] MemoryMappingLayout.CodeRange<br>
/home/weisbach/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_procmaps_test.cc:29: Failure<br>
Value of: true<br>
Expected: res<br>
Which is: false<br>
[  FAILED  ] MemoryMappingLayout.CodeRange (1 ms)<br>
[----------] 1 test from MemoryMappingLayout (1 ms total)<br>
<br>
Thus, the file should be opened read-write.<br>
<br>
In the test SanitizerCommon-Unit ::<br>
Sanitizer-i386-Test/SanitizerCommon.InternalMmapWithOffset the<br>
temporary test file was opened write-only, only to be later mmap()ed<br>
with MAP_SHARED, resulting in a EACCES return value:<br>
<br>
********************<br>
FAIL: SanitizerCommon-Unit :: Sanitizer-i386-Test/SanitizerCommon.InternalMmapWithOffset (10034 of 10784)<br>
******************** TEST 'SanitizerCommon-Unit :: Sanitizer-i386-Test/SanitizerCommon.InternalMmapWithOffset' FAILED ********************<br>
Note: Google Test filter = SanitizerCommon.InternalMmapWithOffset<br>
[==========] Running 1 test from 1 test case.<br>
[----------] Global test environment set-up.<br>
[----------] 1 test from SanitizerCommon<br>
[ RUN      ] SanitizerCommon.InternalMmapWithOffset<br>
/home/weisbach/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc:152: Failure<br>
Expected: (nullptr) != (p), actual: 4-byte object <00-00 00-00> vs NULL<br>
[  FAILED  ] SanitizerCommon.InternalMmapWithOffset (0 ms)<br>
[----------] 1 test from SanitizerCommon (1 ms total)<br>
<br>
[----------] Global test environment tear-down<br>
[==========] 1 test from 1 test case ran. (1 ms total)<br>
[  PASSED  ] 0 tests.<br>
[  FAILED  ] 1 test, listed below:<br>
[  FAILED  ] SanitizerCommon.InternalMmapWithOffset<br>
<br>
 1 FAILED TEST<br>
could not map writable file (3, 4096, 4096): -1, errno: 13<br>
<br>
13 is EACCES and the mmap() man page says:<br>
<br>
EACCES A file descriptor refers to a non-regular file.  Or MAP_PRIVATE<br>
was requested, but fd is not open for reading.  Or MAP_SHARED was<br>
requested and PROT_WRITE is set, but fd is not open in read/write<br>
(O_RDWR) mode.  Or PROT_WRITE is set, but the file is append-only.<br>
<br>
As it turns out PROT_WRITE is set indeed, and the file is not open in<br>
read-write mode, thus this test file also needs to be opened in<br>
read-write.<br>
<br>
A patch is attached.<br>
<br>
--<br>
Best regards,<br>
Hannes<br>
<br>
diff --git a/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/lib/sanitizer_common/tests/sanitizer_libc_test.cc<br>
index 689c6ed..a304458 100644<br>
--- a/lib/sanitizer_common/tests/sanitizer_libc_test.cc<br>
+++ b/lib/sanitizer_common/tests/sanitizer_libc_test.cc<br>
@@ -85,7 +85,7 @@ TEST(SanitizerCommon, FileOps) {<br>
   EXPECT_EQ(len2, internal_write(fd, str2, len2));<br>
   internal_close(fd);<br>
<br>
-  openrv = OpenFile(tmpfile, WrOnly);<br>
+  openrv = OpenFile(tmpfile, RdWr);<br>
   EXPECT_FALSE(internal_iserror(openrv));<br>
   fd = openrv;<br>
   uptr fsize = internal_filesize(fd);<br>
@@ -134,7 +134,7 @@ TEST(SanitizerCommon, InternalMmapWithOffset) {<br>
   char tmpfile[128];<br>
   temp_file_name(tmpfile, sizeof(tmpfile),<br>
                  "sanitizer_common.internalmmapwithoffset.tmp.");<br>
-  uptr res = OpenFile(tmpfile, WrOnly);<br>
+  uptr res = OpenFile(tmpfile, RdWr);<br>
   ASSERT_FALSE(internal_iserror(res));<br>
   fd_t fd = res;<br>
<br>
<br>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>