open_posix_testsuite/mmap_11-4: Skip this test on tmpfs
PATCH 1/1 open_posix_testsuite/mmap_11-4: Skip this test on tmpfs
According to mmap(2) manpage, when you write data to such partial page after the end of the object, the data stays in the page cache even after the file is closed and unmapped, subsequent mappings always see the modified content on tmpfs. We just skip this test when running it on tmpfs.
--- .../conformance/interfaces/mmap/11-4.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c +15 -0
@@ -40,8 +40,11 @@#include <fcntl.h> #include <string.h> #include <errno.h> +#include <sys/vfs.h> #include "posixtest.h" +#define TYPE_TMPFS_MAGIC 0x01021994 +int main (void ) {char tmpfname[256 ];
@@ -54,11 +57,23 @@ int main(void)pid_t child;int i, exit_val; +struct statfs buf; + page_size =sysconf (_SC_PAGE_SIZE);/* mmap will create a partial page */ len = page_size /2 ; +if (statfs ("/tmp" , &buf)) { +printf ("Error at statfs(): %s\n" ,strerror (errno)); +return PTS_UNRESOLVED ; + } + +if (buf.f_type ==TYPE_TMPFS_MAGIC ) { +printf ("From mmap(2) manpage, skip known bug on tmpfs\n" ); +return PTS_UNTESTED ; + } +snprintf (tmpfname,sizeof (tmpfname),"/tmp/pts_mmap_11_5_%d" ,getpid ()); child =fork ();switch (child) {
Signature · 1 line
1.8.3.1
PATCH 1/1 open_posix_testsuite/mmap_11-4: Skip this test on tmpfs
Hi Xiao,
Quoted 17 lines
According to mmap(2) manpage, when you write data to such partial page after the end of the object, the data stays in the page cache even after the file is closed and unmapped, subsequent mappings always see the modified content on tmpfs. We just skip this test when running it on tmpfs.
Signed-off-by Xiao Yang <[email protected]>--- .../conformance/interfaces/mmap/11-4.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c +0
-0
testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c line 46
Quoted 7 lines
testcases/open_posix_testsuite/conformance/interfaces/mmap/11-4.c +2
-0@@ -40,8 +40,11 @@#include <fcntl.h> #include <string.h> #include <errno.h> +#include <sys/vfs.h> #include "posixtest.h" +#define TYPE_TMPFS_MAGIC 0x01021994
Thanks for your patch, pushed.
I don't like redefinition of TMPFS_MAGIC, but I didn't change it as openposix subproject don't use include directory from root and therefore we can't use TST_TMPFS_MAGIC from tst_fs.h. And I didn't add include of <linux/magic.h> due the same inaccessibility of config.h.
Maybe it'd make sense to make access for some of the headers from include directory.
Kind regards,
Petr