mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 12:49:46 +00:00
ltp: fix shmctl01 failure when executed.
schmctl01 fails with following error: [shmctl01 5 TFAIL : shmctl01.c:171: shmctl01 call failed - errno = 22 : Invalid argument] Backport the patch from upstream can fix it. (From OE-Core rev: 337e6923375e7cf568a66b299b6c3461f33a903c) Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
ffbd8bd4ca
commit
b96d6e2f9b
+81
@@ -0,0 +1,81 @@
|
|||||||
|
From db0a43d9388be2c347a8306751bbe6bec086d062 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Stancek <jstancek@redhat.com>
|
||||||
|
Date: Mon, 20 May 2019 20:47:20 +0200
|
||||||
|
Subject: [PATCH] shmctl01: don't use hardcoded index == 0 for SHM_STAT test
|
||||||
|
|
||||||
|
Test fails on SHM_STAT testcase:
|
||||||
|
shmctl01 5 TFAIL : shmctl01.c:173: shmctl01 call failed
|
||||||
|
errno = 22 : Invalid argument
|
||||||
|
shmctl(0, SHM_STAT, 0x601060) = -EINVAL
|
||||||
|
|
||||||
|
since following commit:
|
||||||
|
commit 99db46ea292780cd978d56932d9445b1e8bdafe8
|
||||||
|
Author: Manfred Spraul <manfred@colorfullife.com>
|
||||||
|
Date: Tue May 14 15:46:36 2019 -0700
|
||||||
|
ipc: do cyclic id allocation for the ipc object.
|
||||||
|
|
||||||
|
Don't rely on index 0 being always available, but instead
|
||||||
|
use (maximum) index returned by SHM_INFO.
|
||||||
|
|
||||||
|
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
||||||
|
Reviewed-by: Petr Vorel <pvorel@suse.cz>
|
||||||
|
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
||||||
|
|
||||||
|
Upstream-Status: Backport from v20190517
|
||||||
|
[https://lists.linux.it/pipermail/ltp/2019-May/012051.html]
|
||||||
|
|
||||||
|
Signed-off-by: Hongzhi Song <hongzhi.song@windriver.com>
|
||||||
|
---
|
||||||
|
testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 21 ++++++++++++++++++---
|
||||||
|
1 file changed, 18 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
|
||||||
|
index 1b46977..52bf23a 100644
|
||||||
|
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
|
||||||
|
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
|
||||||
|
@@ -79,6 +79,7 @@ static void func_info(int ret);
|
||||||
|
|
||||||
|
/* Check routine for SHM_STAT */
|
||||||
|
static void func_sstat(int ret);
|
||||||
|
+static void func_sstat_setup(void);
|
||||||
|
|
||||||
|
/* Check routine for SHM_LOCK */
|
||||||
|
static void func_lock(int ret);
|
||||||
|
@@ -110,7 +111,7 @@ static struct test_case_t {
|
||||||
|
#endif
|
||||||
|
{&shm_id_1, IPC_SET, &buf, func_set, set_setup},
|
||||||
|
{&shm_id_1, IPC_INFO, (struct shmid_ds *) &info, func_info, NULL},
|
||||||
|
- {&shm_index, SHM_STAT, &buf, func_sstat, NULL},
|
||||||
|
+ {&shm_index, SHM_STAT, &buf, func_sstat, func_sstat_setup},
|
||||||
|
{&shm_id_1, SHM_LOCK, NULL, func_lock, NULL},
|
||||||
|
{&shm_id_1, SHM_UNLOCK, NULL, func_unlock, NULL},
|
||||||
|
{&shm_id_1, IPC_RMID, NULL, func_rmid, NULL},
|
||||||
|
@@ -407,9 +408,23 @@ static void func_info(int ret)
|
||||||
|
static void func_sstat(int ret)
|
||||||
|
{
|
||||||
|
if (ret >= 0)
|
||||||
|
- tst_resm(TPASS, "get correct shared memory id");
|
||||||
|
+ tst_resm(TPASS, "get correct shared memory id for index: %d",
|
||||||
|
+ shm_index);
|
||||||
|
else
|
||||||
|
- tst_resm(TFAIL, "shared memory id is incorrect");
|
||||||
|
+ tst_resm(TFAIL, "shared memory id is incorrect, index: %d",
|
||||||
|
+ shm_index);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void func_sstat_setup(void)
|
||||||
|
+{
|
||||||
|
+ struct shm_info tmp;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = shmctl(shm_id_1, SHM_INFO, (void *)&tmp);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ tst_resm(TFAIL|TERRNO, "shmctl(SHM_INFO)");
|
||||||
|
+ else
|
||||||
|
+ shm_index = ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void func_lock(int ret)
|
||||||
|
--
|
||||||
|
2.8.1
|
||||||
|
|
||||||
@@ -50,6 +50,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
|
|||||||
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
|
file://define-sigrtmin-and-sigrtmax-for-musl.patch \
|
||||||
file://setregid01-security-string-formatting.patch \
|
file://setregid01-security-string-formatting.patch \
|
||||||
file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
|
file://0001-syscalls-setrlimit03.c-read-proc-sys-fs-nr_open-for-.patch \
|
||||||
|
file://0001-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch \
|
||||||
"
|
"
|
||||||
|
|
||||||
S = "${WORKDIR}/git"
|
S = "${WORKDIR}/git"
|
||||||
|
|||||||
Reference in New Issue
Block a user