public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: LTP List <ltp@lists.linux.it>, automated-testing@lists.yoctoproject.org
Subject: Re: [LTP] [PATCH v3 22/29] fuzzy_sync: Convert to runtime
Date: Thu, 19 May 2022 11:05:25 +0200	[thread overview]
Message-ID: <YoYIVaJJDzryYNeg@yuki> (raw)
In-Reply-To: <CAEemH2dYwMczBhFj28yc9xDu0VBg50orjeQBK2s13-8BspK=WQ@mail.gmail.com>

Hi!
> Okay, my perspective is shortsighted as well.
> 
> This solution is correct in the direction but overlooks the significant
> global value 'tst_start_time'. If that value reflush within tcnt loop we
> don't need to reset max_runtime again, actually the real work in my
> previous patch is to invoke heartbeat() which touches tst_start_time.
> 
> So I would suggest using heartbeat() instead of only sending SIGUSR1
> to lib_pid. Or, do simply revision like:

Ah, right, I guess that we should just call heartbeat() before each
iteration of the test then.

So basically:

diff --git a/lib/tst_test.c b/lib/tst_test.c
index dad8aad92..f3090217b 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1317,6 +1317,24 @@ static void do_cleanup(void)
 	cleanup_ipc();
 }
 
+static void heartbeat(void)
+{
+	if (tst_clock_gettime(CLOCK_MONOTONIC, &tst_start_time))
+		tst_res(TWARN | TERRNO, "tst_clock_gettime() failed");
+
+	if (getppid() == 1) {
+		tst_res(TFAIL, "Main test process might have exit!");
+		/*
+		 * We need kill the task group immediately since the
+		 * main process has exit.
+		 */
+		kill(0, SIGKILL);
+		exit(TBROK);
+	}
+
+	kill(getppid(), SIGUSR1);
+}
+
 static void run_tests(void)
 {
 	unsigned int i;
@@ -1324,6 +1342,7 @@ static void run_tests(void)
 
 	if (!tst_test->test) {
 		saved_results = *results;
+		heartbeat();
 		tst_test->test_all();
 
 		if (getpid() != main_pid) {
@@ -1339,6 +1358,7 @@ static void run_tests(void)
 
 	for (i = 0; i < tst_test->tcnt; i++) {
 		saved_results = *results;
+		heartbeat();
 		tst_test->test(i);
 
 		if (getpid() != main_pid) {
@@ -1349,6 +1369,8 @@ static void run_tests(void)
 
 		if (results_equal(&saved_results, results))
 			tst_brk(TBROK, "Test %i haven't reported results!", i);
+
+		kill(getppid(), SIGUSR1);
 	}
 }
 
@@ -1379,24 +1401,6 @@ static void add_paths(void)
 	free(new_path);
 }
 
-static void heartbeat(void)
-{
-	if (tst_clock_gettime(CLOCK_MONOTONIC, &tst_start_time))
-		tst_res(TWARN | TERRNO, "tst_clock_gettime() failed");
-
-	if (getppid() == 1) {
-		tst_res(TFAIL, "Main test process might have exit!");
-		/*
-		 * We need kill the task group immediately since the
-		 * main process has exit.
-		 */
-		kill(0, SIGKILL);
-		exit(TBROK);
-	}
-
-	kill(getppid(), SIGUSR1);
-}
-
 static void testrun(void)
 {
 	unsigned int i = 0;
@@ -1425,7 +1429,6 @@ static void testrun(void)
 			break;
 
 		run_tests();
-		heartbeat();
 	}
 
 	do_test_cleanup();


I guess that this should go in a separate patch on the top of the
"Introduce concept of max runtime".

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2022-05-19  9:03 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 12:37 [LTP] [PATCH v3 00/29] Introduce runtime and conver tests Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 01/29] Introduce a concept of max runtime Cyril Hrubis
2022-05-14  4:21   ` Li Wang
2022-05-24  9:25   ` [LTP] [Automated-testing] " Richard Palethorpe
2022-05-12 12:37 ` [LTP] [PATCH v3 02/29] mtest06/mmap1: Convert to runtime Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 03/29] mtest06/mmap3: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 04/29] mtest01/mtest01: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 05/29] cve/cve-2015-3290: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 06/29] crypto/af_alg02: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 07/29] crypto/pcrypt_aead01: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 08/29] syscalls/clock_gettime01: Remove useless timeout Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 09/29] syscalls/fanotify22: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 10/29] syscalls/gettimeofday02: Convert to runtime Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 11/29] syscalls/inotify06: " Cyril Hrubis
2022-05-12 12:37 ` [LTP] [PATCH v3 12/29] syscalls/inotify01: Remove now useless timeout Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 13/29] syscalls/perf_event_open03: Convert to runtime Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 14/29] syscalls/readv01: Remove now useless timeout Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 15/29] syscalls/tgkill03: Remove now unused timeout Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 16/29] syscalls/setsockopt09: Remove now useless timeout Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 17/29] syscalls/userfaultfd01: " Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 18/29] syscalls/move_pages12: Convert to runtime Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 19/29] syscalls/rt_sigqueueinfo01: Remove now useless timeout Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 20/29] mem/mallocstress: Convert to runtime Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 21/29] mem/{oom, min_free_kbytes}: " Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 22/29] fuzzy_sync: " Cyril Hrubis
2022-05-13  9:13   ` Li Wang
2022-05-13 12:20     ` Cyril Hrubis
2022-05-13 13:08       ` Li Wang
2022-05-13 14:22         ` Cyril Hrubis
2022-05-14  2:59           ` Li Wang
2022-05-16  7:52           ` Richard Palethorpe
2022-05-17 10:56             ` Cyril Hrubis
2022-05-17 11:07               ` [LTP] [Automated-testing] " Petr Vorel
2022-05-17 12:28               ` [LTP] " Li Wang
2022-05-18  7:47                 ` Li Wang
2022-05-19  9:05                   ` Cyril Hrubis [this message]
2022-05-19 10:02                     ` Li Wang
2022-05-19 10:27                       ` Cyril Hrubis
2022-05-19 10:29                         ` Li Wang
2022-05-19 12:01                           ` Cyril Hrubis
2022-05-24  9:24                             ` Richard Palethorpe
2022-05-12 12:38 ` [LTP] [PATCH v3 23/29] ltp-aiodio/dio_sparse, aiodio_sparse: " Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 24/29] ltp-aiodio/read_checkzero: Remove Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 25/29] ltp-aiodio/dio_{truncate, append}: Convert to runtime Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 26/29] ltp-aiodio/dio_read: " Cyril Hrubis
2022-05-24  8:36   ` Petr Vorel
2022-05-12 12:38 ` [LTP] [PATCH v3 27/29] timer_test: " Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 28/29] ltp-aiodio/aiodio_append: " Cyril Hrubis
2022-05-12 12:38 ` [LTP] [PATCH v3 29/29] tst_test: Remove timeout stubs Cyril Hrubis
2022-05-20  8:36 ` [LTP] [PATCH 0/2] two follow up fix for Introduce-of-max-runtime Li Wang
2022-05-20  8:36   ` [LTP] [PATCH 1/2] testcases: make use of runtime Li Wang
2022-05-20 11:03     ` Cyril Hrubis
2022-05-20 11:15       ` Li Wang
2022-05-20  8:36   ` [LTP] [PATCH 2/2] mmap3: reset runtime to 10s Li Wang
2022-05-20 11:05     ` Cyril Hrubis
2022-05-20 11:24       ` Li Wang
2022-05-20 12:18   ` [LTP] [PATCH 0/2] two follow up fix for Introduce-of-max-runtime Cyril Hrubis
2022-05-20 12:51     ` Li Wang
2022-05-20 12:55       ` Petr Vorel
2022-05-24  8:39 ` [LTP] [PATCH v3 00/29] Introduce runtime and conver tests Petr Vorel
2022-05-24  8:41 ` 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=YoYIVaJJDzryYNeg@yuki \
    --to=chrubis@suse.cz \
    --cc=automated-testing@lists.yoctoproject.org \
    --cc=liwang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox