From patchwork Wed Aug 12 09:27:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11710527 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 E912516B1 for ; Wed, 12 Aug 2020 09:27:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE91D20885 for ; Wed, 12 Aug 2020 09:27:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Oe74AEmg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgHLJ1V (ORCPT ); Wed, 12 Aug 2020 05:27:21 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48194 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgHLJ1U (ORCPT ); Wed, 12 Aug 2020 05:27:20 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07C94OEN060825; Wed, 12 Aug 2020 05:27:20 -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=0acSJCr1o0RQcfcNtXQDeitKyCbzJCGqJk1XWIvSBuQ=; b=Oe74AEmgEYBjZZMrrkOQ82qJILQ0iZnUXsKA6/+/Fdl1jOOGzyGvH50v/D+u/W6j43tV NityKHqCaYFBY5IgYHyiy1AW+BcYbqsaJriyRHQktcS+DIJVxSbiOPApv2stBT0kj2p/ ZWO1L6Ki4meSmeQeefDlFfJoeLs8o245Md/weOHHBBouiPRsV3/glnKNdKmK30IWsS0U GSRaYYEJlWuFqoJPo46Mxz3qXaP3UIPtubEWxfwCI8CYguErIGNKMmlD3V3RkLKd6RrN jpgamP6GN5C8hBsDkk8mvONqMiroyUL4EJtrbAD/gObM4sZuTloUGekiHWtJMFqGmMXu bQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32utn8r23m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:20 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07C94WSS061446; Wed, 12 Aug 2020 05:27:19 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 32utn8r232-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:19 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07C9LL7M032034; Wed, 12 Aug 2020 09:27:17 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 32skp7tmea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 09:27:17 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07C9REpY31195392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2020 09:27:14 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2690652052; Wed, 12 Aug 2020 09:27:14 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.75.196]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id BB5085204F; Wed, 12 Aug 2020 09:27:13 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , Christian Borntraeger , linux-s390@vger.kernel.org Subject: [kvm-unit-tests RFC v2 1/4] common.bash: run `cmd` only if a test case was found Date: Wed, 12 Aug 2020 11:27:02 +0200 Message-Id: <20200812092705.17774-2-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200812092705.17774-1-mhartmay@linux.ibm.com> References: <20200812092705.17774-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-08-12_02:2020-08-11,2020-08-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 suspectscore=1 mlxlogscore=999 clxscore=1015 impostorscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008120064 Sender: kvm-owner@vger.kernel.org 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`. Signed-off-by: Marc Hartmayer Reviewed-by: Andrew Jones --- 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 01e36dcfa06e..24aba9cc3a98 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -126,9 +126,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 Aug 12 09:27:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11710529 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 7C8431744 for ; Wed, 12 Aug 2020 09:27:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 633C720885 for ; Wed, 12 Aug 2020 09:27:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ZDDANpTP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727903AbgHLJ1X (ORCPT ); Wed, 12 Aug 2020 05:27:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:31862 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727896AbgHLJ1V (ORCPT ); Wed, 12 Aug 2020 05:27:21 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07C94x7d083146; Wed, 12 Aug 2020 05:27:20 -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=H3G210iWNUd5kagW5EmFZwKPo0CsJkHIviE8UvjD2RE=; b=ZDDANpTPvKfal4HShRwIe5lE6b9nphHBQhcdqgvKYHxBeMyZiupgAa/e5GRECYIYdjDC ZIruog1PHejtIrtBRsRfrZ6ObSh3iy6vEjjWEpbzh6o2MIjex3lughA8NNShRKptMp8A Yf0qy51KYLHjpYQ4gVwkoL5e2nJHm98hif1cOC7A0g8PU5wCQc37icompUVs7Ev8IKMm ADLXoMEYHeXkaRdy4l8UQdJlmQ1sDqFdiuL43IbGTOgI4s0rD1tlHauvwKNKuu/1GofM ZhFXcZVOxYwnciyBHdDQ6RW5zO4E43/fxt2iwNNkGe9zMkkVUeDLP5A7jriv1rwswbhJ 9g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32vakp5euh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:20 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07C951nL083367; Wed, 12 Aug 2020 05:27:20 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 32vakp5eu1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:20 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07C9M2TE023076; Wed, 12 Aug 2020 09:27:17 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 32skp82m0r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 09:27:17 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07C9REbL24904036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2020 09:27:14 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0A5452051; Wed, 12 Aug 2020 09:27:14 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.75.196]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 36DA452050; Wed, 12 Aug 2020 09:27:14 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , Christian Borntraeger , linux-s390@vger.kernel.org Subject: [kvm-unit-tests RFC v2 2/4] scripts: add support for architecture dependent functions Date: Wed, 12 Aug 2020 11:27:03 +0200 Message-Id: <20200812092705.17774-3-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200812092705.17774-1-mhartmay@linux.ibm.com> References: <20200812092705.17774-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-08-12_02:2020-08-11,2020-08-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 spamscore=0 malwarescore=0 suspectscore=1 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008120064 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This is necessary to keep architecture dependent code separate from common code. Signed-off-by: Marc Hartmayer --- README.md | 3 ++- scripts/common.bash | 5 +++++ 2 files changed, 7 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..f9c15fd304bd 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -52,3 +52,8 @@ function for_each_unittest() fi exec {fd}<&- } + +ARCH_FUNC=scripts/${ARCH}/func.bash +if [ -f "${ARCH_FUNC}" ]; then + source "${ARCH_FUNC}" +fi From patchwork Wed Aug 12 09:27:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11710531 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 D8851722 for ; Wed, 12 Aug 2020 09:27:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C02D62087C for ; Wed, 12 Aug 2020 09:27:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="K/NBkjSh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727921AbgHLJ1Z (ORCPT ); Wed, 12 Aug 2020 05:27:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:26044 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727771AbgHLJ1V (ORCPT ); Wed, 12 Aug 2020 05:27:21 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07C94Q3o140995; Wed, 12 Aug 2020 05:27:20 -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=CwGt+RGQN2Ly6SujhwnS+lukDsTIh0VYLUDOwGoQr90=; b=K/NBkjSh0K4N7+cxqZgP2NhY/lk7AJfE0P6A/38Ir1tefXMM0Cd4aTxUw8gGkBiiDybw Iks1W4UfeFEboHA+VecITVeppyLqq5F+8C/ghIsIZw1tWBdmzUHuBaULpjLmbBhzTJww tjUA7/dgBPVaXK3IFTLd9Kdwrv0CFbvWGoBWiSBpoefRptTY4kNMdWJOXWs4bi0QXMG1 nXbHFjBFilaZjL8I0yZSqLp8lnDMmEVsmXqApdLEnpSMx+3soj2F8KmPClmV7BpelrO7 dLlhf+FoKwK0mJucevn0Hd0qI6pHP4VvmURoFJeggtYp8b5sFDqbqP27r5hnyqu6s0Tr Bw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32vbcycdsd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:20 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07C94bUU141866; Wed, 12 Aug 2020 05:27:19 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 32vbcycdrq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:19 -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 07C9KnQX016717; Wed, 12 Aug 2020 09:27:18 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 32skp8c8bp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 09:27:18 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07C9RFqT28180860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2020 09:27:15 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CD0452052; Wed, 12 Aug 2020 09:27:15 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.75.196]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id A6EC552057; Wed, 12 Aug 2020 09:27:14 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , Christian Borntraeger , linux-s390@vger.kernel.org Subject: [kvm-unit-tests RFC v2 3/4] run_tests/mkstandalone: add arch dependent function to `for_each_unittest` Date: Wed, 12 Aug 2020 11:27:04 +0200 Message-Id: <20200812092705.17774-4-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200812092705.17774-1-mhartmay@linux.ibm.com> References: <20200812092705.17774-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-08-12_02:2020-08-11,2020-08-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=1 adultscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 mlxlogscore=879 clxscore=1015 mlxscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008120064 Sender: kvm-owner@vger.kernel.org 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. Signed-off-by: Marc Hartmayer --- run_tests.sh | 2 +- scripts/common.bash | 13 +++++++++++++ scripts/mkstandalone.sh | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 24aba9cc3a98..23658392c488 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -160,7 +160,7 @@ trap "wait; exit 130" SIGINT # preserve stdout so that process_test_output output can write TAP to it exec 3>&1 test "$tap_output" == "yes" && exec > /dev/null - for_each_unittest $config run_task + for_each_unittest $config run_task arch_cmd ) | postprocess_suite_output # wait until all tasks finish diff --git a/scripts/common.bash b/scripts/common.bash index f9c15fd304bd..62931a40b79a 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -1,8 +1,15 @@ +function arch_cmd() +{ + # Dummy function, can be overwritten by architecture dependent + # code + return +} function for_each_unittest() { local unittests="$1" local cmd="$2" + local arch_cmd="${3-}" local testname local smp local kernel @@ -19,6 +26,9 @@ function for_each_unittest() if [[ "$line" =~ ^\[(.*)\]$ ]]; then if [ -n "${testname}" ]; then "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ "${arch_cmd}" ]; then + "${arch_cmd}" "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi fi testname=${BASH_REMATCH[1]} smp=1 @@ -49,6 +59,9 @@ function for_each_unittest() done if [ -n "${testname}" ]; then "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + if [ "${arch_cmd}" ]; then + "${arch_cmd}" "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" + fi fi exec {fd}<&- } diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index cefdec30cb33..3b18c0cf090b 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -128,4 +128,4 @@ fi mkdir -p tests -for_each_unittest $cfg mkstandalone +for_each_unittest $cfg mkstandalone arch_cmd From patchwork Wed Aug 12 09:27:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Hartmayer X-Patchwork-Id: 11710533 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 85F901744 for ; Wed, 12 Aug 2020 09:27:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68E9720885 for ; Wed, 12 Aug 2020 09:27:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="oeD/cX2R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727911AbgHLJ1Z (ORCPT ); Wed, 12 Aug 2020 05:27:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:27860 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727899AbgHLJ1W (ORCPT ); Wed, 12 Aug 2020 05:27:22 -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 07C93Oug113926; Wed, 12 Aug 2020 05:27:20 -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=CpkcsCiIHT1ZLz+tIbVScMEnniEenbhIqlikhJ3QR7M=; b=oeD/cX2R6xVZS1t9egOpz3gbYOFJUUb1D6P2zdI+RFnnLTTJsyOc3BLaG0wu2IInz/xZ YjE9HkMtwNz5l0NB5NC3wS9psMeatxv098/B+zHe0GTwzyZNzX9+Uy9c98+iTL1MJkUu FOKA6/2fIlFuC9emrV6L0VUEDfqWD5gCGpbWZ8y0wnykTB3y35qLAjaaQNp3/iVhoIT8 ua1RHcOA/fG5T+AO5K4Un8P4LF0WyjpHg1E4h9Sh8jcJ24x26TqiNvWq82G3sdzuGck3 o1EUCElq0FuSenqHhgadERvzHnB0MB8JSLUhTr27mW1juBI3606OtHuqBj3MkxTT3T/4 KA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32v7r493kr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:20 -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 07C9NJXO195946; Wed, 12 Aug 2020 05:27:20 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 32v7r493k3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 05:27:20 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07C9K2ew006665; Wed, 12 Aug 2020 09:27:18 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 32skp82mee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Aug 2020 09:27:18 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07C9RFJx21627306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2020 09:27:15 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A6C852051; Wed, 12 Aug 2020 09:27:15 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.75.196]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2298352054; Wed, 12 Aug 2020 09:27:15 +0000 (GMT) From: Marc Hartmayer To: Cc: Thomas Huth , David Hildenbrand , Janosch Frank , Cornelia Huck , Andrew Jones , Paolo Bonzini , Christian Borntraeger , linux-s390@vger.kernel.org Subject: [kvm-unit-tests RFC v2 4/4] s390x: add Protected VM support Date: Wed, 12 Aug 2020 11:27:05 +0200 Message-Id: <20200812092705.17774-5-mhartmay@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200812092705.17774-1-mhartmay@linux.ibm.com> References: <20200812092705.17774-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-08-12_02:2020-08-11,2020-08-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 phishscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008120064 Sender: kvm-owner@vger.kernel.org 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. Signed-off-by: Marc Hartmayer --- configure | 8 ++++++++ s390x/Makefile | 17 +++++++++++++++-- s390x/selftest.parmfile | 1 + s390x/unittests.cfg | 1 + scripts/s390x/func.bash | 18 ++++++++++++++++++ 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 s390x/selftest.parmfile create mode 100644 scripts/s390x/func.bash diff --git a/configure b/configure index f9d030fd2f03..aa528af72534 100755 --- a/configure +++ b/configure @@ -18,6 +18,7 @@ u32_long= vmm="qemu" errata_force=0 erratatxt="$srcdir/errata.txt" +host_key_document= usage() { cat <<-EOF @@ -40,6 +41,8 @@ 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 + host-key-document to use (s390x only) EOF exit 1 } @@ -92,6 +95,9 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --host-key-document) + host_key_document="$arg" + ;; --help) usage ;; @@ -205,6 +211,8 @@ PRETTY_PRINT_STACKS=$pretty_print_stacks ENVIRON_DEFAULT=$environ_default ERRATATXT=$erratatxt U32_LONG_FMT=$u32_long +GENPROTIMG=${GENPROTIMG-genprotimg} +HOST_KEY_DOCUMENT=$host_key_document EOF cat < lib/config.h diff --git a/s390x/Makefile b/s390x/Makefile index 0f54bf43bfb7..cd4e270952ec 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -18,12 +18,19 @@ tests += $(TEST_DIR)/skrf.elf tests += $(TEST_DIR)/smp.elf tests += $(TEST_DIR)/sclp.elf tests += $(TEST_DIR)/css.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 @@ -72,6 +79,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 0f156afbe741..12f6fb613995 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..5c682cb47f73 --- /dev/null +++ b/scripts/s390x/func.bash @@ -0,0 +1,18 @@ +# Run Protected VM test +function arch_cmd() +{ + 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} + + kernel=${kernel%.elf}.pv.bin + # do not run PV test cases by default + "$cmd" "${testname}_PV" "$groups pv nodefault" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" +}