* [LTP] [PATCH v2 1/2] tst_test.sh: Fix TBROK => TWARN evaluation in tst_brk()
@ 2025-02-11 20:57 Petr Vorel
2025-02-11 20:57 ` [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2025-02-11 20:57 UTC (permalink / raw)
To: ltp
From: Petr Vorel <petr.vorel@gmail.com>
This partly reverts commit 55bfa08e179de16773f19b703de70262896383ea
and setting TST_DO_EXIT=1 before _tst_do_cleanup() and unset it
afterwards inside of the _tst_run_iterations().
Also rename variable to be more descriptive: TST_DO_EXIT => TST_TBROK_TO_TWARN.
This fixes e.g. problem with not exiting test on too small $TMPDIR.
Before the fix:
# ./nfs10.sh -v 3 -t udp
nfs10 1 TINFO: Running: nfs10.sh -v 3 -t udp
...
nfs10 1 TINFO: Using /tmp/LTP_nfs10.LWDMqeJ74S as tmpdir (tmpfs filesystem)
tst_device.c:299: TWARN: Failed to create test_dev.img: ENOSPC (28)
Usage:
tst_device acquire [size [filename]]
tst_device release /path/to/device
tst_device clear /path/to/device
nfs10 1 TWARN: Failed to acquire device
tst_supported_fs_types.c:169: TINFO: Skipping ext2 as requested by the test
tst_supported_fs_types.c:169: TINFO: Skipping ext3 as requested by the test
tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
...
nfs10 1 TINFO: === Testing on ext4 ===
tst_device.c:389: TWARN: Failed to clear 512k block on
Usage:
tst_device acquire [size [filename]]
tst_device release /path/to/device
tst_device clear /path/to/device
nfs10 1 TINFO: Formatting ext4 with opts=''
Usage: mkfs.ext4 [-c|-l filename] [-b block-size] [-C cluster-size]
[-i bytes-per-inode] [-I inode-size] [-J journal-options]
[-G flex-group-size] [-N number-of-inodes] [-d root-directory]
[-m reserved-blocks-percentage] [-o creator-os]
[-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
[-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
[-t fs-type] [-T usage-type ] [-U UUID] [-e errors_behavior][-z undo_file]
[-jnqvDFSV] device [blocks-count]
nfs10 1 TWARN: mkfs.ext4 failed
nfs10 1 TINFO: Mounting device: mount -t ext4 /tmp/LTP_nfs10.LWDMqeJ74S/mntpoint
mount: /tmp/LTP_nfs10.LWDMqeJ74S/mntpoint: can't find in /etc/fstab.
nfs10 1 TWARN: Failed to mount device ext4 type: mount exit = 1
nfs10 1 TINFO: timeout per run is 0h 11m 0s
nfs10 1 TCONF: rpc.mountd not running
nfs10 1 TINFO: Cleaning up testcase
nfs10 1 TINFO: The '/tmp/LTP_nfs10.LWDMqeJ74S/mntpoint' is not mounted, skipping umount
tst_device.c:281: TWARN: open() failed: ENOENT (2)
Usage:
tst_device acquire [size [filename]]
tst_device release /path/to/device
tst_device clear /path/to/device
nfs10 1 TWARN: Failed to release device ''
nfs10 1 TINFO: AppArmor enabled, this may affect test results
nfs10 1 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root)
nfs10 1 TINFO: loaded AppArmor profiles: none
After the fix:
# ./nfs10.sh -v 3 -t udp
nfs10 1 TINFO: Running: nfs10.sh -v 3 -t udp
...
nfs10 1 TINFO: Using /tmp/LTP_nfs10.34K5E5pjxY as tmpdir (tmpfs filesystem)
tst_device.c:299: TWARN: Failed to create test_dev.img: ENOSPC (28)
Usage:
tst_device acquire [size [filename]]
tst_device release /path/to/device
tst_device clear /path/to/device
nfs10 1 TBROK: Failed to acquire device
nfs10 1 TINFO: AppArmor enabled, this may affect test results
nfs10 1 TINFO: it can be disabled with TST_DISABLE_APPARMOR=1 (requires super/root)
nfs10 1 TINFO: loaded AppArmor profiles: none
Fixes: 55bfa08e17 ("tst_test.sh/tst_brk(): Convert only TBROK to TWARN in cleanup")
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
v1: https://patchwork.ozlabs.org/project/ltp/patch/20241211001418.392890-1-pvorel@suse.cz/
Changes v1-v2:
* set guarder in _tst_do_cleanup() (Cyril)
* rename variable (Cyril)
testcases/lib/tst_test.sh | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 2b797705e3..5a6e34473f 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -28,7 +28,6 @@ _tst_do_cleanup()
{
if [ -n "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" -a -z "$LTP_NO_CLEANUP" ]; then
if command -v $TST_CLEANUP >/dev/null 2>/dev/null; then
- TST_DO_CLEANUP=
$TST_CLEANUP
else
tst_res TWARN "TST_CLEANUP=$TST_CLEANUP declared, but function not defined (or cmd not found)"
@@ -40,7 +39,7 @@ _tst_do_cleanup()
_tst_do_exit()
{
local ret=0
- TST_DO_EXIT=1
+ TST_TBROK_TO_TWARN=1
_tst_do_cleanup
@@ -127,15 +126,11 @@ tst_brk()
local res=$1
shift
- # TBROK => TWARN on cleanup or exit
- if [ "$res" = TBROK ] && [ "$TST_DO_EXIT" = 1 -o -z "$TST_DO_CLEANUP" -a -n "$TST_CLEANUP" ]; then
- tst_res TWARN "$@"
- TST_DO_CLEANUP=
- return
- fi
-
if [ "$res" != TBROK -a "$res" != TCONF ]; then
tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res)"
+ elif [ "$TST_TBROK_TO_TWARN" = 1 ]; then
+ tst_res TWARN "$@"
+ return
else
tst_res "$res" "$@"
fi
@@ -820,7 +815,9 @@ _tst_run_iterations()
_tst_i=$((_tst_i-1))
done
+ TST_TBROK_TO_TWARN=1
_tst_do_cleanup
+ unset TST_TBROK_TO_TWARN
if [ "$TST_MOUNT_FLAG" = 1 ]; then
cd "$LTPROOT"
--
2.47.2
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup
2025-02-11 20:57 [LTP] [PATCH v2 1/2] tst_test.sh: Fix TBROK => TWARN evaluation in tst_brk() Petr Vorel
@ 2025-02-11 20:57 ` Petr Vorel
2025-12-18 12:43 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2025-02-11 20:57 UTC (permalink / raw)
To: ltp
Second attempt to convert only TBROK/TCONF to TWARN in cleanup().
Also print original message to help find function call with wrong
parameter.
Fixes: 55bfa08e17 ("tst_test.sh/tst_brk(): Convert only TBROK to TWARN in cleanup")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2.
testcases/lib/tst_test.sh | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 5a6e34473f..0747f7aaf4 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -126,11 +126,17 @@ tst_brk()
local res=$1
shift
- if [ "$res" != TBROK -a "$res" != TCONF ]; then
- tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res)"
- elif [ "$TST_TBROK_TO_TWARN" = 1 ]; then
- tst_res TWARN "$@"
+ if [ "$TST_TBROK_TO_TWARN" = 1 ]; then
+ if [ "$res" != TBROK -a "$res" != TCONF ]; then
+ tst_res TWARN "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
+ else
+ tst_res TWARN "$@"
+ fi
return
+ fi
+
+ if [ "$res" != TBROK -a "$res" != TCONF ]; then
+ tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
else
tst_res "$res" "$@"
fi
--
2.47.2
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup
2025-02-11 20:57 ` [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup Petr Vorel
@ 2025-12-18 12:43 ` Andrea Cervesato via ltp
2026-01-05 14:24 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Andrea Cervesato via ltp @ 2025-12-18 12:43 UTC (permalink / raw)
To: Petr Vorel, ltp
Hi!
On Tue Feb 11, 2025 at 9:57 PM CET, Petr Vorel wrote:
> Second attempt to convert only TBROK/TCONF to TWARN in cleanup().
>
> Also print original message to help find function call with wrong
> parameter.
>
> Fixes: 55bfa08e17 ("tst_test.sh/tst_brk(): Convert only TBROK to TWARN in cleanup")
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> New in v2.
>
> testcases/lib/tst_test.sh | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
> index 5a6e34473f..0747f7aaf4 100644
> --- a/testcases/lib/tst_test.sh
> +++ b/testcases/lib/tst_test.sh
> @@ -126,11 +126,17 @@ tst_brk()
> local res=$1
> shift
>
> - if [ "$res" != TBROK -a "$res" != TCONF ]; then
> - tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res)"
> - elif [ "$TST_TBROK_TO_TWARN" = 1 ]; then
> - tst_res TWARN "$@"
> + if [ "$TST_TBROK_TO_TWARN" = 1 ]; then
> + if [ "$res" != TBROK -a "$res" != TCONF ]; then
> + tst_res TWARN "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
> + else
> + tst_res TWARN "$@"
> + fi
> return
> + fi
> +
> + if [ "$res" != TBROK -a "$res" != TCONF ]; then
> + tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
> else
> tst_res "$res" "$@"
> fi
Here there's a bit of code duplication. For instance, we can save the
message inside a variable, as well as the T-flag, the use it accordingly
to TST_TBROK_TO_TWARN.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup
2025-12-18 12:43 ` Andrea Cervesato via ltp
@ 2026-01-05 14:24 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2026-01-05 14:24 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi Andrea,
...
> > + if [ "$TST_TBROK_TO_TWARN" = 1 ]; then
> > + if [ "$res" != TBROK -a "$res" != TCONF ]; then
> > + tst_res TWARN "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
> > + else
> > + tst_res TWARN "$@"
> > + fi
> > return
> > + fi
> > +
> > + if [ "$res" != TBROK -a "$res" != TCONF ]; then
> > + tst_res TBROK "tst_brk can be called only with TBROK or TCONF ($res, msg: '$@')"
> > else
> > tst_res "$res" "$@"
> > fi
> Here there's a bit of code duplication. For instance, we can save the
> message inside a variable, as well as the T-flag, the use it accordingly
> to TST_TBROK_TO_TWARN.
Sure, this could be done, but as for other tst_test.sh modifications: unless
it's an important fix I'd not touch it as we now have a shell loader. Again,
I'm sorry to waste your time for the review.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-05 14:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 20:57 [LTP] [PATCH v2 1/2] tst_test.sh: Fix TBROK => TWARN evaluation in tst_brk() Petr Vorel
2025-02-11 20:57 ` [LTP] [PATCH v2 2/2] tst_test.sh: Convert only TBROK/TCONF to TWARN in cleanup Petr Vorel
2025-12-18 12:43 ` Andrea Cervesato via ltp
2026-01-05 14:24 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox