diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2017-02-10 00:14:45 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2017-02-10 00:14:45 +0000 |
commit | 649fe41781560a15fb6c89c2633a010ad7150fff (patch) | |
tree | a7b52d6e778a674556d56c2ef35bfb63533581d8 /tests/mq.c | |
parent | 2ee98e5030860aa535728ec4de5b07c0ce765b50 (diff) | |
download | strace-649fe41781560a15fb6c89c2633a010ad7150fff.tar.gz |
tests: rewrite mq.test from match_grep to match_diff
Unlike the previous edition of the test that was based on match_grep,
the new one is match_diff based and does more rigorous testing.
* tests/mq.c: Include <stdio.h>.
(NAME): New macro.
(main): Use it. Print expected output.
* tests/mq.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
* tests/mq.test: Use run_strace_match_diff.
Diffstat (limited to 'tests/mq.c')
-rw-r--r-- | tests/mq.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/mq.c b/tests/mq.c index d80f9270f..9c2ffc8ed 100644 --- a/tests/mq.c +++ b/tests/mq.c @@ -32,23 +32,42 @@ # include <fcntl.h> # include <mqueue.h> +# include <stdio.h> # include <stdlib.h> # include <unistd.h> # include <sys/stat.h> +# define NAME "strace-mq.test" + int main (void) { struct mq_attr attr; (void) close(0); - if (mq_open("/strace-mq.test", O_CREAT, S_IRWXU, 0)) + + if (mq_open("/" NAME, O_CREAT, 0700, NULL)) perror_msg_and_skip("mq_open"); + printf("mq_open(\"%s\", O_RDONLY|O_CREAT, 0700, NULL) = 0\n", NAME); + if (mq_getattr(0, &attr)) perror_msg_and_skip("mq_getattr"); - if (mq_setattr(0, &attr, 0)) + printf("mq_getsetattr(0, NULL, {mq_flags=0, mq_maxmsg=%lld" + ", mq_msgsize=%lld, mq_curmsgs=0}) = 0\n", + (long long) attr.mq_maxmsg, + (long long) attr.mq_msgsize); + + if (mq_setattr(0, &attr, NULL)) perror_msg_and_skip("mq_setattr"); - if (mq_unlink("/strace-mq.test")) + printf("mq_getsetattr(0, {mq_flags=0, mq_maxmsg=%lld" + ", mq_msgsize=%lld, mq_curmsgs=0}, NULL) = 0\n", + (long long) attr.mq_maxmsg, + (long long) attr.mq_msgsize); + + if (mq_unlink("/" NAME)) perror_msg_and_skip("mq_unlink"); + printf("mq_unlink(\"%s\") = 0\n", NAME); + + puts("+++ exited with 0 +++"); return 0; } |