public inbox for fio@vger.kernel.org
 help / color / mirror / Atom feed
From: Vincent Fu <vincentfu@gmail.com>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	fio@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: Damien Le Moal <dlemoal@kernel.org>
Subject: Re: [PATCH 9/9] t/jobs/t0034: add test for the log_issue_time option
Date: Wed, 28 Aug 2024 14:47:58 -0400	[thread overview]
Message-ID: <369de3f1-37b7-45aa-9e80-bad96f52c5bd@gmail.com> (raw)
In-Reply-To: <20240827070850.947037-10-shinichiro.kawasaki@wdc.com>

On 8/27/24 03:08, Shin'ichiro Kawasaki wrote:
> Add a test to check the newly added option 'log_issue_time'. Generate
> log files using the option and check that lines in the log files have
> the format described in the "Log File Format" section in HOWTO.rst.
> 
> This test case has the logic same as t0033 except the log file names and
> matching patterns. Factor out the logic to the new class
> FioJobFileTest_LogFileFormat.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>   t/jobs/t0034.fio   | 27 ++++++++++++++++++++++++
>   t/run-fio-tests.py | 51 +++++++++++++++++++++++++++++++++++++---------
>   2 files changed, 68 insertions(+), 10 deletions(-)
>   create mode 100644 t/jobs/t0034.fio
> 
> diff --git a/t/jobs/t0034.fio b/t/jobs/t0034.fio
> new file mode 100644
> index 00000000..ca71b775
> --- /dev/null
> +++ b/t/jobs/t0034.fio
> @@ -0,0 +1,27 @@
> +[global]
> +rw=read
> +filename=t0034file
> +size=8k
> +time_based
> +runtime=100ms
> +ioengine=libaio
> +iodepth=1
> +
> +[job1]
> +write_lat_log=log
> +log_offset=1
> +log_issue_time=1
> +
> +[job2]
> +write_lat_log=log
> +log_offset=1
> +log_issue_time=1
> +log_avg_msec=20
> +log_window_value=both
> +
> +[job3]
> +write_lat_log=log
> +write_bw_log=log
> +write_iops_log=log
> +log_offset=1
> +log_issue_time=1
> diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py
> index 8bc343cd..525f78ff 100755
> --- a/t/run-fio-tests.py
> +++ b/t/run-fio-tests.py
> @@ -554,29 +554,50 @@ class FioJobFileTest_t0029(FioJobFileTest):
>           if self.json_data['jobs'][1]['read']['io_kbytes'] != 8:
>               self.passed = False
>   
> -class FioJobFileTest_t0033(FioJobFileTest):
> +class FioJobFileTest_LogFileFormat(FioJobFileTest):
>       """Test log file format"""
> +    def setup(self, *args, **kws):
> +        super().setup(*args, **kws)
> +        self.patterns = {}
> +
>       def check_result(self):
>           super().check_result()
>   
>           if not self.passed:
>               return
>   
> -        patterns = {
> +        for logfile in self.patterns.keys():
> +            file_path = os.path.join(self.paths['test_dir'], logfile)
> +            with open(file_path, "r") as f:
> +                line = f.readline()
> +                if not re.match(self.patterns[logfile], line):
> +                    self.passed = False
> +                    self.failure_reason = "wrong log file format: " + logfile
> +                    return
> +
> +class FioJobFileTest_t0033(FioJobFileTest_LogFileFormat):
> +    """Test log file format"""
> +    def setup(self, *args, **kws):
> +        super().setup(*args, **kws)
> +        self.patterns = {
>               'log_bw.1.log': '\\d+, \\d+, \\d+, \\d+, 0x[\\da-f]+\\n',
>               'log_clat.2.log': '\\d+, \\d+, \\d+, \\d+, 0, \\d+\\n',
>               'log_iops.3.log': '\\d+, \\d+, \\d+, \\d+, \\d+, 0x[\\da-f]+\\n',
>               'log_iops.4.log': '\\d+, \\d+, \\d+, \\d+, 0, 0, \\d+\\n',
>           }
>   
> -        for logfile in patterns.keys():
> -            file_path = os.path.join(self.paths['test_dir'], logfile)
> -            with open(file_path, "r") as f:
> -                line = f.readline()
> -                if not re.match(patterns[logfile], line):
> -                    self.passed = False
> -                    self.failure_reason = "wrong log file format: " + logfile
> -                    return
> +class FioJobFileTest_t0034(FioJobFileTest_LogFileFormat):
> +    """Test log file format"""
> +    def setup(self, *args, **kws):
> +        super().setup(*args, **kws)
> +        self.patterns = {
> +            'log_clat.1.log': '\\d+, \\d+, \\d+, \\d+, \\d+, \\d+, \\d+\\n',
> +            'log_slat.1.log': '\\d+, \\d+, \\d+, \\d+, \\d+, \\d+, \\d+\\n',
> +            'log_lat.1.log': '\\d+, \\d+, \\d+, \\d+, \\d+, \\d+, 0\\n',
> +            'log_clat.2.log': '\\d+, \\d+, \\d+, \\d+, 0, 0, \\d+, 0\\n',
> +            'log_bw.3.log': '\\d+, \\d+, \\d+, \\d+, \\d+, \\d+, 0\\n',
> +            'log_iops.3.log': '\\d+, \\d+, \\d+, \\d+, \\d+, \\d+, 0\\n',
> +        }
>   
>   class FioJobFileTest_iops_rate(FioJobFileTest):
>       """Test consists of fio test job t0011
> @@ -913,6 +934,16 @@ TEST_LIST = [
>           'pre_success':      SUCCESS_DEFAULT,
>           'requirements':     [],
>       },
> +    {
> +        'test_id':          34,
> +        'test_class':       FioJobFileTest_t0034,
> +        'job':              't0034.fio',
> +        'success':          SUCCESS_DEFAULT,
> +        'pre_job':          None,
> +        'pre_success':      None,
> +        'pre_success':      SUCCESS_DEFAULT,
> +        'requirements':     [],

[Requirements.linux, Requirements.libaio] is needed here as well.


  reply	other threads:[~2024-08-28 18:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  7:08 [PATCH 0/9] introduce the log_issue_time option Shin'ichiro Kawasaki
2024-08-27  7:08 ` [PATCH 1/9] stat: reduce arguments of add_*lat_sample() functions Shin'ichiro Kawasaki
2024-08-27  7:08 ` [PATCH 2/9] stat: reduce arguments of add_log_sample() Shin'ichiro Kawasaki
2024-08-27  7:08 ` [PATCH 3/9] iolog: refactor flush_samples() Shin'ichiro Kawasaki
2024-08-28 16:56   ` Nick Neumann
2024-08-29  5:44     ` Shinichiro Kawasaki
2024-08-27  7:08 ` [PATCH 4/9] iolog: drop struct io_sample_offset Shin'ichiro Kawasaki
2024-08-27  7:08 ` [PATCH 5/9] introduce the log_issue_time option Shin'ichiro Kawasaki
2024-08-28 17:02   ` Jens Axboe
2024-08-29  5:50     ` Shinichiro Kawasaki
2024-08-28 17:38   ` Nick Neumann
2024-08-29  1:05     ` Damien Le Moal
2024-08-29  1:44       ` Nick Neumann
2024-08-29  8:13   ` Shinichiro Kawasaki
2024-08-27  7:08 ` [PATCH 6/9] doc: fix the descriptions of the log_prio option Shin'ichiro Kawasaki
2024-08-27  7:08 ` [PATCH 7/9] doc: describe the log_issue_time option Shin'ichiro Kawasaki
2024-08-27  7:08 ` [PATCH 8/9] t/jobs/t0033: add test for the log file format Shin'ichiro Kawasaki
2024-08-28 18:46   ` Vincent Fu
2024-08-29  7:04     ` Shinichiro Kawasaki
2024-08-27  7:08 ` [PATCH 9/9] t/jobs/t0034: add test for the log_issue_time option Shin'ichiro Kawasaki
2024-08-28 18:47   ` Vincent Fu [this message]
2024-08-28 17:06 ` [PATCH 0/9] introduce " Jens Axboe
2024-08-29  0:59   ` Damien Le Moal
2024-08-29  1:49     ` Nick Neumann
2024-08-29  8:40     ` Shinichiro Kawasaki

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=369de3f1-37b7-45aa-9e80-bad96f52c5bd@gmail.com \
    --to=vincentfu@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=dlemoal@kernel.org \
    --cc=fio@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /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