All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Cyril Hrubis <chrubis@suse.cz>
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 13:42:20 +0200	[thread overview]
Message-ID: <CAASaF6ziq8EbnvywTtdJeSfQkcyE7Gvc9Rn9NK-rk-gimp6ysg@mail.gmail.com> (raw)
In-Reply-To: <20211025160134.9283-3-chrubis@suse.cz>

On Mon, Oct 25, 2021 at 6:01 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> This is another attempt of decoupling test runtime from timeouts.
>
> 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?

>
> - if .max_runtime is set
>   - test timeout is computed based on it and set as:
>     max_runtime + MAX(10, max_runtime)
>
>   - the -I option is mapped to the max runtime
>     this nicely unifies the test runtime command line option
>
> - replaces the tst_timeout_remining() whith tst_remaining_runtime() and
>   simplifies the code since we do no have to keep any margin for the
>   timeout, since we computed the timeout based on the runtime
>
> Side efect of this work is that all tests that use
> tst_remaining_runtime() must define it's runtime explicitelly which I
> think is step into the right direction as well.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---

<snip>

> 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?


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

  reply	other threads:[~2021-10-26 11:42 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 [this message]
2021-10-26 12:49     ` Cyril Hrubis
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=CAASaF6ziq8EbnvywTtdJeSfQkcyE7Gvc9Rn9NK-rk-gimp6ysg@mail.gmail.com \
    --to=jstancek@redhat.com \
    --cc=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 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.