From nobody Sat Nov 23 20:38:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1730244197; cv=none; d=zohomail.com; s=zohoarc; b=YAkTA0W2HexM0eCC4DEwQUGb9uOfOO1fWGsZpGp2zcbePETmKBW4DTrydy/XIp8XM8Z5QD3ZjosI53es7Aho7ro+qIyYVAJC6gCGDjU0GgrL4fxh8byp+wQZ8wtrx2Sm69ii26PVK3LLG7qNFXzFoedo9V9dLyjmNR3bssNwxA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730244197; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9BbXIVBdJZZMWwDof7aKer9V95VsJYCKUjtzhRofcng=; b=JWfnawW8TYJAbY1w9q+dqCBtqwjEaw/IPg0ifKJEeX6S7mkJLQ8LRAhkL20vaHdGNfwkogPO7VSiHHBcvG33Dtvu+AjVECISeeOum0DaCtsL2kYeGsaBjyddB6BMHzKLDhQwPu9NGcCFk5QcX1HCYq3w6q2MOvzfAw71glThkOU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730244197283565.0462001084804; Tue, 29 Oct 2024 16:23:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5vXg-0004Do-4G; Tue, 29 Oct 2024 19:22:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5vXc-0004D7-6K for qemu-devel@nongnu.org; Tue, 29 Oct 2024 19:22:24 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5vXa-00045t-E2 for qemu-devel@nongnu.org; Tue, 29 Oct 2024 19:22:23 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49TLKBfW031401; Tue, 29 Oct 2024 23:22:18 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42j3nsusff-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Oct 2024 23:22:18 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 49TNMHXQ030433; Tue, 29 Oct 2024 23:22:18 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42j3nsusfd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Oct 2024 23:22:17 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 49TJXprH024535; Tue, 29 Oct 2024 23:22:17 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 42hcyjd51g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Oct 2024 23:22:16 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 49TNMF0x35521144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Oct 2024 23:22:15 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34A8F20040; Tue, 29 Oct 2024 23:22:15 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C77DC2004B; Tue, 29 Oct 2024 23:22:14 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.12.2]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 29 Oct 2024 23:22:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=9BbXIVBdJZZMWwDof 7aKer9V95VsJYCKUjtzhRofcng=; b=EpfkGEYGN3DNbYStlv8HlHRleOpAVPSII Ai4jWIqPRBOPj5gy5J1AApD94NUFyPyp9QjGl4+VYZP04170POPKLX7HggrdCz6P Vk45MJwQxt5VoLUHrHW2sOmO+auPde2+LHb3oGlFuWbZmRQzFdCcC+61tzL5uqjh 3xEbT+qe/aQIs+NGd+/6I4rnbztoEOeZGsNx624n8ZliV68YXH5ka+1kdRrzgS2J j3muiLKFNjj91oS1JyADNgJAYGhPRIkBDynXw9bDpKJ1OVwnsrIndvV0fuXu9Kkj pHyKe5/X65Bvu4xQ/6dZ3CsyNxTun3TK2fAkPyGJEQY98RuoiIv6g== From: Ilya Leoshkevich To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Cc: qemu-devel@nongnu.org, Michael Tokarev , Brian Cain , "ltaylorsimpson @ gmail . com" , Ilya Leoshkevich Subject: [PATCH v3 2/2] tests/tcg: Add SIGRTMIN/SIGRTMAX test Date: Wed, 30 Oct 2024 00:17:48 +0100 Message-ID: <20241029232211.206766-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241029232211.206766-1-iii@linux.ibm.com> References: <20241029232211.206766-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 41-FSsKq4XLsZ3YEd4b-WjwZpGH21lpB X-Proofpoint-GUID: aSnoV_l9HxwjdReTVJoBpIKLAUpau_ML X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 bulkscore=0 mlxlogscore=897 clxscore=1015 priorityscore=1501 suspectscore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410290175 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1730244197949116600 Content-Type: text/plain; charset="utf-8" Test the lowest and the highest real-time signals. This requires configuring the real-time signal mapping, and therefore some knowledge about the host. To this end, pass the emulator path in the QEMU environment variable to all tests (this should not disturb the existing ones), and assume that all hosts have signals 36-39 available. Signed-off-by: Ilya Leoshkevich --- tests/tcg/Makefile.target | 4 +- tests/tcg/multiarch/linux/linux-sigrtminmax.c | 74 +++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/multiarch/linux/linux-sigrtminmax.c diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 9722145b976..95ff76ea44d 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -179,10 +179,10 @@ run-plugin-%-with-libmem.so: PLUGIN_ARGS=3D$(COMMA)in= line=3Dtrue =20 ifeq ($(filter %-softmmu, $(TARGET)),) run-%: % - $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<) + $(call run-test, $<, env QEMU=3D$(QEMU) $(QEMU) $(QEMU_OPTS) $<) =20 run-plugin-%: - $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + $(call run-test, $@, env QEMU=3D$(QEMU) $(QEMU) $(QEMU_OPTS) \ -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \ -d plugin -D $*.pout \ $(call strip-plugin,$<)) diff --git a/tests/tcg/multiarch/linux/linux-sigrtminmax.c b/tests/tcg/mult= iarch/linux/linux-sigrtminmax.c new file mode 100644 index 00000000000..a7059aacd9c --- /dev/null +++ b/tests/tcg/multiarch/linux/linux-sigrtminmax.c @@ -0,0 +1,74 @@ +/* + * Test the lowest and the highest real-time signals. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include +#include +#include +#include + +/* For hexagon and microblaze. */ +#ifndef __SIGRTMIN +#define __SIGRTMIN 32 +#endif + +extern char **environ; + +static bool seen_sigrtmin, seen_sigrtmax; + +static void handle_signal(int sig) +{ + if (sig =3D=3D SIGRTMIN) { + seen_sigrtmin =3D true; + } else if (sig =3D=3D SIGRTMAX) { + seen_sigrtmax =3D true; + } else { + _exit(1); + } +} + +int main(int argc, char **argv) +{ + char *qemu =3D getenv("QEMU"); + struct sigaction act; + + assert(qemu); + + if (!getenv("QEMU_RTSIG_MAP")) { + char **new_argv =3D malloc((argc + 2) + sizeof(char *)); + int tsig1, hsig1, count1, tsig2, hsig2, count2; + char rt_sigmap[64]; + + /* Re-exec with a mapping that includes SIGRTMIN and SIGRTMAX. */ + new_argv[0] =3D qemu; + memcpy(&new_argv[1], argv, (argc + 1) * sizeof(char *)); + tsig1 =3D __SIGRTMIN; + /* The host must have a few signals starting from this one. */ + hsig1 =3D 36; + count1 =3D SIGRTMIN - __SIGRTMIN + 1; + tsig2 =3D SIGRTMAX; + hsig2 =3D hsig1 + count1; + count2 =3D 1; + snprintf(rt_sigmap, sizeof(rt_sigmap), "%d %d %d,%d %d %d", + tsig1, hsig1, count1, tsig2, hsig2, count2); + setenv("QEMU_RTSIG_MAP", rt_sigmap, 0); + assert(execve(new_argv[0], new_argv, environ) =3D=3D 0); + return EXIT_FAILURE; + } + + memset(&act, 0, sizeof(act)); + act.sa_handler =3D handle_signal; + assert(sigaction(SIGRTMIN, &act, NULL) =3D=3D 0); + assert(sigaction(SIGRTMAX, &act, NULL) =3D=3D 0); + + assert(kill(getpid(), SIGRTMIN) =3D=3D 0); + assert(seen_sigrtmin); + assert(kill(getpid(), SIGRTMAX) =3D=3D 0); + assert(seen_sigrtmax); + + return EXIT_SUCCESS; +} --=20 2.47.0