From patchwork Wed Jun 5 16:06:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 165911 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7548155ili; Wed, 5 Jun 2019 09:06:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhfl0qjhDvgcmCwv2oCgFD5E+aZ7aDWrr/3RYqQd/escDLSUWWEFZDtTU8ydVwY32v4ZTH X-Received: by 2002:a17:902:b94a:: with SMTP id h10mr44794211pls.265.1559750799719; Wed, 05 Jun 2019 09:06:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559750799; cv=none; d=google.com; s=arc-20160816; b=HH1cR9XDHzIW0MWbH3td76vLVc564b/KJw153qUbcN9yiMA1A1pg4reM7EgBTXG90s kgqmi07oRo7IDkM8CO3q1sA2mwBDnRIw6kc85K4Teaas0SHOIpARkpVMKKq+EeF66EGW FIxrjDpczkLhD0lvdI1ZI26yjE6+6JE3baFuOniTBB6YaXUxDCTx+YMeyHFoqk590uQC FdKaCvgG1hREwPJpiWIkWOByRV6RGBtwqbrvkJvdJegQbAMstR7MRr0DZvWfr8ZwDyAF 8CXOA3MhAjwtC83xUy2CO7LV5OxoQHKz/LYXxUQLhisYsSey4zNG4BmlgWG1ss+8rfTn Tkzg== 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=y8pf46kAQ6h2nG1I+qSEV0GfA/g0X8w6YruXz+zjpUk=; b=07eJ17ockAq7c/NVu1VRsISnTgvL2fO9DSjUTOeVq07tTQEiP13nw5ZvRzLYhyfsrR uBXCh/0vIxMOCyhu0oHURNd6sPyCThHByjRn59LE2IgszZm+QSbrswd72EqvzsdK4pZZ Rl0pjBe3/IfDkiTF+7buIw98K9cY5s/kMDS7FDVltPeJ0CEksS32RL7Yy/k5ZKCxKy0H rAVxiCujMqTmisZ+AUniaOkI8HXzJCOiY4XEKNOxjCmf5d+J6i4VF0EB5U54qwxx04lG 64F1tfuW41lkW4oXYXPDu0QXOLqbNxie1iJdbanxhy0vWipMrAnlKYolslrhiIFjmjbn zQGQ== 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.39; Wed, 05 Jun 2019 09:06:39 -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 S1728648AbfFEQGj (ORCPT + 3 others); Wed, 5 Jun 2019 12:06:39 -0400 Received: from mail.monom.org ([188.138.9.77]:35618 "EHLO mail.monom.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728560AbfFEQGi (ORCPT ); Wed, 5 Jun 2019 12:06:38 -0400 Received: from mail.monom.org (localhost [127.0.0.1]) by filter.mynetwork.local (Postfix) with ESMTP id D375F5009AE; 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 95A95500959; Wed, 5 Jun 2019 18:06:35 +0200 (CEST) From: Daniel Wagner To: John Kacur Cc: linux-rt-users@vger.kernel.org, Daniel Wagner Subject: [PATCH v2 09/12] signaltest: Add duration command line argument Date: Wed, 5 Jun 2019 18:06:14 +0200 Message-Id: <20190605160617.22987-10-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 signaltest -D 10m Signed-off-by: Daniel Wagner --- src/signaltest/signaltest.8 | 5 +++++ src/signaltest/signaltest.c | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) -- 2.20.1 Signed-off-by: John Kacur 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 \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)