[LLVMdev] [PATCH] Test failures
Hannes Weisbach
hannes.weisbach at mailbox.tu-dresden.de
Wed Mar 25 03:24:02 PDT 2015
Hi all,
I experienced some test failures under Linux, probably caused by r232936:
In the test SanitizerCommon-Unit ::
Sanitizer-i386-Test/MemoryMappingLayout.CodeRange the temporary test
file was opened write-only, but was read from, what subsequently
failed:
Note: Google Test filter = MemoryMappingLayout.CodeRange
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MemoryMappingLayout
[ RUN ] MemoryMappingLayout.CodeRange
/home/weisbach/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_procmaps_test.cc:29: Failure
Value of: true
Expected: res
Which is: false
[ FAILED ] MemoryMappingLayout.CodeRange (1 ms)
[----------] 1 test from MemoryMappingLayout (1 ms total)
Thus, the file should be opened read-write.
In the test SanitizerCommon-Unit ::
Sanitizer-i386-Test/SanitizerCommon.InternalMmapWithOffset the
temporary test file was opened write-only, only to be later mmap()ed
with MAP_SHARED, resulting in a EACCES return value:
********************
FAIL: SanitizerCommon-Unit :: Sanitizer-i386-Test/SanitizerCommon.InternalMmapWithOffset (10034 of 10784)
******************** TEST 'SanitizerCommon-Unit :: Sanitizer-i386-Test/SanitizerCommon.InternalMmapWithOffset' FAILED ********************
Note: Google Test filter = SanitizerCommon.InternalMmapWithOffset
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from SanitizerCommon
[ RUN ] SanitizerCommon.InternalMmapWithOffset
/home/weisbach/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cc:152: Failure
Expected: (nullptr) != (p), actual: 4-byte object <00-00 00-00> vs NULL
[ FAILED ] SanitizerCommon.InternalMmapWithOffset (0 ms)
[----------] 1 test from SanitizerCommon (1 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] SanitizerCommon.InternalMmapWithOffset
1 FAILED TEST
could not map writable file (3, 4096, 4096): -1, errno: 13
13 is EACCES and the mmap() man page says:
EACCES A file descriptor refers to a non-regular file. Or MAP_PRIVATE
was requested, but fd is not open for reading. Or MAP_SHARED was
requested and PROT_WRITE is set, but fd is not open in read/write
(O_RDWR) mode. Or PROT_WRITE is set, but the file is append-only.
As it turns out PROT_WRITE is set indeed, and the file is not open in
read-write mode, thus this test file also needs to be opened in
read-write.
A patch is attached.
--
Best regards,
Hannes
diff --git a/lib/sanitizer_common/tests/sanitizer_libc_test.cc b/lib/sanitizer_common/tests/sanitizer_libc_test.cc
index 689c6ed..a304458 100644
--- a/lib/sanitizer_common/tests/sanitizer_libc_test.cc
+++ b/lib/sanitizer_common/tests/sanitizer_libc_test.cc
@@ -85,7 +85,7 @@ TEST(SanitizerCommon, FileOps) {
EXPECT_EQ(len2, internal_write(fd, str2, len2));
internal_close(fd);
- openrv = OpenFile(tmpfile, WrOnly);
+ openrv = OpenFile(tmpfile, RdWr);
EXPECT_FALSE(internal_iserror(openrv));
fd = openrv;
uptr fsize = internal_filesize(fd);
@@ -134,7 +134,7 @@ TEST(SanitizerCommon, InternalMmapWithOffset) {
char tmpfile[128];
temp_file_name(tmpfile, sizeof(tmpfile),
"sanitizer_common.internalmmapwithoffset.tmp.");
- uptr res = OpenFile(tmpfile, WrOnly);
+ uptr res = OpenFile(tmpfile, RdWr);
ASSERT_FALSE(internal_iserror(res));
fd_t fd = res;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150325/caa04d96/attachment.sig>
More information about the llvm-dev
mailing list