public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 5/5] Use SAFE_CMD()
Date: Mon, 30 Mar 2020 22:02:50 +0200	[thread overview]
Message-ID: <20200330200250.GB8636@dell5510> (raw)
In-Reply-To: <CAEemH2dQfpn9mEBY=CFfVj_8dLETD7zh4=j3KP-bt95m_CCBxg@mail.gmail.com>

Hi Li,

> Oh, you did the renaming in patch 5/5, but pity that the
> TST_CMD_TCONF_ON_MISSING still not being used:). I guess this modification
> should belong to patch4/5.
Thanks for careful review. Yes, I found that as well + the other problem you
reported - tst_run_cmd() during one more check.

+ I needed to put back static inline for safe_cmd() (it was in previous version,
it's really needed). So there is latest version available on
https://github.com/pevik/ltp/tree/needs_cmds.v2.fixes

which passed some travis jobs (I'll check that tomorrow)
https://travis-ci.org/github/pevik/ltp/builds/668925599

Diff from v2 below.

IMHO now it should be ok, but I'm waiting for your or anybody else ack/review.

Kind regards,
Petr

diff --git doc/test-writing-guidelines.txt doc/test-writing-guidelines.txt
index 75c2e517a..895f6c99d 100644
--- doc/test-writing-guidelines.txt
+++ doc/test-writing-guidelines.txt
@@ -1263,7 +1263,7 @@ different once the call returns and should be used only for rough estimates.
 int tst_cmd(const char *const argv[],
 	        const char *stdout_path,
 	        const char *stderr_path,
-			enum tst_cmd_flags flags);
+	        enum tst_cmd_flags flags);
 -------------------------------------------------------------------------------
 
 'tst_cmd()' is a wrapper for 'vfork() + execvp()' which provides a way
diff --git include/tst_safe_macros.h include/tst_safe_macros.h
index d050c5990..8126179f4 100644
--- include/tst_safe_macros.h
+++ include/tst_safe_macros.h
@@ -538,13 +538,13 @@ void safe_unshare(const char *file, const int lineno, int flags);
 void safe_setns(const char *file, const int lineno, int fd, int nstype);
 #define SAFE_SETNS(fd, nstype) safe_setns(__FILE__, __LINE__, (fd), (nstype));
 
-void safe_cmd(const char *file, const int lineno, const char *const argv[],
+static inline void safe_cmd(const char *file, const int lineno, const char *const argv[],
 				  const char *stdout_path, const char *stderr_path)
 {
 	int rval;
 
-	switch ((rval = tst_cmd(argv, stdout_path, stderr_path, TST_CMD_PASS_RETVAL
-							| TST_CMD_CHECK_CMD))) {
+	switch ((rval = tst_cmd(argv, stdout_path, stderr_path,
+				TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING))) {
 	case 0:
 		break;
 	default:

  reply	other threads:[~2020-03-30 20:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 12:43 [LTP] [PATCH v2 0/5] C API: .needs_cmds and SAFE_CMD() Petr Vorel
2020-03-30 12:43 ` [LTP] [PATCH v2 1/5] lib: Rename tst_run_cmd*() to tst_cmd*() Petr Vorel
2020-03-30 12:43 ` [LTP] [PATCH v2 2/5] lib/tst_cmd_*(): Turn int pass_exit_val into enum Petr Vorel
2020-03-30 12:43 ` [LTP] [PATCH v2 3/5] lib/tst_cmd_*(): Search for program in $PATH Petr Vorel
2020-03-30 12:43 ` [LTP] [PATCH v2 4/5] lib: Implement SAFE_CMD() macro (new API only) Petr Vorel
2020-03-30 13:01   ` Li Wang
2020-03-30 13:07     ` Li Wang
2020-03-30 18:48     ` Petr Vorel
2020-03-30 12:43 ` [LTP] [PATCH v2 5/5] Use SAFE_CMD() Petr Vorel
2020-03-30 13:23   ` Li Wang
2020-03-30 20:02     ` Petr Vorel [this message]
2020-03-30 20:29       ` Petr Vorel
2020-03-31  3:59       ` Li Wang
2020-03-31  5:03         ` 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=20200330200250.GB8636@dell5510 \
    --to=pvorel@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