public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] ltp: detect the test id automatically
Date: Tue, 14 Mar 2017 17:49:47 +0100	[thread overview]
Message-ID: <20170314164947.GA9183@rei.lan> (raw)
In-Reply-To: <20170314072529.24567-1-liwang@redhat.com>

Hi!
> +static void get_tid(char *argv[])
> +{
> +	char *p;
> +
> +	tst_test->tid = (p = strrchr(argv[0], '/')) ? p+1 : argv[0];
> +}

This is interesting idea, but this oneliner is ugly and does not work
when you execute the testcase by full path, i.e.
/opt/ltp/testcases/bin/foo01 would end up with
opt/ltp/testcases/bin/foo01 in tid.

And I wonder if we can avoid runtime detection, which is always tricky.
Maybe we can just do:

struct tst_test test = {
	.id = __FILE__,
};

And strip the .c suffix in the test library if present. That way we
would avoid this kind of copy&paste errors.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2017-03-14 16:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14  7:25 [LTP] [PATCH] ltp: detect the test id automatically Li Wang
2017-03-14 16:49 ` Cyril Hrubis [this message]
2017-03-15  2:36   ` Li Wang
2017-03-15  9:18     ` Cyril Hrubis
2017-03-16  3:39       ` Li Wang
2017-03-23 13:04         ` Cyril Hrubis

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=20170314164947.GA9183@rei.lan \
    --to=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