public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] zram/zram_lib.sh: Check fielsystem support more throughly
Date: Wed, 18 Jul 2018 14:46:38 +0200	[thread overview]
Message-ID: <20180718124638.GD7117@rei> (raw)
In-Reply-To: <1531299325-27779-1-git-send-email-yangx.jy@cn.fujitsu.com>

Hi!
> +zram_check_fs_support()
> +{
> +	tst_check_cmds which modprobe
> +	local filesystem=$1
> +
> +	# Check if mkfs command supports fs
> +	which mkfs.$filesystem > /dev/null 2>&1 || return 1
> +
> +	# Check if kernel supports fs
> +	if ! grep -qw $filesystem /proc/filesystems; then

Actually grepping /proc/filesystems is not enough to figure out if
filesystem is supported or not, since for example ext2 and ext3 are
handled with ext4 these days.

But happily we do already have all the code in tst_supported_fs_types.c
in the test library, we all that is needed to to do is to create a C
helper on the top of tst_get_supported_fs_types() function that returns
array of supported filesystems. So we can write a small helper binary on
the top of that.

I would be for adding a tst_supported_fs binary into the testcases/lib/
that would, without any parameter print the list of supported
filesystems into the stdout. and if passed a fs type as a parameter
would use return value to indicate if the filesystem is supported or
not.

> +		modprobe $filesystem > /dev/null 2>&1 || return 1
> +	fi
> +}
> +
>  zram_makefs()
>  {
> -	tst_check_cmds mkfs which
> +	tst_check_cmds mkfs
>  	local i=0
>  	for fs in $zram_filesystems; do
>  		# if requested fs not supported default it to ext2
> -		which mkfs.$fs > /dev/null 2>&1 || fs=ext2
> +		zram_check_fs_support $fs || fs=ext2
>  
>  		tst_resm TINFO "make $fs filesystem on /dev/zram$i"
>  		mkfs.$fs /dev/zram$i > err.log 2>&1
> -- 
> 1.8.3.1
> 
> 
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2018-07-18 12:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11  8:55 [LTP] [PATCH] zram/zram_lib.sh: Check fielsystem support more throughly Xiao Yang
2018-07-18 12:46 ` Cyril Hrubis [this message]
2018-07-19  7:31   ` [LTP] [PATCH v2 1/2] lib: Factor out is_supported() && Add tst_supported_fs for shell Xiao Yang
2018-07-19  7:31     ` [LTP] [PATCH v2 2/2] zram/zram_lib.sh: Apply " Xiao Yang
2018-07-19 12:27       ` Cyril Hrubis
2018-07-19 12:21     ` [LTP] [PATCH v2 1/2] lib: Factor out is_supported() && Add " Cyril Hrubis
2018-07-20 10:40       ` [LTP] [PATCH v3 1/2] lib: Factor out is_supported() && Add tst_supported_fs Xiao Yang
2018-07-20 10:40         ` [LTP] [PATCH v3 2/2] zram/zram_lib.sh: Apply tst_supported_fs for shell Xiao Yang
2018-07-23 14:52         ` [LTP] [PATCH v3 1/2] lib: Factor out is_supported() && Add tst_supported_fs Cyril Hrubis
2018-07-19 12:27     ` [LTP] [PATCH v2 1/2] lib: Factor out is_supported() && Add tst_supported_fs for shell Cyril Hrubis

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=20180718124638.GD7117@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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