From patchwork Thu Feb 20 14:34:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 183669 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp651104ile; Thu, 20 Feb 2020 06:34:25 -0800 (PST) X-Google-Smtp-Source: APXvYqz+X9STws+QKiMy16QHs9vejiCxE9HmSGCko595lf4GDSXd/K4DUz+acQfhxQaGyOHBn/uh X-Received: by 2002:a54:468a:: with SMTP id k10mr2324338oic.3.1582209264614; Thu, 20 Feb 2020 06:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582209264; cv=none; d=google.com; s=arc-20160816; b=Nq99t5703TaZarvdZOx/SuX3Hyxo1qfT9HZg/v6kWQPSJ9p+o+QLCpSdP4/iMF5LwZ uZQNtx9whyAtInJOu3gMSjmwQ43nn8eFf+PK2nTN2P92rFGNIJ6O6LdYxqoMWrhzt9JG WrB6/wN9+xXgX9p8367QFz6UM+rRP1domYEzCuWCACjuoySKcjl29fZvPrbq2xyXEusF VT+xkyrmTs6uvNmKGYVVRJdnbkkqnkU2t7sngMvWrD2mXuitsrOXpMHh/yAxLdDKQEGI 0cypVTM3ksKslCtz7vwUNZ9IxenlehUF56Fa0Ai2AYrfdkcklbR8ncxJ0oQX9UKP7prY 9ANg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=jZj+M59spw/mIf/dTI2jIVGBwiO0iqCGgXe9nJ9TrTM=; b=qdDnRejdnJzLKQF21PakOr9KQWqfKP4P1J3NxRa7juZIHJS+pFq4rzjOcKfAUs0+lt J058xCvOeEVuU58k3J23jRbf0DzMDFKlBgyF9cftIowBX5Ry9mx5eiAMyD/n1/c0I3ef BkPcRlmqp92jl0B28URxD1COuOxX/UVbXVSvQ0cVgjcnGhXIA0Sz8Dg1g/ZYW5eBdNWs G0YpfdMzn7qMertK03P3ipSAs18XpJhcmuBX0mww2wF3KTsCQSzI8sSy1uMXuaudnTBd jK0YdJTiEOuca797jU3IoyKVJDp+/PzUm/Dm/yrIWe2Uvb2W8m1XKmFwR5dC2D9w62l9 bOtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WG9CvQi8; dkim=pass header.i=@linaro.org header.s=google header.b=WXTJSAHz; spf=pass (google.com: domain of libc-alpha-return-109964-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109964-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l80si10933783oib.268.2020.02.20.06.34.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Feb 2020 06:34:24 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109964-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WG9CvQi8; dkim=pass header.i=@linaro.org header.s=google header.b=WXTJSAHz; spf=pass (google.com: domain of libc-alpha-return-109964-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109964-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=eKW63w4c0mXUgK4GoCpMWxCQmP2w9EzF2fBck2m/iu7CSpZnXwPra 6UIOLI3pE/+eZf+mHB5ZjY0GRd0Xqny212B3Wz/9eoSftG7VlBYwJMXNA43J3i1N LjZi2rhJ9kvVriYfauN3Sjza86EMBde+FQXgy9EAEyl+IuQjzb+Rkk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=qhSpGu/bHZgtg+AU6zsqX2cx5f4=; b=WG9CvQi8RCzx8fzOKh9IDUkD6mTd IuLuNY6e658gJcfmE6yajc6IE8zztgneEuBiRB6AJ/cd5C7yQt+OxuO+edNaLDWY FsEx5Drho5NYpGBBtFRDgKX4wY/fOupnDFyEGMZ3Z9LJt0Z7cuyBWgogsYkxdQKJ DlqbZbWTG6zXvNM= Received: (qmail 105050 invoked by alias); 20 Feb 2020 14:34:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 105036 invoked by uid 89); 20 Feb 2020 14:34:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=jZj+M59spw/mIf/dTI2jIVGBwiO0iqCGgXe9nJ9TrTM=; b=WXTJSAHz6w6kkNVS9hUkPw69Vp/mzui34NSMr5nlGs2R2/KFO2CSxoiqcRMMvGW5mu 2fLdKyn1uO74aMBTQRoR/85rbIzUkt5fHcGb02kCql2WKwd85w8byU763YvN/ot07+4q YWKIKY9/Vqaq9BfvhU9dSDd4EEiWIyGXm1In+wRNcV6p/AJneEs0vO3cICQzWTLdhILE eP6Ol5BfAtm9sCvATCsUtO2nnT1Ttfoj+XnNNrHoJq4TVmUBG8WOpWM+Y5uXKcpEGTw0 IIHvoBrh2UTIe+EflP7VVvgNRQpfpypF5ekqrzg/WFtYW0i1q8drYO8dlgE+dmrv62Pw NnGQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] support: Kill process group for test failure Date: Thu, 20 Feb 2020 11:34:06 -0300 Message-Id: <20200220143406.4768-1-adhemerval.zanella@linaro.org> Some testcases that create multiple subprocesses might abort or exit prior waiting for their children. In such case, support_test_main does not try to kill the spawned test process group (as in the test timeout case). On example that we are observing in internal tests is when malloc/tst-mallocfork2 fails to fork in the signal handling (due either maximum number of process or other non expected failure). This patch kill the process group in the case of failed execution, similar on how it is done on timeout. Checked on x86_64-linux-gnu. --- support/support_test_main.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 Reviewed-by: Carlos O'Donell diff --git a/support/support_test_main.c b/support/support_test_main.c index e3f0bf15f2..ac9f710fb7 100644 --- a/support/support_test_main.c +++ b/support/support_test_main.c @@ -459,6 +459,9 @@ support_test_main (int argc, char **argv, const struct test_config *config) /* Process terminated normaly without timeout etc. */ if (WIFEXITED (status)) { + /* It is expected that a successful test execution handles all its + children. */ + if (config->expected_status == 0) { if (config->expected_signal == 0) @@ -486,6 +489,10 @@ support_test_main (int argc, char **argv, const struct test_config *config) /* Process was killed by timer or other signal. */ else { + /* Kill the whole process group if test process aborts or exits prior + waiting for them. */ + kill (-test_pid, SIGKILL); + if (config->expected_signal == 0) { printf ("Didn't expect signal from child: got `%s'\n",