All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/2] Use SAFE_RUNCMD()
Date: Tue, 24 Mar 2020 14:27:19 +0800	[thread overview]
Message-ID: <CAEemH2fpJw0T0qkRrhFos22A_E+seRXtZ6Rp4jvxUthAuTOQ_g@mail.gmail.com> (raw)
In-Reply-To: <20200323154907.GB15673@dell5510>

Hi Petr,

On Mon, Mar 23, 2020 at 11:49 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> ...
> > > > > kernel/syscalls/copy_file_range/copy_file_range02.c
> > > > only affect test6 and test7
> > > >  6) Try to copy contents to a file chattred with +i
> > > >  *    flag -> EPERM
> > > >  * 7) Try to copy contents to a swapfile ->ETXTBSY
> > > Yes, it'd be bad to break all tests due it.
>
> > > Here is also problem with swapoff (or maybe chattr, mkswap, swapon; I
> don't
> > > remember), which returns exit code 255 on error, so it's not possible
> to
> > > distinguish this from the case whether command is not available (any
> idea,
> > > how
> > > to fix it?).
>
> > Maybe we could achieve a tst_cmd_available(char *cmd) in the C version?
> > which uses popen() to open a process like: "whereis/which command" and do
> > string parse in the result to see the path(/usr/bin/cmd, /usr/sbin/cmd)
> of
> > the bin if it has been found.
> Or how about loop whole path like whereis/which command? I want to cover
> also
> these "strange systems" (Android and embedded).
>

Yes, looping the whole PATH is necessary. I'd like to go the access() way
which you improved in the last email.


>
> I wonder if to use this all the time (e.g. in safe_run_cmd(), because
> solution
> in tst_run_cmd_fds_() (errno == ENOENT) works most of the time. Maybe
> changing
> exit code 255 to something less common (e.g. INT_MAX - 5).
>

That might be feasible. I hope to hear more voices from others here.
@Cyril @Xu what do you think?


> Do you want to use tst_cmd_available() also  not only as API
>

Hmm. I guess we can add a new filed in tst_test struct as '.cmd_check' to
make the command support checking automatically in the setup() phase.
That's not very needed but better to testcase manage if we do.

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200324/41499d34/attachment.htm>

  reply	other threads:[~2020-03-24  6:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 13:49 [LTP] [PATCH 1/2] lib: Implement SAFE_RUN() macro (new API only) Petr Vorel
2020-03-20 13:49 ` [LTP] [PATCH 2/2] Use SAFE_RUNCMD() Petr Vorel
2020-03-23  3:13   ` Yang Xu
2020-03-23  9:04     ` Petr Vorel
2020-03-23  9:10   ` Li Wang
2020-03-23  9:52     ` Yang Xu
2020-03-23 11:37       ` Petr Vorel
2020-03-23 13:42         ` Li Wang
2020-03-23 14:32           ` Li Wang
2020-03-23 16:04             ` Petr Vorel
2020-03-24 23:51               ` Cyril Hrubis
2020-03-24 17:21                 ` Petr Vorel
2020-03-25  1:53                   ` Cyril Hrubis
2020-03-24 18:55                     ` Petr Vorel
2020-03-25  5:56                       ` Li Wang
2020-03-25  5:30                     ` Li Wang
2020-03-25 17:07                       ` Cyril Hrubis
2020-03-25  9:34                         ` Petr Vorel
2020-03-25 10:03                           ` Cyril Hrubis
2020-03-25 15:40                             ` Petr Vorel
2020-03-25 10:42                           ` Yang Xu
2020-03-25 15:56                             ` Petr Vorel
2020-03-26  5:27                               ` Li Wang
2020-03-26  8:03                               ` Yang Xu
2020-03-23 15:49           ` Petr Vorel
2020-03-24  6:27             ` Li Wang [this message]
2020-03-23  2:43 ` [LTP] [PATCH 1/2] lib: Implement SAFE_RUN() macro (new API only) Yang Xu
2020-03-23  9:20   ` Petr Vorel

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=CAEemH2fpJw0T0qkRrhFos22A_E+seRXtZ6Rp4jvxUthAuTOQ_g@mail.gmail.com \
    --to=liwang@redhat.com \
    --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 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.