Commit Graph

18 Commits

Author SHA1 Message Date
184e94ba05 Fix a few spacing style issues
Reported by kernel's checkpatch.pl script.
2017-06-17 22:54:08 +00:00
Eugene Syromyatnikov
9d095c7860 Add copyright headers 2017-05-22 17:33:51 +00:00
e0fc01c0ef tests: update ipc_sem.test for new glibc
Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
address to semctl like other libcs.

* tests/ipc_sem.c (main) [__GLIBC__]: Remove.
2017-02-08 15:54:35 +00:00
Eugene Syromyatnikov
3b4612b3ac Print indirect pointers as pointers
Originally, printnum_long_int was used, but it prints NULL incorrectly.

* defs.h (DECL_PRINTNUM_ADDR): New macro.
(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
[!current_wordsize] (printnum_addr_long_int): New prototype.
[!current_wordsize] (printnum_ptr): Use it.
[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
* util.c (DEF_PRINTNUM_ADDR): New macro.
(DEF_PRINTNUM_ADDR(int, unsigned int),
DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
provide printnum_addr_int and printnum_addr_int64, accordingly.
[!current_wordsize] (printnum_addr_long_int): New function.
* xet_robust_list.c (sprintaddr): New function.
(main): Use it, update expected output.
* tests/ipc_sem.c (main): Update expected output.

Co-authored-by: Dmitry V. Levin <ldv@altlinux.org>
2016-12-26 15:29:06 +00:00
Eugene Syromyatnikov
762b155643 ipc_sem: print 4th argument of semctl syscall as an address
* ipc_sem.c (SYS_FUNC(semctl)): Print 4th argument using printaddr.
* tests/ipc_sem.c (cleanup): Update expected output.
2016-12-26 15:05:41 +00:00
1ae660572f tests: workaround limited semctl implementation in musl
musl libc forwards semctl command argument for 8 known commands only,
for all the rest it passes 0 instead.

* tests/ipc_sem.c (main): Update semctl expected output.
2016-09-13 21:18:17 +00:00
Eugene Syromyatnikov
1bc727fc2f tests: add more IPC decoding checks
* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
commands) checks.
* tests/ipc_sem.c: Additional semget and semctl checks.
* tests/ipc_shm.c: Additional shmget and shmctl checks.
* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
* tests/semop.test: Add explicit -e parameter in order to trace both
semop and semtimedop.
* tests/shmxt.c: Additional shmat and shmdt checks.
2016-09-13 17:21:20 +00:00
3138893026 tests: use sprintrc_grep in tests/ipc_sem.c
* tests/ipc_sem.c (main): Use sprintrc_grep.
2016-09-12 09:27:58 +00:00
7b93574bc7 ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
is __kernel_key_t (i.e. int), cast key_t argument to int
and print it using %#x format.
* ipc_sem.c (SYS_FUNC(semget)): Likewise.
* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
* tests/ipc_msg.c (main): Test it.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
2016-09-08 16:26:48 +00:00
efb134041e tests/ipc_sem.c: use libtests
* tests/ipc_sem.c (cleanup): New function.
(main): Use it and perror_msg_and_skip.
2016-01-06 11:59:29 +00:00
38a34c9349 Add copyright headers to some files which lack them
Before this change, all files that exist since 20th century had
copyright headers, while most files that appeared later didn't.  This
change fixes the inconsistency by adding missing copyright headers.

It doesn't mean that copyright headers became maintained.  In my view,
git history provides much better information on this subject and is much
more accurate than copyright headers.
2015-12-17 17:56:48 +00:00
499c5aad0c semctl: fix indirect syscall decoding
On architectures where the semctl call is implemented by the ipc syscall
the 4th argument is passed by reference.

* ipc.c (sys_semctl): Handle the indirect ipc subcall case.
* tests/ipc_sem.c (main): Optionally match indirection
in the 4th argument of semctl calls.

Reported-by: Andreas Schwab <schwab@suse.de>
2015-03-16 14:23:09 +00:00
Andreas Schwab
3aa45f3cc2 tests/ipc_*: match IPC_64 flag
* tests/ipc_msg.c (main): Optionally match "IPC_64|" in the third
argument of the ipc call.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
2015-03-16 14:26:58 +01:00
Andreas Schwab
fa5ce37246 Fix crash in ipc_sem test
Properly use union semun as argument of semctl.

* tests/ipc_sem.c (main): Properly use union semun as argument of
semctl.  Don't handle EFAULT specially.
* tests/ipc_sem.test: Revert last change.
2015-03-16 12:18:36 +01:00
Mike Frysinger
d79ed12376 tests: skip ipc_sem.test on broken kernels
Rather than trigger an ERROR which fails `make check`, go with SKIP
instead.  We don't want the testsuite failing due to kernel bugs.

* tests/ipc_sem.c (main): Change 99 to 77.
2015-03-03 01:13:23 +00:00
Mike Frysinger
4ed340bae6 tests/ipc_sem: detect broken kernels
When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
logic wrongly returns errors.  Detect that and throw an error.

* tests/ipc_sem.c: Return 99 when errno is EFAULT.
* tests/ipc_sem.test: Save output to $OUT and show it when failing.
Handle exit status 99 to throw an ERROR.
2015-02-28 12:10:39 +00:00
7230d0a388 tests: add IPC_STAT to ipc tests, workaround limitiations of old kernels
* tests/ipc_msg.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels MSG_STAT behaviour.
* tests/ipc_sem.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SEM_STAT behaviour.
* tests/ipc_shm.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SHM_STAT behaviour.
2015-01-14 16:57:37 +00:00
12e2442784 tests: add tests for ipc syscalls decoding
* tests/ipc_msg.c: New file.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.
* tests/ipc_msg.test: New test.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add ipc_msg, ipc_sem, and ipc_shm.
(TESTS): Add ipc_msg.test, ipc_sem.test, and ipc_shm.test.
* tests/.gitignore: Add ipc_msg, ipc_sem, and ipc_shm.
2015-01-12 16:24:20 +00:00