* [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM'
@ 2025-06-27 10:29 Cyril Hrubis
2025-06-27 10:29 ` [LTP] [PATCH 2/2] tst_test.sh: Fix IPC init for checkpoints Cyril Hrubis
2025-06-27 10:36 ` [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM' Li Wang via ltp
0 siblings, 2 replies; 5+ messages in thread
From: Cyril Hrubis @ 2025-06-27 10:29 UTC (permalink / raw)
To: ltp
Since the 'LTPM' string is encoded in an integer the order of the
letters depends on machine endianity. On little endian it was actually
spelled backwards i.e. 'MPTL'.
This patch fixes that by making sure that the bytes are in the right
order.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
lib/tst_test.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 495e022f7..17ce91932 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -52,7 +52,13 @@ const char *TCID __attribute__((weak));
#define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
#define DEFAULT_TIMEOUT 30
-#define LTP_MAGIC 0x4C54504D /* Magic number is "LTPM" */
+
+/* Magic number is "LTPM" */
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define LTP_MAGIC 0x4C54504D
+#else
+# define LTP_MAGIC 0x4D50544C
+#endif
struct tst_test *tst_test;
--
2.49.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH 2/2] tst_test.sh: Fix IPC init for checkpoints
2025-06-27 10:29 [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM' Cyril Hrubis
@ 2025-06-27 10:29 ` Cyril Hrubis
2025-06-27 19:38 ` Avinesh Kumar
2025-06-27 10:36 ` [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM' Li Wang via ltp
1 sibling, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2025-06-27 10:29 UTC (permalink / raw)
To: ltp
The introduction of magic at the start of the LTP IPC region did break
the checkpoints for the tst_test.sh shell library. The reason is that
the library creates the IPC backing file with dd and the magic wasn't
present there.
This introduced failures in the pec testcases:
cn_pec 1 TINFO: Test process events connector
cn_pec 1 TINFO: Testing fork event (nevents=10)
tst_test.c:203: TBROK: Invalid shared memory region (bad magic)
cn_pec 1 TBROK: tst_checkpoint wait 10000 0 failed
This patch fixes the tst_test.sh library so that the IPC region is
created with a correct magic.
Follow-up: bf9589d5bd ("lib: moves test infrastructure states into a shared context structure")
Reported-by: Avinesh Kumar <akumar@suse.de>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/lib/tst_test.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index c32bd8b19..4be10a4f9 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -627,6 +627,7 @@ _tst_init_checkpoints()
tst_brk TBROK "tst_getconf PAGESIZE failed"
fi
ROD_SILENT dd if=/dev/zero of="$LTP_IPC_PATH" bs="$pagesize" count=1
+ ROD_SILENT "printf LTPM | dd of="$LTP_IPC_PATH" bs=1 seek=0 conv=notrunc"
ROD_SILENT chmod 600 "$LTP_IPC_PATH"
export LTP_IPC_PATH
}
--
2.49.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH 2/2] tst_test.sh: Fix IPC init for checkpoints
2025-06-27 10:29 ` [LTP] [PATCH 2/2] tst_test.sh: Fix IPC init for checkpoints Cyril Hrubis
@ 2025-06-27 19:38 ` Avinesh Kumar
2025-06-30 8:45 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Avinesh Kumar @ 2025-06-27 19:38 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi,
Tested-by: Avinesh Kumar <akumar@suse.de>
cn_pec 1 TINFO: Running: cn_pec.sh
cn_pec 1 TINFO: Tested kernel: Linux susetest 6.15.3-1-default #1 SMP PREEMPT_DYNAMIC Sat Jun 21 19:19:18 UTC 2025 (d7f7d34) x86_64 x86_64 x86_64 GNU/Linux
cn_pec 1 TINFO: Using /tmp/LTP_cn_pec.Gsup5b4iUP as tmpdir (tmpfs filesystem)
cn_pec 1 TINFO: timeout per run is 0h 5m 0s
cn_pec 1 TINFO: Test process events connector
cn_pec 1 TINFO: Testing fork event (nevents=10)
cn_pec 1 TPASS: All events detected
cn_pec 2 TINFO: Testing exec event (nevents=10)
cn_pec 2 TPASS: All events detected
cn_pec 3 TINFO: Testing exit event (nevents=10)
cn_pec 3 TPASS: All events detected
cn_pec 4 TINFO: Testing uid event (nevents=10)
cn_pec 4 TPASS: All events detected
cn_pec 5 TINFO: Testing gid event (nevents=10)
cn_pec 5 TPASS: All events detected
Regards,
Avinesh
On Friday, June 27, 2025 12:29:57 PM CEST Cyril Hrubis wrote:
> The introduction of magic at the start of the LTP IPC region did break
> the checkpoints for the tst_test.sh shell library. The reason is that
> the library creates the IPC backing file with dd and the magic wasn't
> present there.
>
> This introduced failures in the pec testcases:
>
> cn_pec 1 TINFO: Test process events connector
> cn_pec 1 TINFO: Testing fork event (nevents=10)
> tst_test.c:203: TBROK: Invalid shared memory region (bad magic)
> cn_pec 1 TBROK: tst_checkpoint wait 10000 0 failed
>
> This patch fixes the tst_test.sh library so that the IPC region is
> created with a correct magic.
>
> Follow-up: bf9589d5bd ("lib: moves test infrastructure states into a shared context structure")
> Reported-by: Avinesh Kumar <akumar@suse.de>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
> testcases/lib/tst_test.sh | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index c32bd8b19..4be10a4f9 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -627,6 +627,7 @@ _tst_init_checkpoints()
> tst_brk TBROK "tst_getconf PAGESIZE failed"
> fi
> ROD_SILENT dd if=/dev/zero of="$LTP_IPC_PATH" bs="$pagesize" count=1
> + ROD_SILENT "printf LTPM | dd of="$LTP_IPC_PATH" bs=1 seek=0 conv=notrunc"
> ROD_SILENT chmod 600 "$LTP_IPC_PATH"
> export LTP_IPC_PATH
> }
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM'
2025-06-27 10:29 [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM' Cyril Hrubis
2025-06-27 10:29 ` [LTP] [PATCH 2/2] tst_test.sh: Fix IPC init for checkpoints Cyril Hrubis
@ 2025-06-27 10:36 ` Li Wang via ltp
1 sibling, 0 replies; 5+ messages in thread
From: Li Wang via ltp @ 2025-06-27 10:36 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
On Fri, Jun 27, 2025 at 6:29 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Since the 'LTPM' string is encoded in an integer the order of the
> letters depends on machine endianity. On little endian it was actually
> spelled backwards i.e. 'MPTL'.
>
> This patch fixes that by making sure that the bytes are in the right
> order.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
>
This is cleaner than my patchset, thanks!
For two patches:
Acked-by: Li Wang <liwang@redhat.com>
---
> lib/tst_test.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index 495e022f7..17ce91932 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -52,7 +52,13 @@ const char *TCID __attribute__((weak));
> #define CVE_DB_URL "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
>
> #define DEFAULT_TIMEOUT 30
> -#define LTP_MAGIC 0x4C54504D /* Magic number is "LTPM" */
> +
> +/* Magic number is "LTPM" */
> +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
> +# define LTP_MAGIC 0x4C54504D
> +#else
> +# define LTP_MAGIC 0x4D50544C
> +#endif
>
> struct tst_test *tst_test;
>
> --
> 2.49.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-06-30 8:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27 10:29 [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM' Cyril Hrubis
2025-06-27 10:29 ` [LTP] [PATCH 2/2] tst_test.sh: Fix IPC init for checkpoints Cyril Hrubis
2025-06-27 19:38 ` Avinesh Kumar
2025-06-30 8:45 ` Cyril Hrubis
2025-06-27 10:36 ` [LTP] [PATCH 1/2] lib: tst_test: Make IPC magic spells 'LTPM' Li Wang via ltp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.