From: John Kacur <jkacur@redhat.com>
To: Daniel Wagner <wagi@monom.org>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: [PATCH v2 09/12] signaltest: Add duration command line argument
Date: Thu, 13 Jun 2019 21:07:49 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.21.1906132107300.4541@planxty> (raw)
In-Reply-To: <20190605160617.22987-10-wagi@monom.org>
On Wed, 5 Jun 2019, Daniel Wagner wrote:
> Many of the test programs have the --loop argument for automatic
> stopping. The main problem with the --loop argument is how long is
> --loop 1000?
>
> To simplify automated tests introduce a --duration argument which
> allows to set the time how long a test should run. This allows the
> test suite to define the execution time and also the timeout which a
> normal human can understand.
>
> For example run the test for 10 minutes and timeout at 11 minutes:
>
> # timeout 11m signaltest -D 10m
>
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
> src/signaltest/signaltest.8 | 5 +++++
> src/signaltest/signaltest.c | 14 +++++++++++++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/src/signaltest/signaltest.8 b/src/signaltest/signaltest.8
> index 634d392a6da5..bd6ffe5c7a36 100644
> --- a/src/signaltest/signaltest.8
> +++ b/src/signaltest/signaltest.8
> @@ -13,6 +13,11 @@ starting with two dashes ('\-\-').
> .B \-b, \-\-breaktrace=USEC
> Send break trace command when latency > USEC
> .TP
> +.B \-D, \-\-duration=TIME
> +Specify a length for the test run.
> +.br
> +Append 'm', 'h', or 'd' to specify minutes, hours or days.
> +.TP
> .B \-l, \-\-loops=LOOPS
> Number of loops: default=0 (endless)
> .TP
> diff --git a/src/signaltest/signaltest.c b/src/signaltest/signaltest.c
> index 59f979ec5ad1..a168191b7573 100644
> --- a/src/signaltest/signaltest.c
> +++ b/src/signaltest/signaltest.c
> @@ -208,6 +208,8 @@ static void display_help(void)
> "signaltest <options>\n\n"
> "-b USEC --breaktrace=USEC send break trace command when latency > USEC\n"
> "-l LOOPS --loops=LOOPS number of loops: default=0(endless)\n"
> + "-D --duration=TIME specify a length for the test run.\n"
> + " Append 'm', 'h', or 'd' to specify minutes, hours or days.\n"
> "-p PRIO --prio=PRIO priority of highest prio thread\n"
> "-q --quiet print a summary only on exit\n"
> "-t NUM --threads=NUM number of threads: default=2\n"
> @@ -221,6 +223,7 @@ static void display_help(void)
> static int priority;
> static int num_threads = 2;
> static int max_cycles;
> +static int duration;
> static int verbose;
> static int quiet;
> static int lockall = 0;
> @@ -235,6 +238,7 @@ static void process_options (int argc, char *argv[])
> static struct option long_options[] = {
> {"breaktrace", required_argument, NULL, 'b'},
> {"loops", required_argument, NULL, 'l'},
> + {"duration", required_argument, NULL, 'D'},
> {"priority", required_argument, NULL, 'p'},
> {"quiet", no_argument, NULL, 'q'},
> {"threads", required_argument, NULL, 't'},
> @@ -243,13 +247,14 @@ static void process_options (int argc, char *argv[])
> {"help", no_argument, NULL, '?'},
> {NULL, 0, NULL, 0}
> };
> - int c = getopt_long (argc, argv, "b:c:d:i:l:np:qrsmt:v",
> + int c = getopt_long (argc, argv, "b:c:d:i:l:D:np:qrsmt:v",
> long_options, &option_index);
> if (c == -1)
> break;
> switch (c) {
> case 'b': tracelimit = atoi(optarg); break;
> case 'l': max_cycles = atoi(optarg); break;
> + case 'D': duration = parse_time_string(optarg); break;
> case 'p': priority = atoi(optarg); break;
> case 'q': quiet = 1; break;
> case 't': num_threads = atoi(optarg); break;
> @@ -259,6 +264,9 @@ static void process_options (int argc, char *argv[])
> }
> }
>
> + if (duration < 0)
> + error = 1;
> +
> if (priority < 0 || priority > 99)
> error = 1;
>
> @@ -340,6 +348,10 @@ int main(int argc, char **argv)
>
> signal(SIGINT, sighand);
> signal(SIGTERM, sighand);
> + signal(SIGALRM, sighand);
> +
> + if (duration)
> + alarm(duration);
>
> par = calloc(num_threads, sizeof(struct thread_param));
> if (!par)
> --
> 2.20.1
>
Signed-off-by: John Kacur <jkacur@redhat.com>
prev parent reply other threads:[~2019-06-13 19:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 16:06 [PATCH v2 00/12] rt-tests: Add --duration argument to tests Daniel Wagner
2019-06-05 16:06 ` [PATCH v2 01/12] rt_numa.h: Remove unused function Daniel Wagner
2019-06-13 13:48 ` John Kacur
2019-06-05 16:06 ` [PATCH v2 02/12] queuelat: Use clock syscall for ARM 32 bit Daniel Wagner
2019-06-13 13:51 ` John Kacur
2019-06-05 16:06 ` [PATCH v2 03/12] rt-utils: Move parse_time_string() Daniel Wagner
2019-06-13 13:57 ` John Kacur
2019-06-05 16:06 ` [PATCH v2 04/12] pi_stress: Allow short command line arguments Daniel Wagner
2019-06-13 14:04 ` John Kacur
2019-06-16 16:29 ` Daniel Wagner
2019-06-05 16:06 ` [PATCH v2 05/12] pi_stress: Rename -t command line option to -D Daniel Wagner
2019-06-13 14:07 ` John Kacur
2019-06-05 16:06 ` [PATCH v2 06/12] pmqtest: Add duration command line argument Daniel Wagner
2019-06-13 14:10 ` John Kacur
2019-06-05 16:06 ` [PATCH v2 07/12] ptsematest: " Daniel Wagner
2019-06-05 16:06 ` [PATCH v2 08/12] cyclicdeadline: " Daniel Wagner
2019-06-13 14:18 ` John Kacur
2019-06-16 16:34 ` Daniel Wagner
2019-06-13 14:40 ` John Kacur
2019-06-05 16:06 ` [PATCH v2 09/12] signaltest: " Daniel Wagner
2019-06-13 19:07 ` John Kacur [this message]
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=alpine.LFD.2.21.1906132107300.4541@planxty \
--to=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=wagi@monom.org \
/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