All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Jan Stancek <jstancek@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH 2/6] lib: Add .max_runtime and tst_remaining_runtime()
Date: Tue, 26 Oct 2021 14:49:21 +0200	[thread overview]
Message-ID: <YXf5UUK3BsUWRBJK@yuki> (raw)
In-Reply-To: <CAASaF6ziq8EbnvywTtdJeSfQkcyE7Gvc9Rn9NK-rk-gimp6ysg@mail.gmail.com>

Hi!
> > Fundamentally there are two types of tests in LTP. First type are tests
> > that are rather quick (much less than a second) and can live with
> > whatever default timeout we set up. Second type of tests are tests that
> > run in a loop until timeout or a number of iterations is reached, these
> > are the tests that are going to be converted to the .max_runtime added
> > by this patch and followups.
> >
> > This patch does:
> >
> > - adds .max_runtime to tst_test structure - this is the maximal runtime
> >   per test iteration
> 
> I'm looking at the series, but I'm not sure I see much difference between
> runtime and timeout. Other than some margin added by library (the MAX formula)
> is there some other difference?

Well it mostly makes the code simpler and clearer since we can, for
instance, map the -I option to the test runtime in the library, we got
rid of all the custom test options for that, etc.

But it also allows us to tune the timeouts based on the expected runtime
so that the test has enough time for a cleanup and we can do that in a
single place rather than in 20 different heuristics in a different
testcases.

> > diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
> > index 220130f4b..e43bc5888 100644
> > --- a/testcases/kernel/syscalls/move_pages/move_pages12.c
> > +++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
> > @@ -153,7 +153,6 @@ static void do_test(unsigned int n)
> >         void *ptr;
> >         pid_t cpid = -1;
> >         int status;
> > -       unsigned int twenty_percent = (tst_timeout_remaining() / 5);
> >
> >         addr = SAFE_MMAP(NULL, tcases[n].tpages * hpsz, PROT_READ | PROT_WRITE,
> >                 MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, 0);
> > @@ -198,7 +197,7 @@ static void do_test(unsigned int n)
> >
> >                 SAFE_MUNMAP(addr, tcases[n].tpages * hpsz);
> >
> > -               if (tst_timeout_remaining() < twenty_percent)
> > +               if (!tst_remaining_runtime())
> >                         break;
> >         }
> >
> > @@ -339,6 +338,7 @@ static struct tst_test test = {
> >         .forks_child = 1,
> >         .setup = setup,
> >         .cleanup = cleanup,
> > +       .max_runtime = 60,
> 
> Where does 60 come from?

Ah, my bad, the code did tst_timeout_remaining() < aprox. 60 so this
should have been 300 instead. Good catch.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2021-10-26 12:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 16:01 [LTP] [PATCH 0/6] Introduce a concept of test max_runtime Cyril Hrubis
2021-10-25 16:01 ` [LTP] [PATCH 1/6] lib: tst_test: Move timeout scaling out of fork_testrun() Cyril Hrubis
2021-10-25 16:01 ` [LTP] [PATCH 2/6] lib: Add .max_runtime and tst_remaining_runtime() Cyril Hrubis
2021-10-26 11:42   ` Jan Stancek
2021-10-26 12:49     ` Cyril Hrubis [this message]
2021-11-03  9:34   ` Richard Palethorpe
2021-11-03 11:09     ` Cyril Hrubis
2021-10-25 16:01 ` [LTP] [PATCH 3/6] mtest06/mmap3: Convert to tst_remaining_runtime() Cyril Hrubis
2021-10-25 16:01 ` [LTP] [PATCH 4/6] syscalls/gettimeofday02: " Cyril Hrubis
2021-10-25 16:01 ` [LTP] [PATCH 5/6] cve-2015-3290: convert tst_remining_runtime() Cyril Hrubis
2021-10-25 16:01 ` [LTP] [PATCH 6/6] lib: Add tst_set_runtime() & remove tst_set_timeout() Cyril Hrubis
2021-10-26  6:16   ` Li Wang
2021-10-26  7:14     ` Cyril Hrubis
2021-10-26  7:44       ` Li Wang
2021-10-26  7:56         ` Cyril Hrubis
2021-10-26  8:29           ` Li Wang

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=YXf5UUK3BsUWRBJK@yuki \
    --to=chrubis@suse.cz \
    --cc=jstancek@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.