<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Petr,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 15, 2021 at 2:32 AM Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Instead of relying that there is mkfs.ext2 as a backup,<br>
search for supported default.<br>
<br>
Always check ext2 (in case there is enough space for btrfs but<br>
no mkfs.btrfs).<br>
<br>
This fixes error when even the default ext2 is not supported:<br>
<br>
zram01 5 TINFO: make ext2 filesystem on /dev/zram0<br>
/opt/ltp/testcases/bin/zram01.sh: line 188: mkfs.ext2: not found<br>
zram01 5 TFAIL: failed to make ext2 on /dev/zram0<br>
<br>
Signed-off-by: Petr Vorel <<a href="mailto:pvorel@suse.cz" target="_blank">pvorel@suse.cz</a>><br>
---<br>
Hi,<br>
<br>
fix to be merged before release.<br>
<br>
NOTE: Bug affecting BusyBox needs to be discussed:<br>
<a href="http://lists.linux.it/pipermail/ltp/2021-January/020568.html" rel="noreferrer" target="_blank">http://lists.linux.it/pipermail/ltp/2021-January/020568.html</a><br>
<br>
Kind regards,<br>
Petr<br>
<br>
.../kernel/device-drivers/zram/zram_lib.sh | 21 +++++++++++++++++--<br>
1 file changed, 19 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/testcases/kernel/device-drivers/zram/zram_lib.sh b/testcases/kernel/device-drivers/zram/zram_lib.sh<br>
index 3f4d1d55f..1a611b974 100755<br>
--- a/testcases/kernel/device-drivers/zram/zram_lib.sh<br>
+++ b/testcases/kernel/device-drivers/zram/zram_lib.sh<br>
@@ -178,13 +178,30 @@ zram_swapoff()<br>
zram_makefs()<br>
{<br>
tst_require_cmds mkfs<br>
+<br>
+ local default_fs fs<br>
local i=0<br>
<br>
+ for fs in $zram_filesystems ext2; do<br>
+ if tst_supported_fs $fs 2> /dev/null; then<br>
+ default_fs="$fs"<br>
+ break<br>
+ fi<br>
+ done<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">This workaround makes some sense but a bit overlap to <span style="color:rgb(51,51,51);font-size:14px">traverse</span> $zram_filesystems.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Maybe we can remove the unsupported filesystems from $zram_filesystems</div><div class="gmail_default" style="font-size:small">list via tst_supported_fs and <span class="gmail_default"></span>tst_cmd_available, to avoid involving that additional</div><div class="gmail_default" style="font-size:small">variable 'default_fs', then in following test if $zram_filesystems is a null string</div><div class="gmail_default" style="font-size:small">just exit with TCONF directly?</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ if [ -z "$default_fs" ]; then<br>
+ tst_res TINFO "supported filesystems"<br>
+ tst_supported_fs > /dev/null<br>
+ tst_brk TCONF "missing kernel support or mkfs for all of these filesystems: $zram_filesystems"<br>
+ fi<br>
+<br>
for fs in $zram_filesystems; do<br>
- # if requested fs not supported default it to ext2<br>
- tst_supported_fs $fs 2> /dev/null || fs=ext2<br>
+ # use default if requested fs not supported or missing mkfs<br>
+ tst_supported_fs $fs 2> /dev/null && <span class="gmail_default" style="font-size:small"></span>tst_cmd_available mkfs.$fs \<br>
+ || fs=$default_fs<br>
<br>
tst_res TINFO "make $fs filesystem on /dev/zram$i"<br>
+<br>
mkfs.$fs /dev/zram$i > err.log 2>&1<br>
if [ $? -ne 0 ]; then<br>
cat err.log<br>
-- <br>
2.29.2<br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>