Bug 4088 - syscall.mmap test is using create() but tests for open()
Summary: syscall.mmap test is using create() but tests for open()
Alias: None
Product: systemtap
Classification: Unclassified
Component: testsuite (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Martin Hunt
Depends on:
Reported: 2007-02-21 23:55 UTC by David Wilder
Modified: 2007-09-17 17:16 UTC (History)
0 users

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description David Wilder 2007-02-21 23:55:41 UTC
The mmap test in testsuite/systemtap.syscall is using creat() but is testing for
the open() syscall.

From mmap.c
/* create a file with something in it */
 fd = creat("foobar",S_IREAD|S_IWRITE);
 // open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 4

This works on i386 I think because glibc just calls open().   On s390 this is
not the case, sys_creat is really called.  
The compiler has optimized sys_creat so that sys_open() has been inlined.  So
you never see the call to sys_open.

Running the test:  test.tcl mmap  produces:
mmap: mprotect (0x0000020000187000, 12288, PROT_READ) = 0
mmap: mprotect (0x000002000001d000, 4096, PROT_READ) = 0
mmap: munmap (0x0000020000020000, 63065) = 0
mmap: creat ("foobar", O_RDONLY, 0600) = 4       <<<  not what is expected
mmap: lseek (4, 1024, SEEK_SET) = 1024
mmap: write (4, "abcdef", 6) = 6
mmap: close (4) = 0

Can the test be changed to just use open() not creat().  This way it should run
on all platforms.
Comment 1 Srikar Dronamraju 2007-04-19 12:35:18 UTC
Same problem seen while testing of 20070414 snapshot on ppc64 using 2.6.21-rc7
Comment 2 Martin Hunt 2007-04-23 19:56:12 UTC
Checked in a new version of mmap.c using open(). Let me know if this fixes your
Comment 3 Martin Hunt 2007-09-17 17:16:12 UTC
Must be fixed because it hasn't appeared in the test reports for a long time.