From patchwork Wed Jun 5 16:06:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 165906 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7548128ili; Wed, 5 Jun 2019 09:06:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdNxVDmdAlDoVPMwu/9Eb0ZIcGkIElYd4jY4bNC4BFxchOpmofuFnNm8f1hft9MF3MD/2l X-Received: by 2002:a17:90a:af8b:: with SMTP id w11mr45329764pjq.135.1559750798667; Wed, 05 Jun 2019 09:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559750798; cv=none; d=google.com; s=arc-20160816; b=i1jJR7YTlsenaWmkUDsJ8jWS3AN3HwXOIQEJAK0i/xm3lM/Vi7zrJ82mDLfhHGLsxp rkFS4BY8bAWHGUFRqS0+FlPPdo2dtzZbIjKmLyf5x9Ene7h5j4jAvUm1l7Dgf3TcmOSU tUbPSxaxMhpjbUZrzupq97o2oOLJi8HZU8LIl6kYl9Rks1QpYVN8dVRR/2B4jpsS5qnl dczGACEfSiMqCR9R3WCyBFlnWJ57qALLGOXva2HuEtMq4TJlbOc4zd2PtNCBMMMJNnCp vrvZF+m7/v1+LNIyyEi1IkDOuoT4+QTPK+aNzXaSjYAOZ2HNFYP545bhBoGl1S1vwdJs yZ4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Iiemsgz3cTwcb8zhtBiXVjPX1yTZS1km0vGJBbjXcy0=; b=rPY+edlyYmCX3sfGjawuybgbfYpMUrvt9A3GW19cnEbtomV01LCSaXYvG+gE69wmlb qrmLTITOrAIMhMCPFJLk2sF3Ijr2Szf/7yPUNg259Sd5EDtgvUALyum/YGvwcnT9yzAT SywRZdNTvzcQ21CAXA9qTvC+sQb4XejQpCdKOwzHEVwv6Tk+uXJsmosyAvc69dJji3bC cU/aBg6dPRPg4YqMcK4MHJaA9Ut5GI9wM1lwmo5pUxa0wwlwe76x7iLrU+0ksyLdWUTR w4nEPuX8Il9IwDjOZlTpFVNj/RJArhxW0ndKw7g6iCzi25VcLVMOkGgRaTiLUrhOicN9 hzsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-rt-users-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-rt-users-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6si27364257pgm.101.2019.06.05.09.06.38; Wed, 05 Jun 2019 09:06:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-rt-users-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-rt-users-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-rt-users-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=monom.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728647AbfFEQGh (ORCPT + 3 others); 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.monom.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.2 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 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(-) -- 2.20.1 Signed-off-by: John Kacur Signed-off-by: John Kacur 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);