[LTP] [PATCH v4] mmap01: Convert to new API
Ricardo B. Marliere
rbm@suse.com
Fri Dec 13 02:08:28 CET 2024
Hello!
On 11 Dec 24 20:00, Petr Vorel wrote:
> > Hi Petr!
>
> > On 11 Dec 24 02:47, Petr Vorel wrote:
> > > Hi Ricardo,
>
> > > ...
> > > > +static void run(void)
> > > > {
> > > > + pid_t pid;
> > > > +
> > > > + addr = SAFE_MMAP(NULL, page_sz, PROT_READ | PROT_WRITE,
> > > > + MAP_FILE | MAP_SHARED, fildes, 0);
> > > > +
> > > > + /*
> > > > + * Check if mapped memory area beyond EOF are zeros and changes beyond
> > > > + * EOF are not written to file.
> > > > + */
> > > > + if (memcmp(&addr[file_sz], dummy, page_sz - file_sz))
> > > > + tst_brk(TFAIL, "mapped memory area contains invalid data");
> > > FYI test fails when run more iterations (e.g. -i2)
>
>
> > Thanks for taking a look, but I don't see the issue here:
>
> > # /opt/ltp/testcases/bin/mmap01 -i4
> > tst_tmpdir.c:316: TINFO: Using /tmp/LTP_mmaiVJsAq as tmpdir (fuse filesystem)
> > tst_test.c:1890: TINFO: LTP version: 20240930-73-g865be36ffce8
> > tst_test.c:1894: TINFO: Tested kernel: 6.11.0-virtme #1 SMP PREEMPT_DYNAMIC Fri Oct 4 13:39:48 -03 2024 x86_64
> > tst_test.c:1725: TINFO: Timeout per run is 0h 00m 30s
> > mmap01.c:49: TPASS: Functionality of mmap() successful YES
> > mmap01.c:49: TPASS: Functionality of mmap() successful YES
> > mmap01.c:49: TPASS: Functionality of mmap() successful YES
> > mmap01.c:49: TPASS: Functionality of mmap() successful YES
>
> > Summary:
> > passed 4
> > failed 0
> > broken 0
> > skipped 0
> > warnings 0
>
> > I appended the "YES" just to make sure I wasn't running some outdated
> > code, can you please provide more details?
>
> I have no idea myself. I verified if I'm using v4 [1] and I really do.
> Can you please push the code you're using?
> Your code I'm testing is in my fork [2].
>
> Tested on more systems:
Many thanks! After a fresh build I started seeing those, too. The issue
is that run() changes the file and the second run uses this updated
file. I pushed a new revision with a new set_file to put it in a known
state before each run.
FWIW I pushed it here:
https://github.com/rbmarliere/ltp/tree/b4/convert_mmap01
Thanks,
- Ricardo.
>
> # ./mmap01 -i4
> tst_tmpdir.c:316: TINFO: Using /tmp/LTP_mmabiOth0 as tmpdir (tmpfs filesystem)
> tst_test.c:1890: TINFO: LTP version: 20240930-116-g23f5a4447
> tst_test.c:1894: TINFO: Tested kernel: 6.13.0-rc1-1.g492f944-default #1 SMP PREEMPT_DYNAMIC Mon Dec 2 08:55:00 UTC 2024 (492f944) x86_64
> tst_test.c:1725: TINFO: Timeout per run is 0h 00m 30s
> mmap01.c:49: TPASS: Functionality of mmap() successful
> mmap01.c:68: TFAIL: mapped memory area contains invalid data
>
> Summary:
> passed 1
> failed 1
> broken 0
> skipped 0
> warnings 0
>
> $ ./mmap01 -i4
> tst_tmpdir.c:316: TINFO: Using /tmp/LTP_mmakqgzvS as tmpdir (tmpfs filesystem)
> tst_test.c:1890: TINFO: LTP version: 20240930-115-g786b808eda
> tst_test.c:1894: TINFO: Tested kernel: 6.11-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11 (2024-11-23) x86_64
> tst_test.c:1725: TINFO: Timeout per run is 0h 00m 30s
> mmap01.c:49: TPASS: Functionality of mmap() successful
> mmap01.c:68: TFAIL: mapped memory area contains invalid data
>
> Summary:
> passed 1
> failed 1
> broken 0
> skipped 0
> warnings 0
>
> [1] https://patchwork.ozlabs.org/project/ltp/patch/20241210-convert_mmap01-v4-1-c2338a2ca071@suse.com/
> [2] https://github.com/pevik/ltp/commit/a3c07097784088a679e77a4486bb10adfe03eea0
More information about the ltp
mailing list