[LTP] [PATCH 1/5] tst_test.sh: Add $TST_DEFAULT_FS_TYPE
Petr Vorel
pvorel@suse.cz
Tue Feb 8 19:20:33 CET 2022
Hi Cyril,
> > +export TST_DEFAULT_FS_TYPE="ext2"
> Actually if we wanted to sync with the C library it should be:
> if [ -z "$TST_FS_TYPE" ]; then
> if [ -n "$LTP_DEV_FS_TYPE" ]; then
> export TST_FS_TYPE="$LTP_DEV_FS_TYPE"
> else
> export TST_FS_TYPE="ext2"
> fi
> fi
Ah, I forget on $LTP_DEV_FS_TYPE, thanks.
nit: or shorter
if [ -z "$TST_FS_TYPE" ]; then
export TST_FS_TYPE="${LTP_DEV_FS_TYPE:-ext2}"
fi
> That's equivalent of the .dev_fs_type in the tst_test structure as we
> do:
> if (tst_test->dev_fs_type)
> tdev.fs_type = tst_test->dev_fs_type;
> else
> tdev.fs_type = tst_dev_fs_type();
> And the tst_dev_fs_type() returns either $LTP_DEV_FS_TYPE or "ext2" if
> it's not defined.
BTW I meant TST_DEFAULT_FS_TYPE="ext2" as equivalent of
#define DEFAULT_FS_TYPE "ext2"
from include/tst_defaults.h.
Because df01.sh help uses hardcoded ext2:
@@ -23,13 +23,11 @@ usage: $0 [-f <ext2|ext3|ext4|vfat|...>]
OPTIONS
-f Specify the type of filesystem to be built. If not
- specified, the default filesystem type (currently ext2)
+ specified, the default filesystem type (currently $TST_DEFAULT_FS_TYPE)
is used.
Thus it'd be:
export TST_DEFAULT_FS_TYPE="ext2"
if [ -z "$TST_FS_TYPE" ]; then
export TST_FS_TYPE="${LTP_DEV_FS_TYPE:-$TST_DEFAULT_FS_TYPE}"
fi
But it's very minor, shell is different than C, we don't have to have variable
for everything.
Kind regards,
Petr
More information about the ltp
mailing list