From patchwork Wed Aug 9 19:37:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luc Van Oostenryck X-Patchwork-Id: 9891721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B7B89602D7 for ; Wed, 9 Aug 2017 19:39:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A96D6283AD for ; Wed, 9 Aug 2017 19:39:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E2CE2832D; Wed, 9 Aug 2017 19:39:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32DE52832D for ; Wed, 9 Aug 2017 19:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751913AbdHITjA (ORCPT ); Wed, 9 Aug 2017 15:39:00 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36582 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751903AbdHITi7 (ORCPT ); Wed, 9 Aug 2017 15:38:59 -0400 Received: by mail-wm0-f66.google.com with SMTP id d40so611487wma.3 for ; Wed, 09 Aug 2017 12:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h9240Zqdv3MPLhSURH95GY1vKgYN6Idz6wPb1by6wUw=; b=jjq7K57SahJrUsBTDlLHDFOI/9mSefj4BNN5UJYsYXPdXICfcKXFAjpjZqd4WSTq1Y aXMDD5w5ipwHM3iTI8V4Fw+Dfkk8ZyM/pNIj1e2uTaCi3OodPC5oRhMOmRXt6GfTnZfR VCgrrCZkoIcXaWfEGjIgARulerWLVbDeiA18zev1ve9vCWK2zf0o3Vu7S8gl8OORmR3X J8tNpSfYmwajrlJzyZWLXxNMjtU4kPuqssPqFd51yAp8MbkXyrRmG9a2V3dIeKs3Gkj0 L3ARwp3T1SRyTziirBtKQ5obrJSPaP+vcprkj2jWcNe8qYQrK+3bZtO1nM3jNxS1g1o4 oW7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=h9240Zqdv3MPLhSURH95GY1vKgYN6Idz6wPb1by6wUw=; b=iM8sv2IYCWOdUbrROx9gb3bJWip9wdG1IZEYZDqY0VJGohoWPd2f1dRtfQLBaHEjaP akROKXThz6sNslC9hrFh/oR7T5s22aClbHNRanXEDOuWsLICWFnI3u5/Kzh6Ew+gxN+7 maDK9+MPVdcQEjXmtDkuhFnouhsQnp6Py8d9fVh/S+lFTq10ITWBr2ZpWB12cF+Y200G aEo74TkPqcGtx+z212Z2zCvQMV3dJOf03ooTofWg9eBC+nLq3ymxvoKNQvMs8VsaaG7O W8P2w37cbDAAB95VpQ+zW2+qxKmJ/ywJ/LUpOPSjxzDtvF4L8Ulk3g8MfhUSe4uljWpE m16A== X-Gm-Message-State: AHYfb5hkXaugLCfdD8TJ2kGZ3J6hDd3LVv+X3mQ8G56t/EwEioO5Z3mu lRx8TAE0sA8Q24jGyrg= X-Received: by 10.80.204.137 with SMTP id q9mr9584475edi.255.1502307537948; Wed, 09 Aug 2017 12:38:57 -0700 (PDT) Received: from localhost.localdomain ([2a02:a03f:4076:600:a54f:2a42:70ce:5bd2]) by smtp.gmail.com with ESMTPSA id t36sm2984437edb.38.2017.08.09.12.38.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Aug 2017 12:38:57 -0700 (PDT) From: Luc Van Oostenryck To: linux-sparse@vger.kernel.org Cc: Christopher Li , Luc Van Oostenryck Subject: [PATCH v4 1/9] testsuite: add support for commands with timeout Date: Wed, 9 Aug 2017 21:37:58 +0200 Message-Id: <20170809193806.30975-2-luc.vanoostenryck@gmail.com> X-Mailer: git-send-email 2.14.0 In-Reply-To: <20170809193806.30975-1-luc.vanoostenryck@gmail.com> References: <20170809193806.30975-1-luc.vanoostenryck@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Tests taking a huge or infinite amout of time is a problem for the testsuite. Furthermore, it's most often the sign of a problem somewhere. Fix this by adding some support to use an optional timeout for each testcase command. Signed-off-by: Luc Van Oostenryck --- Documentation/test-suite | 4 ++++ validation/infinite-loop0.c | 12 ++++++++++++ validation/test-suite | 7 +++++++ 3 files changed, 23 insertions(+) create mode 100644 validation/infinite-loop0.c diff --git a/Documentation/test-suite b/Documentation/test-suite index 2e786bbf3..a288c81a5 100644 --- a/Documentation/test-suite +++ b/Documentation/test-suite @@ -25,6 +25,10 @@ check-command: (optional) check-exit-value: (optional) The expected exit value of check-command. It defaults to 0. +check-timeout: (optional) + The maximum expected duration of check-command, in seconds. + It defaults to 1. + check-output-start / check-output-end (optional) The expected output (stdout and stderr) of check-command lies between those two tags. It defaults to no output. diff --git a/validation/infinite-loop0.c b/validation/infinite-loop0.c new file mode 100644 index 000000000..a28492307 --- /dev/null +++ b/validation/infinite-loop0.c @@ -0,0 +1,12 @@ +void foo(void) +{ + int a = a || 0; + if (a) ; +} + +/* + * check-name: internal infinite loop (0) + * check-command: sparse -Wno-decl $file + * check-timeout: + * check-known-to-fail + */ diff --git a/validation/test-suite b/validation/test-suite index 3056fce90..cf151a361 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -39,6 +39,7 @@ get_tag_value() check_name="" check_command="$default_cmd" check_exit_value=0 + check_timeout=0 check_known_to_fail=0 check_error_ignore=0 check_output_ignore=0 @@ -56,6 +57,8 @@ get_tag_value() check-name:) check_name="$val" ;; check-command:) check_command="$val" ;; check-exit-value:) check_exit_value="$val" ;; + check-timeout:) [ -z "$val" ] && val=1 + check_timeout="$val" ;; check-known-to-fail) check_known_to_fail=1 ;; check-error-ignore) check_error_ignore=1 ;; check-output-ignore) check_output_ignore=1 ;; @@ -211,6 +214,10 @@ do_test() expected_exit_value=$check_exit_value verbose "Expecting exit value: $expected_exit_value" + # do we want a timeout? + if [ $check_timeout -ne 0 ]; then + cmd="timeout -k 1s $check_timeout $cmd" + fi # grab the actual output & exit value $cmd 1> $file.output.got 2> $file.error.got