Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] setup_tests: Sort variables alphabetically
@ 2025-02-26 14:31 Petr Vorel
  2025-02-26 14:31 ` [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT Petr Vorel
  2025-02-26 14:31 ` [LTP] [PATCH 3/3] ima_setup.sh: Use $TST_REBOOT Petr Vorel
  0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2025-02-26 14:31 UTC (permalink / raw)
  To: ltp

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 doc/users/setup_tests.rst | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/doc/users/setup_tests.rst b/doc/users/setup_tests.rst
index 2766ed719c..ddcf00f027 100644
--- a/doc/users/setup_tests.rst
+++ b/doc/users/setup_tests.rst
@@ -42,18 +42,11 @@ users.
      - Path to the block device to be used. C Language: ``.needs_device = 1``.
        Shell language: ``TST_NEEDS_DEVICE=1``.
 
-   * - LTP_SINGLE_FS_TYPE
-     - Testing only - specifies filesystem instead all supported
-       (for tests with ``.all_filesystems``).
-
    * - LTP_DEV_FS_TYPE
      - Filesystem used for testing (default: ``ext2``).
 
-   * - LTP_TIMEOUT_MUL
-     - Multiplies timeout, must be number >= 0.1 (> 1 is useful for slow
-       machines to avoid unexpected timeout). It's mainly for shell API, which
-       does not have LTP_RUNTIME_MUL. In C API it scales the default 30 sec
-       safety margin, probably LTP_RUNTIME_MUL should be used instead.
+   * - LTP_IMA_LOAD_POLICY
+     - Load IMA example policy, see :master:`testcases/kernel/security/integrity/ima/README.md`.
 
    * - LTP_RUNTIME_MUL
      - Multiplies maximal test iteration runtime. Tests that run for more than a
@@ -61,8 +54,15 @@ users.
        both up and down with this multiplier. This is not yet implemented in the
        shell API.
 
-   * - LTP_IMA_LOAD_POLICY
-     - Load IMA example policy, see :master:`testcases/kernel/security/integrity/ima/README.md`.
+   * - LTP_SINGLE_FS_TYPE
+     - Testing only - specifies filesystem instead all supported
+       (for tests with ``.all_filesystems``).
+
+   * - LTP_TIMEOUT_MUL
+     - Multiplies timeout, must be number >= 0.1 (> 1 is useful for slow
+       machines to avoid unexpected timeout). It's mainly for shell API, which
+       does not have LTP_RUNTIME_MUL. In C API it scales the default 30 sec
+       safety margin, probably LTP_RUNTIME_MUL should be used instead.
 
    * - LTP_VIRT_OVERRIDE
      - Overrides virtual machine detection in the test library. Setting it to
-- 
2.47.2


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT
  2025-02-26 14:31 [LTP] [PATCH 1/3] setup_tests: Sort variables alphabetically Petr Vorel
@ 2025-02-26 14:31 ` Petr Vorel
  2025-02-26 14:33   ` Petr Vorel
  2025-07-16  6:54   ` Petr Vorel
  2025-02-26 14:31 ` [LTP] [PATCH 3/3] ima_setup.sh: Use $TST_REBOOT Petr Vorel
  1 sibling, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2025-02-26 14:31 UTC (permalink / raw)
  To: ltp

Frameworks/tooling which run LTP can schedule reboot based on
environment variable.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
If useful, I should probably add it to C API as well
(at least swapoff01.c and swapon01.c print also "reboot recommended").

 doc/users/setup_tests.rst | 3 +++
 testcases/lib/tst_test.sh | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/users/setup_tests.rst b/doc/users/setup_tests.rst
index ddcf00f027..0cdb86715f 100644
--- a/doc/users/setup_tests.rst
+++ b/doc/users/setup_tests.rst
@@ -85,6 +85,9 @@ users.
    * - LTP_ENABLE_DEBUG
      - Enable debug info (value ``1`` or ``y``). Equivalent of ``-D`` parameter.
 
+   * - TST_REBOOT
+     - Environment variable set by LTP test to signalize that SUT should be rebooted.
+
 Environment variables for network tests
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 See :master:`testcases/network/README.md`.
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 2b797705e3..a450976f36 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -16,6 +16,7 @@ export TST_COUNT=1
 export TST_ITERATIONS=1
 export TST_TMPDIR_RHOST=0
 export TST_LIB_LOADED=1
+export TST_REBOOT=
 
 . tst_ansi_color.sh
 . tst_security.sh
@@ -84,6 +85,10 @@ _tst_do_exit()
 		[ -z "$TST_SKIP_LSM_WARNINGS" ] && _tst_check_security_modules
 	fi
 
+	if [ "$TST_REBOOT" = 1 ]; then
+		tst_res TINFO "WARNING: reboot recommended due test changes"
+	fi
+
 	cat >&2 << EOF
 
 Summary:
@@ -687,7 +692,7 @@ tst_run()
 			CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);;
 			DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);;
 			SKIP_FILESYSTEMS|SKIP_IN_LOCKDOWN|SKIP_IN_SECUREBOOT);;
-			DEVICE_SIZE);;
+			DEVICE_SIZE|REBOOT);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
-- 
2.47.2


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 3/3] ima_setup.sh: Use $TST_REBOOT
  2025-02-26 14:31 [LTP] [PATCH 1/3] setup_tests: Sort variables alphabetically Petr Vorel
  2025-02-26 14:31 ` [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT Petr Vorel
@ 2025-02-26 14:31 ` Petr Vorel
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-02-26 14:31 UTC (permalink / raw)
  To: ltp

