public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH 3/3] zram/zram03: Convert into new api
Date: Fri, 10 Dec 2021 11:06:24 +0000	[thread overview]
Message-ID: <61B334D8.7000200@fujitsu.com> (raw)
In-Reply-To: <61B33253.2070105@fujitsu.com>

Hi Petr
> Hi Petr
>> Hi Xu,
>>
>>> Also add removing zram module step in setup, so we can avoid the situation that
>>> zram module is being used by zram-generator.
>>
>> ...
>>> +++ b/testcases/kernel/device-drivers/zram/zram03.c
>> ...
>>> +static const char *const cmd_rmmod[] = {"rmmod", "zram", NULL};
>>
>> Again, here should be lsmod used.
> I prefer to detect it in /proc/modules.
> What do you think about it?
Since we have require modprobe/rmmod commands, using lsmod is better. I 
will use lsmod as you suggested.
.>>
>> Except this LGTM.
>> Reviewed-by: Petr Vorel<pvorel@suse.cz>
>>
>>
>>>    static void set_disksize(void)
>>>    {
>>> -	tst_resm(TINFO, "create a zram device with %ld bytes in size.", SIZE);
>>> -	SAFE_FILE_PRINTF(cleanup, PATH_ZRAM "/disksize", "%ld", SIZE);
>>> +	tst_res(TINFO, "create a zram device with %ld bytes in size.", SIZE);
>>> +	SAFE_FILE_PRINTF(PATH_ZRAM "/disksize", "%ld", SIZE);
>>>    }
>>
>>>    static void write_device(void)
>>> @@ -92,17 +45,16 @@ static void write_device(void)
>>>    	int fd;
>>>    	char *s;
>>
>>> -	tst_resm(TINFO, "map this zram device into memory.");
>>> -	fd = SAFE_OPEN(cleanup, DEVICE, O_RDWR);
>>> -	s = SAFE_MMAP(cleanup, NULL, SIZE, PROT_READ | PROT_WRITE,
>>> -		      MAP_SHARED, fd, 0);
>>> +	tst_res(TINFO, "map this zram device into memory.");
>>> +	fd = SAFE_OPEN(DEVICE, O_RDWR);
>>> +	s = SAFE_MMAP(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
>>
>>> -	tst_resm(TINFO, "write all the memory.");
>>> +	tst_res(TINFO, "write all the memory.");
>> very nit: while at it, could you please remove unnecessary dot at the end?
> OK.
>>
>> ...
>>
>>>    static void reset(void)
>>>    {
>>> -	tst_resm(TINFO, "reset it.");
>>> -	SAFE_FILE_PRINTF(cleanup, PATH_ZRAM "/reset", "1");
>>> -}
>> ...
>>> +	tst_res(TINFO, "%s...", __func__);
>>> +	SAFE_FILE_PRINTF(PATH_ZRAM "/reset", "1");
>>>    }
>>
>> checkpatch.pl complains:
>>
>> $ make check-zram03
>> zram03.c:93: WARNING: Unnecessary ftrace-like logging - prefer using ftrace
>> =>   nit, but checkpatch.pl is correct, previous info was better than tracing
>> function name. How about keep info instead of function name, e.g.:
>> tst_res(TINFO, "reset zram");
> of course.
>>
>> zram03.c:94: WARNING: Prefer using '"%s...", __func__' to using 'reset', this function's name, in a string
>> false positive (not sure if we should bother with renaming function to keep it quiet).
> I prefer to ignore it.
>>
>> ...
>>> +static void setup(void)
>>> +{
>>> +	const char *const cmd_modprobe[] = {"modprobe", "zram", NULL};
>>> +
>>> +	if (tst_cmd(cmd_rmmod, NULL, NULL, TST_CMD_PASS_RETVAL)) {
>>> +		if (errno == EBUSY)
>>> +			tst_brk(TCONF, "zram module may being used!");
>>> +	}
>> nit: I'd add space here for a readability (it's on more places).
> OK.
>>> +	if (errno == ENOENT)
>>> +		SAFE_CMD(cmd_modprobe, NULL, NULL);
>>> +
>>> +	modprobe = 1;
>>> +}
>>
>> Kind regards,
>> Petr
>

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

  reply	other threads:[~2021-12-10 11:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  7:43 [LTP] [PATCH 1/3] swapping01: skip test if zram-swap is being used Yang Xu
2021-12-09  7:43 ` [LTP] [PATCH 2/3] zram/zram_lib.sh: Skip test if zram module can not be removed Yang Xu
2021-12-09 15:17   ` Cyril Hrubis
2021-12-09 21:11     ` Petr Vorel
2021-12-10  8:56       ` xuyang2018.jy
2021-12-10  9:03         ` Petr Vorel
2021-12-10  9:31           ` xuyang2018.jy
2021-12-13  7:40             ` Petr Vorel
2021-12-13  8:05               ` xuyang2018.jy
2021-12-13 10:34                 ` Petr Vorel
2021-12-14  3:45                   ` xuyang2018.jy
2021-12-14  6:35                     ` xuyang2018.jy
2021-12-15 11:56                     ` Petr Vorel
2021-12-10  8:27     ` xuyang2018.jy
2021-12-09  7:43 ` [LTP] [PATCH 3/3] zram/zram03: Convert into new api Yang Xu
2021-12-09 21:38   ` Petr Vorel
2021-12-10 10:55     ` xuyang2018.jy
2021-12-10 11:06       ` xuyang2018.jy [this message]
2021-12-13  7:30         ` Petr Vorel
2021-12-10 11:40     ` [LTP] [PATCH v2 1/3] swapping01: skip test if zram-swap is being used Yang Xu
2021-12-10 11:40       ` [LTP] [PATCH v2 2/3] zram/zram_lib.sh: Skip test if zram module can not be removed Yang Xu
2021-12-10 12:25         ` Cyril Hrubis
2021-12-10 11:40       ` [LTP] [PATCH v2 3/3] zram/zram03: Convert into new api Yang Xu
2021-12-10 12:28         ` Cyril Hrubis
2021-12-13  5:44           ` [LTP] [PATCH v3 1/3] swapping01: skip test if zram-swap is being used Yang Xu
2021-12-13  5:44             ` [LTP] [PATCH v3 2/3] zram/zram_lib.sh: Skip test if zram module can not be removed Yang Xu
2021-12-15  6:24               ` xuyang2018.jy
2021-12-10 11:51       ` [LTP] [PATCH v2 1/3] swapping01: skip test if zram-swap is being used Cyril Hrubis
2021-12-10 11:52       ` Cyril Hrubis
2021-12-09 15:15 ` [LTP] [PATCH " Cyril Hrubis
2021-12-09 20:57   ` Petr Vorel
2021-12-10  2:57     ` xuyang2018.jy

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=61B334D8.7000200@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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