Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] shell lib: Add support for test cleanup
Date: Tue, 25 Feb 2025 12:00:17 +0100	[thread overview]
Message-ID: <20250225110017.GA2932346@pevik> (raw)
In-Reply-To: <Z72anBFr2n4REM3E@yuki.lan>

Hi Cyril,

> Hi!
> > could we get check for file existence, the same way it's done in metaparse.c?

> > Also, I'd prefer if both tools exit 1 in case of missing file (so that CI
> > notifies the problem).

> Will do.

> > +++ metadata/metaparse-sh.c
> > @@ -6,6 +6,7 @@
> >  #include <stdio.h>
> >  #include <string.h>
> >  #include <libgen.h>
> > +#include <unistd.h>

> >  #include "data_storage.h"

> > @@ -46,6 +47,11 @@ static void parse_shell(char *path)
> >  	FILE *f = fopen(path, "r");
> >  	enum state state = NONE;

> > +	if (access(path, F_OK)) {
> > +		fprintf(stderr, "file %s does not exist\n", path);
> > +		return;
> > +	}

> I guess that I should check the f instead:

> 	if (!f) {
> 		fprintf(stderr, "Failed to open '%s': %s", path, strerror(errno));
> 		exit(1);
> 	}

Yes, that's it. Thanks for both.

Kind regards,
Petr

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

      reply	other threads:[~2025-02-25 11:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 11:21 [LTP] [PATCH 0/2] shell lib: Add very simple cleanup support Cyril Hrubis
2025-02-14 11:21 ` [LTP] [PATCH 1/2] testcases/lib/run_tests.sh Cyril Hrubis
2025-02-14 13:37   ` Petr Vorel
2025-02-28 11:49     ` Petr Vorel
2025-02-14 11:21 ` [LTP] [PATCH 2/2] shell lib: Add support for test cleanup Cyril Hrubis
2025-02-14 13:55   ` Petr Vorel
2025-02-14 14:07     ` Cyril Hrubis
2025-02-14 14:18       ` Cyril Hrubis
2025-02-17  7:44   ` Petr Vorel
2025-02-25 10:25     ` Cyril Hrubis
2025-02-25 11:00       ` Petr Vorel [this message]

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=20250225110017.GA2932346@pevik \
    --to=pvorel@suse.cz \
    --cc=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