Replace test specific $IMA_POLICY_LOADED with shell API specific
$TST_REBOOT.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../kernel/security/integrity/ima/tests/ima_setup.sh      | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
index 1f1c267c4b..79435eb185 100644
--- a/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_setup.sh
@@ -236,9 +236,9 @@ load_ima_policy()
 		tst_brk TCONF "loading unsigned policy failed"
 	fi
 
-	IMA_POLICY_LOADED=1
+	TST_REBOOT=1
 
-	tst_res TINFO "example policy successfully loaded"
+	tst_res TINFO "WARNING: example policy successfully loaded due LTP_IMA_LOAD_POLICY=1, reboot recommended"
 	IMA_FAIL="TFAIL"
 	IMA_BROK="TBROK"
 }
@@ -281,10 +281,6 @@ ima_cleanup()
 	for dir in $UMOUNT; do
 		umount $dir
 	done
-
-	if [ "$IMA_POLICY_LOADED" = 1 ]; then
-		tst_res TINFO "WARNING: policy loaded via LTP_IMA_LOAD_POLICY=1, reboot recommended"
-	fi
 }
 
 set_digest_index()
-- 
2.47.2


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT
  2025-02-26 14:31 ` [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT Petr Vorel
@ 2025-02-26 14:33   ` Petr Vorel
  2025-07-16  6:54   ` Petr Vorel
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-02-26 14:33 UTC (permalink / raw)
  To: ltp

Hi,

> Frameworks/tooling which run LTP can schedule reboot based on
> environment variable.

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> If useful, I should probably add it to C API as well
> (at least swapoff01.c and swapon01.c print also "reboot recommended").

>  doc/users/setup_tests.rst | 3 +++
>  testcases/lib/tst_test.sh | 7 ++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)

> diff --git a/doc/users/setup_tests.rst b/doc/users/setup_tests.rst
> index ddcf00f027..0cdb86715f 100644
> --- a/doc/users/setup_tests.rst
> +++ b/doc/users/setup_tests.rst
> @@ -85,6 +85,9 @@ users.
>     * - LTP_ENABLE_DEBUG
>       - Enable debug info (value ``1`` or ``y``). Equivalent of ``-D`` parameter.

> +   * - TST_REBOOT
> +     - Environment variable set by LTP test to signalize that SUT should be rebooted.

Obviously TST_REBOOT would be then used by frameworks (kirk, openQA, ...).

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT
  2025-02-26 14:31 ` [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT Petr Vorel
  2025-02-26 14:33   ` Petr Vorel
@ 2025-07-16  6:54   ` Petr Vorel
  1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2025-07-16  6:54 UTC (permalink / raw)
  To: ltp

Hi Cyril, all,

> Frameworks/tooling which run LTP can schedule reboot based on
> environment variable.

Cyril, you wanted to add this via struct tst_test (e.g. not using a new variable
in shell). That's indeed better (used by both C API and shell loader + having it
in metadata doc). But for a better integration with external frameworks (e.g.
kirk or openQA) it will still be needed to export some environment variable
(e.g. LTP_REBOOT) to notify the framework for a reboot.

And for IMA tests to be able to use it they will need to be converted to shell
loader (which requires to finish setup/cleanup support for shell loader [1]).
ima_setup.sh use quirk to use a loop device if TMPDIR is on tmpfs (some
IMA measurements are not supported on tmpfs). Because shell loader's struct
tst_test in JSON is not modifiable I will have to use always a loop device
(slower) and force some filesystem (previously tests were run on the filesystem
installed on TMPDIR, e.g. test on the filesystem chosen by distro/user).

Setting this whole patchset in patchwork as rejected.

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/list/?series=460106&state=*

> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> If useful, I should probably add it to C API as well
> (at least swapoff01.c and swapon01.c print also "reboot recommended").

>  doc/users/setup_tests.rst | 3 +++
>  testcases/lib/tst_test.sh | 7 ++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)

> diff --git a/doc/users/setup_tests.rst b/doc/users/setup_tests.rst
> index ddcf00f027..0cdb86715f 100644
> --- a/doc/users/setup_tests.rst
> +++ b/doc/users/setup_tests.rst
> @@ -85,6 +85,9 @@ users.
>     * - LTP_ENABLE_DEBUG
>       - Enable debug info (value ``1`` or ``y``). Equivalent of ``-D`` parameter.

> +   * - TST_REBOOT
> +     - Environment variable set by LTP test to signalize that SUT should be rebooted.
> +
>  Environment variables for network tests
>  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  See :master:`testcases/network/README.md`.
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 2b797705e3..a450976f36 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -16,6 +16,7 @@ export TST_COUNT=1
>  export TST_ITERATIONS=1
>  export TST_TMPDIR_RHOST=0
>  export TST_LIB_LOADED=1
> +export TST_REBOOT=

>  . tst_ansi_color.sh
>  . tst_security.sh
> @@ -84,6 +85,10 @@ _tst_do_exit()
>  		[ -z "$TST_SKIP_LSM_WARNINGS" ] && _tst_check_security_modules
>  	fi

> +	if [ "$TST_REBOOT" = 1 ]; then
> +		tst_res TINFO "WARNING: reboot recommended due test changes"
> +	fi

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-16  6:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 14:31 [LTP] [PATCH 1/3] setup_tests: Sort variables alphabetically Petr Vorel
2025-02-26 14:31 ` [LTP] [RFC][PATCH 2/3] tst_test: Allow test to suggest reboot via $TST_REBOOT Petr Vorel
2025-02-26 14:33   ` Petr Vorel
2025-07-16  6:54   ` Petr Vorel
2025-02-26 14:31 ` [LTP] [PATCH 3/3] ima_setup.sh: Use $TST_REBOOT Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox