public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 5/5] Add test for data integrity over NFS
Date: Mon, 4 Nov 2024 14:32:47 +0100	[thread overview]
Message-ID: <ZyjM_1iwp58EbHwh@yuki.lan> (raw)
In-Reply-To: <ZyjJ9iywT4boYavJ@yuki.lan>

Hi!
> I will think a bit how to integrate things better, because having LTP
> test inside LTP test will never work well.

So one posibility is to use the new shell test library that integrates
cleanly with C, then we can have a shell nfs test that runs for all
filesystems, mounts the nfs and then runs the C fsplough itself.

Minimal example how to do that is:

From b48184d4fa1918afe6c84d0e691f8d46c986e92c Mon Sep 17 00:00:00 2001
From: Cyril Hrubis <chrubis@suse.cz>
Date: Mon, 4 Nov 2024 14:29:24 +0100
Subject: [PATCH] shell lib: Add example how to run C child

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/lib/run_tests.sh                  |  2 +-
 testcases/lib/tests/.gitignore              |  1 +
 testcases/lib/tests/shell_c_child.c         | 16 ++++++++++++++
 testcases/lib/tests/shell_loader_c_child.sh | 24 +++++++++++++++++++++
 4 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 testcases/lib/tests/shell_c_child.c
 create mode 100755 testcases/lib/tests/shell_loader_c_child.sh

diff --git a/testcases/lib/run_tests.sh b/testcases/lib/run_tests.sh
index 8ea615f96..40d415e6c 100755
--- a/testcases/lib/run_tests.sh
+++ b/testcases/lib/run_tests.sh
@@ -14,7 +14,7 @@ for i in shell_loader.sh shell_loader_all_filesystems.sh shell_loader_no_metadat
 	 shell_loader_wrong_metadata.sh shell_loader_invalid_metadata.sh\
 	 shell_loader_supported_archs.sh shell_loader_filesystems.sh\
 	 shell_loader_tcnt.sh shell_loader_kconfigs.sh shell_loader_tags.sh \
-	 shell_loader_invalid_block.sh; do
+	 shell_loader_invalid_block.sh shell_loader_c_child.sh; do
 	echo
 	echo "*** Running $i ***"
 	echo
diff --git a/testcases/lib/tests/.gitignore b/testcases/lib/tests/.gitignore
index da967c4d6..e9e163d13 100644
--- a/testcases/lib/tests/.gitignore
+++ b/testcases/lib/tests/.gitignore
@@ -4,3 +4,4 @@ shell_test03
 shell_test04
 shell_test05
 shell_test06
+shell_c_child
diff --git a/testcases/lib/tests/shell_c_child.c b/testcases/lib/tests/shell_c_child.c
new file mode 100644
index 000000000..fda5133a6
--- /dev/null
+++ b/testcases/lib/tests/shell_c_child.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Shell test C child example.
+ */
+
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+
+int main(void)
+{
+	tst_reinit();
+
+	tst_res(TPASS, "C child works fine!");
+
+	return 0;
+}
diff --git a/testcases/lib/tests/shell_loader_c_child.sh b/testcases/lib/tests/shell_loader_c_child.sh
new file mode 100755
index 000000000..d190be6e2
--- /dev/null
+++ b/testcases/lib/tests/shell_loader_c_child.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# ---
+# doc
+#
+# [Description]
+#
+# This is an example how to run C child from shell.
+# ---
+#
+# ---
+# env
+# {
+# }
+# ---
+
+. tst_loader.sh
+
+if [ -n "LTP_IPC_PATH" ]; then
+	tst_res TPASS "LTP_IPC_PATH=$LTP_IPC_PATH!"
+fi
+
+tst_res TINFO "Running C child"
+shell_c_child

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-11-04 13:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 14:11 [LTP] [PATCH 0/5] Add LVM and NFS tests for file data integrity Martin Doucha
2024-11-01 14:11 ` [LTP] [PATCH 1/5] Move preadv()/pwritev() backup definitions to LAPI Martin Doucha
2024-11-01 22:40   ` Petr Vorel
2024-11-01 14:11 ` [LTP] [PATCH 2/5] Add safe readv()/writev() functions Martin Doucha
2024-11-01 14:11 ` [LTP] [PATCH 3/5] Add test for file data integrity Martin Doucha
2024-12-04 13:45   ` Cyril Hrubis
2024-12-04 14:39     ` Martin Doucha
2024-11-01 14:11 ` [LTP] [PATCH 4/5] Add support for setting loop device size in shell tests Martin Doucha
2024-11-01 22:45   ` Petr Vorel
2024-11-28  8:19     ` Petr Vorel
2024-11-01 14:11 ` [LTP] [PATCH 5/5] Add test for data integrity over NFS Martin Doucha
2024-11-01 23:32   ` Petr Vorel
2024-11-04 13:05     ` Cyril Hrubis
2024-11-04 13:19       ` Cyril Hrubis
2024-11-04 13:32         ` Cyril Hrubis [this message]
2024-11-04 15:59           ` Petr Vorel
2024-11-12 21:23             ` Petr Vorel
2024-11-13 13:44               ` Cyril Hrubis
2024-11-04 14:16       ` Petr Vorel
2024-11-12 12:50     ` Martin Doucha
2024-11-12 21:40       ` Petr Vorel
2024-11-13 14:02         ` Martin Doucha
2024-11-13 14:50           ` Petr Vorel
2024-11-13 13:48       ` Cyril Hrubis
2024-11-28  8:27     ` Petr Vorel

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=ZyjM_1iwp58EbHwh@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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