All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <andrzej.hajda@intel.com>
To: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>,
	igt-dev@lists.freedesktop.org,
	Petri Latvala <petri.latvala@intel.com>,
	Ch Sai Gowtham <sai.gowtham.ch@intel.com>
Subject: Re: [igt-dev] [PATCH v2 09/12] code_cov_parse_info: fix error handling when opening files
Date: Wed, 13 Apr 2022 15:27:16 +0200	[thread overview]
Message-ID: <3b1fb6c9-b517-e682-04ad-d17d365a33fa@intel.com> (raw)
In-Reply-To: <2a6359e9b7cfcc7cfaa37339d3aa8a3af9788d66.1649753814.git.mchehab@kernel.org>



On 12.04.2022 10:59, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
>
> While on bash scripts we use "||" for error handling, perl
> uses "or" instead. Yet, it doesn't warn when "||" is used.

Perl accepts || as well (this is why it does not warn), but it has 
higher priority so in cases below it will behave different than or.
So the above sentence is misleading.
>
> That causes it to print a warning when the open fail while
> reading filter files, instead of the original intent of
> finishing and reporting an error.
>
> Reviewed-by: Ch Sai Gowtham <sai.gowtham.ch@intel.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
> To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH v2 00/12] at: https://lore.kernel.org/all/cover.1649753814.git.mchehab@kernel.org/
>
>   scripts/code_cov_parse_info | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
> index 3e1525a67d99..c8284a297b33 100755
> --- a/scripts/code_cov_parse_info
> +++ b/scripts/code_cov_parse_info
> @@ -513,7 +513,7 @@ my $filter_str = "";
>   my $has_filter;
>   
>   if ($func_filters) {
> -	open IN, $func_filters || die "Can't open $func_filters";
> +	open IN, $func_filters or die "Can't open $func_filters";

Replacing with:
     open(IN, $func_filters) || die "Can't open $func_filters";
should help as well.

With or without slightly adjusted commit message.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej


>   	while (<IN>) {
>   		s/^\s+//;
>   		s/\s+$//;
> @@ -524,7 +524,7 @@ if ($func_filters) {
>   }
>   
>   if ($src_filters) {
> -	open IN, $src_filters || die "Can't open $src_filters";
> +	open IN, $src_filters or die "Can't open $src_filters";
>   	while (<IN>) {
>   		s/^\s+//;
>   		s/\s+$//;

  reply	other threads:[~2022-04-13 13:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12  8:58 [igt-dev] [PATCH v2 00/12] code coverage: some improvements Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 01/12] scripts/code_cov*: remove the extensions from them Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 02/12] scripts/code_cov_parse_info: add a tool to parse code coverage info files Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 03/12] scripts/code_cov_gen_report: add support for filtering " Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 04/12] runner: execute code coverage script also from PATH Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 05/12] scripts/meson.build: install code coverage scripts Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 06/12] scripts/code_cov_selftest.sh: test if IGT code coverage is working Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 07/12] docs/code_coverage.md: document the code coverage filter script Mauro Carvalho Chehab
2022-04-13 13:14   ` Andrzej Hajda
2022-04-12  8:59 ` [igt-dev] [PATCH v2 08/12] scripts/code_cov_parse_info: better handle test name Mauro Carvalho Chehab
2022-04-13 13:15   ` Andrzej Hajda
2022-04-12  8:59 ` [igt-dev] [PATCH v2 09/12] code_cov_parse_info: fix error handling when opening files Mauro Carvalho Chehab
2022-04-13 13:27   ` Andrzej Hajda [this message]
2022-04-14  5:48     ` Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 10/12] code_cov_parse_info: fix --show-lines logic Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 11/12] code_cov_parse_info: add support for exclude filters Mauro Carvalho Chehab
2022-04-13 13:53   ` Andrzej Hajda
2022-04-14  7:03     ` Mauro Carvalho Chehab
2022-04-12  8:59 ` [igt-dev] [PATCH v2 12/12] code_cov_parse_info: add support for generating html reports Mauro Carvalho Chehab
2022-04-13 13:59   ` Andrzej Hajda
2022-04-12  9:40 ` [igt-dev] ✗ GitLab.Pipeline: warning for code coverage: some improvements (rev2) Patchwork
2022-04-12 10:04 ` [igt-dev] ✗ Fi.CI.BAT: failure " Patchwork
2022-04-14  7:28 ` [igt-dev] ✗ Fi.CI.BUILD: failure for code coverage: some improvements (rev3) Patchwork

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=3b1fb6c9-b517-e682-04ad-d17d365a33fa@intel.com \
    --to=andrzej.hajda@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mauro.chehab@linux.intel.com \
    --cc=petri.latvala@intel.com \
    --cc=sai.gowtham.ch@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.