diff options
Diffstat (limited to 'meta/recipes-extended/ltp/ltp/0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch')
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch b/meta/recipes-extended/ltp/ltp/0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch new file mode 100644 index 0000000000..8704e5ffe8 --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0010-shmctl01-don-t-use-hardcoded-index-0-for-SHM_STAT-te.patch | |||
@@ -0,0 +1,82 @@ | |||
1 | From 794933b38354a2612cf2c471f11798b306f35315 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jan Stancek <jstancek@redhat.com> | ||
3 | Date: Mon, 20 May 2019 20:47:20 +0200 | ||
4 | Subject: [PATCH] shmctl01: don't use hardcoded index == 0 for SHM_STAT test | ||
5 | |||
6 | Test fails on SHM_STAT testcase: | ||
7 | shmctl01 5 TFAIL : shmctl01.c:173: shmctl01 call failed | ||
8 | errno = 22 : Invalid argument | ||
9 | shmctl(0, SHM_STAT, 0x601060) = -EINVAL | ||
10 | |||
11 | since following commit: | ||
12 | commit 99db46ea292780cd978d56932d9445b1e8bdafe8 | ||
13 | Author: Manfred Spraul <manfred@colorfullife.com> | ||
14 | Date: Tue May 14 15:46:36 2019 -0700 | ||
15 | ipc: do cyclic id allocation for the ipc object. | ||
16 | |||
17 | Don't rely on index 0 being always available, but instead | ||
18 | use (maximum) index returned by SHM_INFO. | ||
19 | |||
20 | Signed-off-by: Jan Stancek <jstancek@redhat.com> | ||
21 | Reviewed-by: Petr Vorel <pvorel@suse.cz> | ||
22 | Acked-by: Cyril Hrubis <chrubis@suse.cz> | ||
23 | |||
24 | Upstream-Status: Backport | ||
25 | [https://github.com/linux-test-project/ltp/commit/db0a43d9388be2c347a8306751bbe6bec086d062] | ||
26 | |||
27 | Signed-off-by: Hongzhi Song <hongzhi.song@windriver.com> | ||
28 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
29 | --- | ||
30 | testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 21 ++++++++++++++++++--- | ||
31 | 1 file changed, 18 insertions(+), 3 deletions(-) | ||
32 | |||
33 | diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | ||
34 | index 1b46977..52bf23a 100644 | ||
35 | --- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | ||
36 | +++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | ||
37 | @@ -79,6 +79,7 @@ static void func_info(int ret); | ||
38 | |||
39 | /* Check routine for SHM_STAT */ | ||
40 | static void func_sstat(int ret); | ||
41 | +static void func_sstat_setup(void); | ||
42 | |||
43 | /* Check routine for SHM_LOCK */ | ||
44 | static void func_lock(int ret); | ||
45 | @@ -110,7 +111,7 @@ static struct test_case_t { | ||
46 | #endif | ||
47 | {&shm_id_1, IPC_SET, &buf, func_set, set_setup}, | ||
48 | {&shm_id_1, IPC_INFO, (struct shmid_ds *) &info, func_info, NULL}, | ||
49 | - {&shm_index, SHM_STAT, &buf, func_sstat, NULL}, | ||
50 | + {&shm_index, SHM_STAT, &buf, func_sstat, func_sstat_setup}, | ||
51 | {&shm_id_1, SHM_LOCK, NULL, func_lock, NULL}, | ||
52 | {&shm_id_1, SHM_UNLOCK, NULL, func_unlock, NULL}, | ||
53 | {&shm_id_1, IPC_RMID, NULL, func_rmid, NULL}, | ||
54 | @@ -407,9 +408,23 @@ static void func_info(int ret) | ||
55 | static void func_sstat(int ret) | ||
56 | { | ||
57 | if (ret >= 0) | ||
58 | - tst_resm(TPASS, "get correct shared memory id"); | ||
59 | + tst_resm(TPASS, "get correct shared memory id for index: %d", | ||
60 | + shm_index); | ||
61 | else | ||
62 | - tst_resm(TFAIL, "shared memory id is incorrect"); | ||
63 | + tst_resm(TFAIL, "shared memory id is incorrect, index: %d", | ||
64 | + shm_index); | ||
65 | +} | ||
66 | + | ||
67 | +static void func_sstat_setup(void) | ||
68 | +{ | ||
69 | + struct shm_info tmp; | ||
70 | + int ret; | ||
71 | + | ||
72 | + ret = shmctl(shm_id_1, SHM_INFO, (void *)&tmp); | ||
73 | + if (ret < 0) | ||
74 | + tst_resm(TFAIL|TERRNO, "shmctl(SHM_INFO)"); | ||
75 | + else | ||
76 | + shm_index = ret; | ||
77 | } | ||
78 | |||
79 | static void func_lock(int ret) | ||
80 | -- | ||
81 | 2.7.4 | ||
82 | |||