From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] shmctl: enable subtest SHM_LOCK SHM_UNLOCK only if kernel < 2.6.9
Date: Thu, 12 Oct 2017 13:03:18 +0200 [thread overview]
Message-ID: <20171012110318.GC10492@rei> (raw)
In-Reply-To: <1507804613-18349-1-git-send-email-lizhijian@cn.fujitsu.com>
Hi!
> +#include <linux/version.h>
> #include "ipcshm.h"
> #include <pwd.h>
>
> @@ -90,11 +91,13 @@ struct test_case_t {
> {
> &shm_id_2, -1, &buf, EINVAL},
> /* EPERM - the command is only valid for the super-user */
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 9)
> {
> &shm_id_2, SHM_LOCK, &buf, EPERM},
> /* EPERM - the command is only valid for the super-user */
> {
> &shm_id_2, SHM_UNLOCK, &buf, EPERM}
> +#endif
First of all, this approach horribly broken. It assumes that the kernel
we are running on has the same version as the kernel-headers package,
which is almost never true.
Secondly the test issues TCONF in case that we don't get this error, so
there is actually nothing to worry about.
What can be done for the test though is to temporary set RLIMIT_MEMLOCK
to 0 in the test setup() so that the we can actually test that code
path.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2017-10-12 11:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 10:36 [LTP] [PATCH] shmctl: enable subtest SHM_LOCK SHM_UNLOCK only if kernel < 2.6.9 Li Zhijian
2017-10-12 11:03 ` Cyril Hrubis [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-12 10:55 Li Zhijian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171012110318.GC10492@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox