From patchwork Wed Sep 23 13:47:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11795087 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBA826CA for ; Wed, 23 Sep 2020 13:48:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8E02221EB for ; Wed, 23 Sep 2020 13:48:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="SYszFwl8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbgIWNsO (ORCPT ); Wed, 23 Sep 2020 09:48:14 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:7640 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726504AbgIWNsO (ORCPT ); Wed, 23 Sep 2020 09:48:14 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08NDXC84169216; Wed, 23 Sep 2020 09:48:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=uFqSzS8d52K8BKRJGWGm9lEoGlzK7xsvYKmeKqlNQ4k=; b=SYszFwl8dBqhWHP/EG82THOLEqlwgqamfZEBCTIW/b2qB8vWccBf6lsNY7by4PBDoGH0 w84mEIop/w3VwMKP7f3mH52YzAgEs/fccqAquZS5hOPmsopNSN6ZwDbjuLaEOl2Zrmct ursMCFNtOk2TjUk1jC6tmcD0hcXQokgZUpjytcom/BPfb8DWY3gjG0/sHGsJsw0gm1ed Lwxq5vxbnoQ96rfZcHCfg6/LR7HZvV2MuMR+3fJ4kclwHoZuYkcX/YP58yBY9H5diw2o lshjktH6+Wd1Kgt2CFDsw0gtubMj3oxLDRQT/ccnZNoa917qPH/6Ld+qZmRJyWEUxkJn FQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33r5bnmx0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:13 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08NDYESs173368; Wed, 23 Sep 2020 09:48:13 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 33r5bnmwyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:12 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08NDgHBx029999; Wed, 23 Sep 2020 13:48:10 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 33payuay7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 13:48:10 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08NDm8VY12190132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Sep 2020 13:48:08 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 500074C04A; Wed, 23 Sep 2020 13:48:08 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F227C4C046; Wed, 23 Sep 2020 13:48:07 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.64.218]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 23 Sep 2020 13:48:07 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , linux-s390@vger.kernel.org Subject: [PATCH kvm-unit-tests v2 1/4] common.bash: run `cmd` only if a test case was found Date: Wed, 23 Sep 2020 15:47:55 +0200 Message-Id: <20200923134758.19354-2-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923134758.19354-1-mhartmay@linux.ibm.com> References: <20200923134758.19354-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-23_09:2020-09-23,2020-09-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 bulkscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 malwarescore=0 phishscore=0 impostorscore=0 clxscore=1015 suspectscore=15 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009230108 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org It's only useful to run `cmd` in `for_each_unittest` if a test case was found. This change allows us to remove the guards from the functions `run_task` and `mkstandalone`. Reviewed-by: Andrew Jones Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Signed-off-by: Marc Hartmayer --- run_tests.sh | 3 --- scripts/common.bash | 8 ++++++-- scripts/mkstandalone.sh | 4 ---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index fc4b3c23d886..12b63954721d 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -133,9 +133,6 @@ RUNTIME_log_stdout () { function run_task() { local testname="$1" - if [ -z "$testname" ]; then - return - fi while (( $(jobs | wc -l) == $unittest_run_queues )); do # wait for any background test to finish diff --git a/scripts/common.bash b/scripts/common.bash index 9a6ebbd7f287..96655c9ffd1f 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -17,7 +17,9 @@ function for_each_unittest() while read -r -u $fd line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ -n "${testname}" ]; then + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi testname=${BASH_REMATCH[1]} smp=1 kernel="" @@ -45,6 +47,8 @@ function for_each_unittest() timeout=${BASH_REMATCH[1]} fi done - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ -n "${testname}" ]; then + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi exec {fd}<&- } diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index 9d506cc95072..cefdec30cb33 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -83,10 +83,6 @@ function mkstandalone() { local testname="$1" - if [ -z "$testname" ]; then - return - fi - if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then return fi From patchwork Wed Sep 23 13:47:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11795093 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC3926CA for ; Wed, 23 Sep 2020 13:48:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFF9C2220D for ; Wed, 23 Sep 2020 13:48:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="sBmB53eA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbgIWNsP (ORCPT ); Wed, 23 Sep 2020 09:48:15 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:16136 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726534AbgIWNsP (ORCPT ); Wed, 23 Sep 2020 09:48:15 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08NDXKxt028847; Wed, 23 Sep 2020 09:48:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=6VjfSkbUVoJ/rM/fk2QBzWFUj0lfs/Hw9kAtyQ/FnWI=; b=sBmB53eAoNlxYgsZtRv6e5Q5LJVwJOO6O7aJTLno5htczW7644ciV8vlFZSjGvdF6KHO tLrnHHqewSUK+NYwWf9PoJUd7uoU3CHUHS/EED4M2tpFn10mqalvg5rbJeYm9/DaLHeI ursdY51b+9PytbSVw8jg9fgNokuJ467J/qQcmR5bDJSKFctuKfJ/wTf7dc6Vf5bCo5/5 W1ekH73kDhJoS9SCD0nfuC/hPtOZnOwe78AIVQphmxDbVqlT5Z6aEGQ9HVzfXP/MnCIj soRzEv5OuF+OwG0OkrJYwoYrFdauqO5jVQ5mp1iNo9rm/WEX0joXrV91d1dsBy/LcOhJ Vw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33r5wf3r2n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:14 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08NDYgpi034411; Wed, 23 Sep 2020 09:48:14 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 33r5wf3r1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:13 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08NDlnPG029282; Wed, 23 Sep 2020 13:48:11 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma01fra.de.ibm.com with ESMTP id 33n9m7t6c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 13:48:11 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08NDm8U825756016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Sep 2020 13:48:09 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDE774C059; Wed, 23 Sep 2020 13:48:08 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BE564C044; Wed, 23 Sep 2020 13:48:08 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.64.218]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 23 Sep 2020 13:48:08 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , linux-s390@vger.kernel.org Subject: [PATCH kvm-unit-tests v2 2/4] scripts: add support for architecture dependent functions Date: Wed, 23 Sep 2020 15:47:56 +0200 Message-Id: <20200923134758.19354-3-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923134758.19354-1-mhartmay@linux.ibm.com> References: <20200923134758.19354-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-23_09:2020-09-23,2020-09-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=15 priorityscore=1501 adultscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009230103 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This is necessary to keep architecture dependent code separate from common code. Reviewed-by: Andrew Jones Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Signed-off-by: Marc Hartmayer --- README.md | 3 ++- scripts/common.bash | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48be206c6db1..24d4bdaaee0d 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ all unit tests. ## Directory structure .: configure script, top-level Makefile, and run_tests.sh - ./scripts: helper scripts for building and running tests + ./scripts: general architecture neutral helper scripts for building and running tests + ./scripts/: architecture dependent helper scripts for building and running tests ./lib: general architecture neutral services for the tests ./lib/: architecture dependent services for the tests ./: the sources of the tests and the created objects/images diff --git a/scripts/common.bash b/scripts/common.bash index 96655c9ffd1f..c7acdf14a835 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -1,3 +1,4 @@ +source config.mak function for_each_unittest() { @@ -52,3 +53,10 @@ function for_each_unittest() fi exec {fd}<&- } + +# The current file has to be the only file sourcing the arch helper +# file +ARCH_FUNC=scripts/${ARCH}/func.bash +if [ -f "${ARCH_FUNC}" ]; then + source "${ARCH_FUNC}" +fi From patchwork Wed Sep 23 13:47:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11795089 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64C816CA for ; Wed, 23 Sep 2020 13:48:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F44D21D92 for ; Wed, 23 Sep 2020 13:48:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="io1gICME" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726603AbgIWNsQ (ORCPT ); Wed, 23 Sep 2020 09:48:16 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48366 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726504AbgIWNsP (ORCPT ); Wed, 23 Sep 2020 09:48:15 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08NDjpCQ072552; Wed, 23 Sep 2020 09:48:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=HKrkWBEuFGWFXMFgwqcloq7fR6fgdbqjq9vYv+wKCdo=; b=io1gICMEW4/EWwKqHx45VNcDQ/Z0b0AddPMrglGMdwzr/sr+Kl3saO5kdJ5sG1G3M497 A+fc4m7Ty07A4r4GrnqTlseQPJGcNQ49Lt74YswPqhG54Nhp5omX8tD5dxAz9JzPGSHd s2CfZp7iVrDNglIaI2WEjtvC03s8HCdyeai/s6O8UiG4wKxOSH19MLs6ZDs+w+Ur1oiC zPhBUofVBh8sBV5a6luk66UNg1bGdAMFAV3tWVrEb4QdokqcyC/qbcCf9ymzgSbGopEi n5uzSFpj4UeAtLHYrplJ34GXN6yexZ60tDEzphP7fmFxsm/j/tvVXvVOqBBK7WlYst7+ xA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 33r7hk817a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:14 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08NDlnCI076303; Wed, 23 Sep 2020 09:48:13 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 33r7hk816v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:13 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08NDkjtU025166; Wed, 23 Sep 2020 13:48:11 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 33n9m8c732-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 13:48:11 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08NDm9HH27197832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Sep 2020 13:48:09 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 406C74C059; Wed, 23 Sep 2020 13:48:09 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D79194C044; Wed, 23 Sep 2020 13:48:08 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.64.218]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 23 Sep 2020 13:48:08 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , linux-s390@vger.kernel.org Subject: [PATCH kvm-unit-tests v2 3/4] run_tests/mkstandalone: add arch_cmd hook Date: Wed, 23 Sep 2020 15:47:57 +0200 Message-Id: <20200923134758.19354-4-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923134758.19354-1-mhartmay@linux.ibm.com> References: <20200923134758.19354-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-23_09:2020-09-23,2020-09-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=981 spamscore=0 suspectscore=13 adultscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 phishscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009230108 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This allows us, for example, to auto generate a new test case based on an existing test case. Reviewed-by: Andrew Jones Reviewed-by: Cornelia Huck Reviewed-by: David Hildenbrand Signed-off-by: Marc Hartmayer --- scripts/common.bash | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/common.bash b/scripts/common.bash index c7acdf14a835..a6044b7c6c35 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -19,7 +19,7 @@ function for_each_unittest() while read -r -u $fd line; do if [[ "$line" =~ ^\[(.*)\]$ ]]; then if [ -n "${testname}" ]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" fi testname=${BASH_REMATCH[1]} smp=1 @@ -49,11 +49,16 @@ function for_each_unittest() fi done if [ -n "${testname}" ]; then - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + $(arch_cmd) "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" fi exec {fd}<&- } +function arch_cmd() +{ + [ "${ARCH_CMD}" ] && echo "${ARCH_CMD}" +} + # The current file has to be the only file sourcing the arch helper # file ARCH_FUNC=scripts/${ARCH}/func.bash From patchwork Wed Sep 23 13:47:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11795095 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49A1E6CA for ; Wed, 23 Sep 2020 13:48:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 256AE221F0 for ; Wed, 23 Sep 2020 13:48:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="iu+eZu+7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbgIWNsU (ORCPT ); Wed, 23 Sep 2020 09:48:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:53358 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726550AbgIWNsQ (ORCPT ); Wed, 23 Sep 2020 09:48:16 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08NDWNKI178002; Wed, 23 Sep 2020 09:48:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=SbE/vsOJaxUSDQXMjtRFfmXi25d37+6rMs0F1MCubSo=; b=iu+eZu+7vZ8RMl4dWDACBO9eo1/XhLvE3eIX5JWLVjnlqOImw+LZnuqfGdAHM5M1BJiw qbKOdnTle1vtoEnzjEAbImxTzG1qRf1qVkhFeTGF98v/hhuTAVIkvoUPHnfTaxwpS7m1 osSvPXhRfHM1qEySFL55synasEOONhnebszBF28TB4SbtJSln1XNOfmPwXveC1NnglGB Hm+3+0oTVYjll1dXtyUY5S2gg78EtUFtX6WTAlsrBSVy94AHWAIPdcHbbAUYlK9UxPEg 07+VjVaeMKMbMO2QDILkUbtlQ1dxCT9+7v00/71X4CIfNMEmFiK9uIOlT5U5XDYOuBIJ +A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 33r3tgqrxt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:14 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08NDWf0W179946; Wed, 23 Sep 2020 09:48:14 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 33r3tgqrwj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 09:48:14 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08NDlowB029285; Wed, 23 Sep 2020 13:48:12 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 33n9m7t6c6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Sep 2020 13:48:12 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08NDm9LV25493790 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Sep 2020 13:48:10 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC4E34C05C; Wed, 23 Sep 2020 13:48:09 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5093B4C050; Wed, 23 Sep 2020 13:48:09 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.64.218]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 23 Sep 2020 13:48:09 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , linux-s390@vger.kernel.org Subject: [PATCH kvm-unit-tests v2 4/4] s390x: add Protected VM support Date: Wed, 23 Sep 2020 15:47:58 +0200 Message-Id: <20200923134758.19354-5-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200923134758.19354-1-mhartmay@linux.ibm.com> References: <20200923134758.19354-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-23_09:2020-09-23,2020-09-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 spamscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 suspectscore=13 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009230103 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add support for Protected Virtual Machine (PVM) tests. For starting a PVM guest we must be able to generate a PVM image by using the `genprotimg` tool from the s390-tools collection. This requires the ability to pass a machine-specific host-key document, so the option `--host-key-document` is added to the configure script. Reviewed-by: Janosch Frank Signed-off-by: Marc Hartmayer Reviewed-by: Cornelia Huck --- configure | 9 +++++++++ s390x/Makefile | 17 +++++++++++++++-- s390x/selftest.parmfile | 1 + s390x/unittests.cfg | 1 + scripts/s390x/func.bash | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 s390x/selftest.parmfile create mode 100644 scripts/s390x/func.bash diff --git a/configure b/configure index f9305431a9cb..fe319233eb50 100755 --- a/configure +++ b/configure @@ -19,6 +19,7 @@ wa_divide= vmm="qemu" errata_force=0 erratatxt="$srcdir/errata.txt" +host_key_document= usage() { cat <<-EOF @@ -41,6 +42,9 @@ usage() { no environ is provided by the user (enabled by default) --erratatxt=FILE specify a file to use instead of errata.txt. Use '--erratatxt=' to ensure no file is used. + --host-key-document=HOST_KEY_DOCUMENT + Specify the machine-specific host-key document for creating + a PVM image with 'genprotimg' (s390x only) EOF exit 1 } @@ -93,6 +97,9 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --host-key-document) + host_key_document="$arg" + ;; --help) usage ;; @@ -224,6 +231,8 @@ ENVIRON_DEFAULT=$environ_default ERRATATXT=$erratatxt U32_LONG_FMT=$u32_long WA_DIVIDE=$wa_divide +GENPROTIMG=${GENPROTIMG-genprotimg} +HOST_KEY_DOCUMENT=$host_key_document EOF cat < lib/config.h diff --git a/s390x/Makefile b/s390x/Makefile index c2213ad92e0d..b079a26dffb7 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -19,12 +19,19 @@ tests += $(TEST_DIR)/smp.elf tests += $(TEST_DIR)/sclp.elf tests += $(TEST_DIR)/css.elf tests += $(TEST_DIR)/uv-guest.elf -tests_binary = $(patsubst %.elf,%.bin,$(tests)) -all: directories test_cases test_cases_binary +tests_binary = $(patsubst %.elf,%.bin,$(tests)) +ifneq ($(HOST_KEY_DOCUMENT),) +tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) +else +tests_pv_binary = +endif + +all: directories test_cases test_cases_binary test_cases_pv test_cases: $(tests) test_cases_binary: $(tests_binary) +test_cases_pv: $(tests_pv_binary) CFLAGS += -std=gnu99 CFLAGS += -ffreestanding @@ -73,6 +80,12 @@ FLATLIBS = $(libcflat) %.bin: %.elf $(OBJCOPY) -O binary $< $@ +%selftest.pv.bin: %selftest.bin $(HOST_KEY_DOCUMENT) $(patsubst %.pv.bin,%.parmfile,$@) + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --parmfile $(patsubst %.pv.bin,%.parmfile,$@) --no-verify --image $< -o $@ + +%.pv.bin: %.bin $(HOST_KEY_DOCUMENT) + $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ + arch_clean: asm_offsets_clean $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d lib/s390x/.*.d diff --git a/s390x/selftest.parmfile b/s390x/selftest.parmfile new file mode 100644 index 000000000000..5613931aa5c6 --- /dev/null +++ b/s390x/selftest.parmfile @@ -0,0 +1 @@ +test 123 \ No newline at end of file diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 6d50c634770f..3feb8bcaa13d 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -21,6 +21,7 @@ [selftest-setup] file = selftest.elf groups = selftest +# please keep the kernel cmdline in sync with $(TEST_DIR)/selftest.parmfile extra_params = -append 'test 123' [intercept] diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash new file mode 100644 index 000000000000..4eae5e916c61 --- /dev/null +++ b/scripts/s390x/func.bash @@ -0,0 +1,36 @@ +# The file scripts/common.bash has to be the only file sourcing this +# arch helper file +source config.mak + +ARCH_CMD=arch_cmd_s390x + +function arch_cmd_s390x() +{ + local cmd=$1 + local testname=$2 + local groups=$3 + local smp=$4 + local kernel=$5 + local opts=$6 + local arch=$7 + local check=$8 + local accel=$9 + local timeout=${10} + + # run the normal test case + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + + # run PV test case + kernel=${kernel%.elf}.pv.bin + testname=${testname}_PV + if [ ! -f "${kernel}" ]; then + if [ -z "${HOST_KEY_DOCUMENT}" ]; then + print_result 'SKIP' $testname '' 'no host-key document specified' + return 2 + fi + + print_result 'SKIP' $testname '' 'PVM image was not created' + return 2 + fi + "$cmd" "$testname" "$groups pv" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" +}