[LTP] syscalls/shmget: Add shmget07 to test SHM_HUGETLB with raw device read

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Sat Sep 19 19:56:19 CEST 2026


Hi Pavithra,

On Sat Sep 19 20:46:02 2026 +0530, Pavithra <pavrampu@linux.ibm.com> wrote:
> syscalls/shmget: Add shmget07 to test SHM_HUGETLB with raw device read

This test exercises hugetlb shared memory functionality rather than the
shmget syscall itself. Move this test to
testcases/kernel/mem/hugetlb/hugeshmget/ and rename it (e.g. hugeshmget07).
Also, replace "raw device" with /dev/zero as /dev/zero is a character
device, not a raw device.

> diff --git a/runtest/syscalls b/runtest/syscalls
> --- a/runtest/syscalls
> +++ b/runtest/syscalls
> @@ -1596,3 +1596,4 @@ shmget06 shmget06
> +shmget07 shmget07

Move this entry to runtest/hugetlb alongside the other hugeshmget tests
instead of runtest/syscalls.

> + * from :file:`/dev/zero` directly into the shared memory region,

Replace :file:`/dev/zero` with ``/dev/zero``. :file: is not a supported
documentation role in LTP.

> +#include "tst_test.h"
> +#include "tst_hugepage.h"

Remove "tst_hugepage.h" as it is already included by "tst_test.h".

> +	shmid = SAFE_SHMGET(IPC_PRIVATE, size, SHM_HUGETLB|SHM_R|SHM_W);

Add spaces around the '|' operators to follow kernel coding style.

> +	for (i = 0; i < size; i += hpage_size) {
> +		TEST(read(raw_fd, shmaddr + i, hpage_size));
> +		if (TST_RET != hpage_size) {
> +			tst_res(TFAIL | TERRNO, "Can't read full page from raw device!");
> +			break;
> +		}
> +		tst_res(TPASS, "Read full page from raw device");
> +	}

Replace manual TEST() and if/else reporting with:
TST_EXP_VAL(read(raw_fd, shmaddr + i, hpage_size), (ssize_t)hpage_size);
Also, update the message to refer to /dev/zero instead of "raw device".

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list