From patchwork Fri Apr 12 00:11:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10897103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCC4F17EF for ; Fri, 12 Apr 2019 00:11:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A646928D84 for ; Fri, 12 Apr 2019 00:11:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A386C28E33; Fri, 12 Apr 2019 00:11:12 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 537BA28E2D for ; Fri, 12 Apr 2019 00:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727315AbfDLALL (ORCPT ); Thu, 11 Apr 2019 20:11:11 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34595 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727314AbfDLALL (ORCPT ); Thu, 11 Apr 2019 20:11:11 -0400 Received: by mail-pf1-f193.google.com with SMTP id b3so4234529pfd.1 for ; Thu, 11 Apr 2019 17:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=6OeTWA9VQSd3NbwEDeXQUKakof8cdRIwi/Z/BNNmjCA=; b=WPRcOlBvuy0aTnPUV4isEKo9st3ofkrxAsF+2Vgnj3mvemy/IuWuSzSkeYceYQyOY4 NeSOlVC/wcHIPISuL8R0VaVlK825KEMTFqUYhr0JQnAR8qBXOtN3fxfZHbx0kgpA8CZD 6P2z3VSg+Pqd6vViuxkzdBephpHeiQue4j4Ss= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=6OeTWA9VQSd3NbwEDeXQUKakof8cdRIwi/Z/BNNmjCA=; b=rgzUoKjjVceBoAk5Urpm7Pia8uNwcRALInGxm2VyCA6Pl3bU1SaY7tbRP+lAYBdeSE /ctCRiP9qZG8Gc2W93Ef4HxKrYp+cnBRgaFHbo3FmENj/goeY86qZvTNJU1+tGEqdJkx CDkcUXMFsv0oRKg+tpBnSotP2aV7y7WU34JFZVN4X3/COX8G2HNBB4bPr+wqTicBtQCQ H980B+JVhs45nBHZGgJugwim3QAfGmPcBz1cTGixrj5MeRKO3ahfGfIT6DBTQT1bj5aw t3k7FsRCmZ4Kb14fIjqlWVYWbwbk4V9hw2wAc5YHiK3Ib6qQjeqTMUiYVeSDDHGbpL65 d8mg== X-Gm-Message-State: APjAAAXjmqH/jqiBEjTWYkzpokJK+4WCzY4I0IVtB/3qQQYypA6/DfYC lgnDlVp+CPdi4nUEkLN1FIYTnw== X-Google-Smtp-Source: APXvYqxHAXMuO4byLy8md2p5UxIGKasqS+wXkSMF+NQkLI/oGPfi3IhhJGYZ83VhqcFtDQWoe74fVg== X-Received: by 2002:a63:720c:: with SMTP id n12mr50217088pgc.348.1555027870565; Thu, 11 Apr 2019 17:11:10 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id g67sm61418544pfg.94.2019.04.11.17.11.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2019 17:11:09 -0700 (PDT) Date: Thu, 11 Apr 2019 17:11:08 -0700 From: Kees Cook To: Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH] selftests/harness: Add 30 second timeout per test Message-ID: <20190412001108.GA3576@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In order to keep tests from hanging forever, this adds an alarm signal to each test run. This assumes an individual test doesn't take longer than 30 seconds. Signed-off-by: Kees Cook --- tools/testing/selftests/kselftest_harness.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index 2d90c98eeb67..941d9391377f 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -696,6 +696,7 @@ void __run_test(struct __test_metadata *t) t->passed = 1; t->trigger = 0; printf("[ RUN ] %s\n", t->name); + alarm(30); child_pid = fork(); if (child_pid < 0) { printf("ERROR SPAWNING TEST CHILD\n"); @@ -744,6 +745,7 @@ void __run_test(struct __test_metadata *t) } } printf("[ %4s ] %s\n", (t->passed ? "OK" : "FAIL"), t->name); + alarm(0); } static int test_harness_run(int __attribute__((unused)) argc,