From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D507C28CC6 for ; Wed, 5 Jun 2019 16:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 684FF206C3 for ; Wed, 5 Jun 2019 16:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728647AbfFEQGh (ORCPT ); Wed, 5 Jun 2019 12:06:37 -0400 Received: from mail.monom.org ([188.138.9.77]:35598 "EHLO mail.monom.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728534AbfFEQGg (ORCPT ); Wed, 5 Jun 2019 12:06:36 -0400 Received: from mail.monom.org (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id 0B00250094D; Wed, 5 Jun 2019 18:06:35 +0200 (CEST) Received: from localhost (ppp-93-104-174-142.dynamic.mnet-online.de [93.104.174.142]) by mail.monom.org (Postfix) with ESMTPSA id C27D0500959; Wed, 5 Jun 2019 18:06:34 +0200 (CEST) From: Daniel Wagner To: John Kacur Cc: linux-rt-users@vger.kernel.org, Daniel Wagner Subject: [PATCH v2 08/12] cyclicdeadline: Add duration command line argument Date: Wed, 5 Jun 2019 18:06:13 +0200 Message-Id: <20190605160617.22987-9-wagi@monom.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190605160617.22987-1-wagi@monom.org> References: <20190605160617.22987-1-wagi@monom.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-rt-users-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org 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 cyclicdeadline -D 10m Signed-off-by: Daniel Wagner --- src/sched_deadline/cyclicdeadline.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c index 6d461b27ac43..47892daf747b 100644 --- a/src/sched_deadline/cyclicdeadline.c +++ b/src/sched_deadline/cyclicdeadline.c @@ -21,6 +21,8 @@ #include #include +#include + #ifdef __i386__ #ifndef __NR_sched_setattr #define __NR_sched_setattr 351 @@ -1049,6 +1051,7 @@ int main (int argc, char **argv) unsigned int interval = 1000; unsigned int step = 500; int percent = 60; + int duration = 0; u64 runtime; u64 start_period; u64 end_period; @@ -1062,7 +1065,7 @@ int main (int argc, char **argv) exit(-1); } - while ((c = getopt(argc, argv, "+hac:i:s:t:")) >= 0) { + while ((c = getopt(argc, argv, "+hac:i:s:t:D:")) >= 0) { switch (c) { case 'a': all_cpus = 1; @@ -1081,6 +1084,9 @@ int main (int argc, char **argv) case 't': nr_threads = atoi(optarg); break; + case 'D': + duration = parse_time_string(optarg); + break; case 'h': default: usage(argv); @@ -1246,6 +1252,10 @@ int main (int argc, char **argv) signal(SIGINT, sighand); signal(SIGTERM, sighand); + signal(SIGALRM, sighand); + + if (duration) + alarm(duration); if (!fail) loop(sched_data, nr_threads); -- 2.20.1