tests: print expected output by ipc_msgbuf test itself
* tests/ipc_msgbuf.expected: Remove. * tests/Makefile.am (EXTRA_DIST): Remove tests/ipc_msgbuf.expected. * tests/ipc_msgbuf.c: Add expected output. * tests/ipc_msgbuf.test: Add -a31. Redirect output to $EXP. Call match_grep with $LOG and $EXP arguments.
This commit is contained in:
parent
952059fc69
commit
c02090b49b
@ -369,7 +369,6 @@ EXTRA_DIST = \
|
||||
init.sh \
|
||||
init_delete_module.h \
|
||||
ipc.sh \
|
||||
ipc_msgbuf.expected \
|
||||
ksysent.sed \
|
||||
lstatx.c \
|
||||
match.awk \
|
||||
|
@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "tests.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
@ -43,9 +44,12 @@ cleanup(void)
|
||||
{
|
||||
if (msqid != -1) {
|
||||
int rc = msgctl(msqid, IPC_RMID, 0);
|
||||
printf("msgctl\\(%d, (IPC_64\\|)?IPC_RMID, NULL\\) = 0\n",
|
||||
msqid);
|
||||
msqid = -1;
|
||||
if (rc == -1)
|
||||
return 77;
|
||||
puts("\\+\\+\\+ exited with 0 \\+\\+\\+");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -64,11 +68,21 @@ main(void)
|
||||
msqid = msgget(IPC_PRIVATE, IPC_CREAT | S_IRWXU);
|
||||
if (msqid == -1)
|
||||
perror_msg_and_skip("msgget");
|
||||
printf("msgget\\(IPC_PRIVATE, IPC_CREAT\\|0700\\) = %d\n", msqid);
|
||||
|
||||
typedef void (*atexit_func)(void);
|
||||
atexit((atexit_func) cleanup);
|
||||
|
||||
printf("msgsnd\\(%d, \\{%lld, \"" text_string "\\\\0\"\\}, 14, 0\\)"
|
||||
" = 0\n",
|
||||
msqid, (long long) mtype);
|
||||
if (msgsnd(msqid, &msg, msgsz, 0) == -1)
|
||||
perror_msg_and_skip("msgsnd");
|
||||
if (msgrcv(msqid, &msg, msgsz, mtype, 0) != msgsz)
|
||||
perror_msg_and_skip("msgrcv");
|
||||
printf("msgrcv\\(%d, \\{%lld, \"" text_string "\\\\0\"\\}, 14, %lld"
|
||||
", 0\\) = 14\n",
|
||||
msqid, (long long) mtype, (long long) mtype);
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
msgget\(IPC_PRIVATE, IPC_CREAT\|0700\) += [0-9]*
|
||||
msgsnd\([0-9]*, \{233811181, "STRACE_STRING\\0"\}, 14, 0\) += 0
|
||||
msgrcv\([0-9]*, \{233811181, "STRACE_STRING\\0"\}, 14, 233811181, 0\) += 14
|
||||
msgctl\([0-9]*, (IPC_64\|)?IPC_RMID, NULL\) += 0
|
@ -5,7 +5,7 @@
|
||||
. "${srcdir=.}/init.sh"
|
||||
|
||||
run_prog
|
||||
run_strace -v -e msgget,msgsnd,msgrcv,msgctl $args
|
||||
match_grep
|
||||
run_strace -a31 -v -e msgget,msgsnd,msgrcv,msgctl $args > "$EXP"
|
||||
match_grep "$LOG" "$EXP"
|
||||
|
||||
exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user