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 v4 1/2] lib: introduce tst_timeout_remaining()
Date: Thu, 30 Aug 2018 13:30:34 +0200	[thread overview]
Message-ID: <20180830113034.GC6363@rei.lan> (raw)
In-Reply-To: <20180830112246.GB6363@rei.lan>

Hi!
> > I didn't want to do that, because a test might want calculate something
> > based on timeout in setup(), for example to find current overall timeout
> > value with LTP_TIMEOUT_MUL taken into account.
> > 
> > For that to work, we have to initialize tst_start_time prior to
> > tst_test->setup().
> 
> Fair enough, also the alarm() in the test library pid is set before we
> run the test setup, so if the test setup would take a few seconds we
> will be off with the calculation. Although that could be fixed by
> calling heartbeat before we run the loop in testrun(), which I guess
> should be done anyway. That in turn would allow for your patch to have
> the clock_gettime only in the heartbeat function, right?

Actually we would have to do the heartbeat before and after the setup.
So we should go with your version unless we add a tst_get_timeout()
function that would return the test timeout, which, given that the
timeout is stored in tst_test structure would just do:

static inline int tst_get_timeout(void)
{
	return test.timeout;
}

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2018-08-30 11:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30  8:55 [LTP] [PATCH v4 1/2] lib: introduce tst_timeout_remaining() Jan Stancek
2018-08-30  8:55 ` [LTP] [PATCH v4 2/2] move_pages12: end early if runtime gets close to test time Jan Stancek
2018-08-30 10:42 ` [LTP] [PATCH v4 1/2] lib: introduce tst_timeout_remaining() Cyril Hrubis
2018-08-30 11:01   ` Jan Stancek
2018-08-30 11:22     ` Cyril Hrubis
2018-08-30 11:30       ` Cyril Hrubis [this message]
2018-08-30 11:54         ` Jan Stancek
2018-08-30 12:02           ` Cyril Hrubis
2018-08-30 12:17             ` Jan Stancek
2018-08-30 12:41               ` Cyril Hrubis
2018-09-03  5:50                 ` Jan Stancek

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=20180830113034.GC6363@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