From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7268555392064421888 X-Received: by 2002:a1c:7709:0:b0:3fe:46ea:62c6 with SMTP id t9-20020a1c7709000000b003fe46ea62c6mr1562097wmi.21.1692342432558; Fri, 18 Aug 2023 00:07:12 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:600c:4751:b0:3fe:1d45:c713 with SMTP id w17-20020a05600c475100b003fe1d45c713ls322014wmo.2.-pod-prod-01-eu; Fri, 18 Aug 2023 00:07:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6twXZgCTabW/ATtGARkjp3uEMvP4nf+j+kQVls7KoeJFDSaJacD7Jc7Ho50bFNHs+S4ZT X-Received: by 2002:a7b:c5d8:0:b0:3fe:2140:f504 with SMTP id n24-20020a7bc5d8000000b003fe2140f504mr1501425wmk.20.1692342430544; Fri, 18 Aug 2023 00:07:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692342430; cv=none; d=google.com; s=arc-20160816; b=rorZAM13DMyF2Z8A6BP2P709nGjiW8NtK7YeTm9RZpk+XDEuRXpqGe7WRiLc0N/Jrv GVaPd9R+Y3fEL+bV0hCwIcoQys5xUnLsFjk/2TNWBkbGSxgUCciQIajc2NiuRuLwfF74 IiXEDTt0ewE3AYr8ICZlWEznnjs+4mC5H0ptBjPz95i4Vmlyz/xUzp18R+3PU6Aoq9hg uaTIODqVvhHmgTpoB5N28a953y/l62G3twAtGkTnfBXGALHdrxEWQztrNH5KUg7lyuBU y/Nd3QWpPAPn1H9xl8T2vqCc5Cvek1J1MhaVXxaXFQ92+v7fyURnrUWUEJDv2bj4bB6A WxuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=lpTESwlgOTEYzBr5ZFTCDAMiEgLO4Nmfw1KEbLuIYWk=; fh=swRs1+OhWjovx1IrvOlKBWsdq9manB5qdcuGoHoh5Ak=; b=cvwefG4JrBjtmmIKACYV+B4Rn63yetoLTV5wU57CE1VGIWRYxjvi4oos3909oVZ5x+ jWXR2GTf20tBAhZ983PA8kmKFnLRthIKfC4/OpY309wvj+91cbB5ywycA2/cU3EC9sIA ot4gPmKFO2vYWhiZZT52WssxeXDW/knjwMmj4J8xA3rmRpZu8stcYe31rvnSLrvq99ti rG6aaf7lrbK/+dygbeBEsUfTmXcr4PfJVeDRmdww5EXAfNAZ8+PX+J18Qgo17E4QVI5D XVq1uf6uuOICu2gpBti/T9k3QNFlehmmrR4lIdjVal9M9lvHk6PseGKG1C8th8CIlznq YSJw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id ay23-20020a05600c1e1700b003fe0df12dfcsi115165wmb.2.2023.08.18.00.07.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 00:07:10 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from baighyz.m.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 37I7769o024239 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Aug 2023 09:07:09 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH 8/8] testsuite: Switch to remote scripts with arguments Date: Fri, 18 Aug 2023 09:07:06 +0200 Message-Id: <20230818070706.27913-9-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230818070706.27913-1-ubely@ilbers.de> References: <20230818070706.27913-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: DQ+5bShn5yOd Scripts `test_getty_target.sh` and `test_example_module.sh` are limited to the only function. Rename and refactor (add custom arguments support) them in order to support any systemd unit / kernel module to check. Signed-off-by: Uladzimir Bely --- testsuite/README.md | 2 +- testsuite/citest.py | 14 +++++++------- testsuite/scripts/test_example_module.sh | 5 ----- testsuite/scripts/test_getty_target.sh | 7 ------- testsuite/scripts/test_kernel_module.sh | 5 +++++ testsuite/scripts/test_systemd_unit.sh | 23 +++++++++++++++++++++++ 6 files changed, 36 insertions(+), 20 deletions(-) delete mode 100755 testsuite/scripts/test_example_module.sh delete mode 100755 testsuite/scripts/test_getty_target.sh create mode 100755 testsuite/scripts/test_kernel_module.sh create mode 100755 testsuite/scripts/test_systemd_unit.sh diff --git a/testsuite/README.md b/testsuite/README.md index b58a1013..913767fc 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -87,7 +87,7 @@ can be executed instead of command: self.init() self.vm_start('amd64','bookworm', \ image='isar-image-ci', - script='test_getty_target.sh') + script='test_systemd_unit.sh getty.target 10') ``` The default location of custom scripts is `isar/testsuite/`. It can be changed diff --git a/testsuite/citest.py b/testsuite/citest.py index 0cfb46ff..90b8955f 100755 --- a/testsuite/citest.py +++ b/testsuite/citest.py @@ -326,7 +326,7 @@ class VmBootTestFast(CIBaseTest): def test_arm_bullseye_getty_target(self): self.init() self.vm_start('arm','bullseye', image='isar-image-ci', - script='test_getty_target.sh', + script='test_systemd_unit.sh getty.target 10', stop_vm=True) @@ -342,7 +342,7 @@ class VmBootTestFast(CIBaseTest): def test_arm_buster_example_module(self): self.init() self.vm_start('arm','buster', image='isar-image-ci', - script='test_example_module.sh', + script='test_kernel_module.sh example_module', stop_vm=True) @@ -358,7 +358,7 @@ class VmBootTestFast(CIBaseTest): def test_arm_bookworm_getty_target(self): self.init() self.vm_start('arm','bookworm', image='isar-image-ci', - script='test_getty_target.sh', + script='test_systemd_unit.sh getty.target 10', stop_vm=True) @@ -388,7 +388,7 @@ class VmBootTestFull(CIBaseTest): def test_arm_buster_getty_target(self): self.init() self.vm_start('arm','buster', image='isar-image-ci', - script='test_getty_target.sh', + script='test_systemd_unit.sh getty.target 10', stop_vm=True) @@ -404,7 +404,7 @@ class VmBootTestFull(CIBaseTest): def test_arm64_bullseye_example_module(self): self.init() self.vm_start('arm64','bullseye', image='isar-image-ci', - script='test_example_module.sh', + script='test_kernel_module.sh example_module', stop_vm=True) @@ -436,7 +436,7 @@ class VmBootTestFull(CIBaseTest): def test_amd64_focal_getty_target(self): self.init() self.vm_start('amd64','focal', image='isar-image-ci', - script='test_getty_target.sh', + script='test_systemd_unit.sh getty.target 10', stop_vm=True) @@ -470,5 +470,5 @@ class VmBootTestFull(CIBaseTest): def test_mipsel_bookworm_example_module(self): self.init() self.vm_start('mipsel','bookworm', image='isar-image-ci', - script='test_example_module.sh', + script='test_kernel_module.sh example_module', stop_vm=True) diff --git a/testsuite/scripts/test_example_module.sh b/testsuite/scripts/test_example_module.sh deleted file mode 100755 index 175030d1..00000000 --- a/testsuite/scripts/test_example_module.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -set -e - -lsmod | grep '^example_module ' diff --git a/testsuite/scripts/test_getty_target.sh b/testsuite/scripts/test_getty_target.sh deleted file mode 100755 index 38c0fc1e..00000000 --- a/testsuite/scripts/test_getty_target.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -set -e - -sleep 10 - -systemctl is-active getty.target diff --git a/testsuite/scripts/test_kernel_module.sh b/testsuite/scripts/test_kernel_module.sh new file mode 100755 index 00000000..1e43e5cb --- /dev/null +++ b/testsuite/scripts/test_kernel_module.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +lsmod | grep "^${1} " diff --git a/testsuite/scripts/test_systemd_unit.sh b/testsuite/scripts/test_systemd_unit.sh new file mode 100755 index 00000000..c97d7a7c --- /dev/null +++ b/testsuite/scripts/test_systemd_unit.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# Checks system unit until it gets active or retry count reaches the limit + +set -e + +unit=$1 +cnt=$2 + +ret=1 + +while [ "$cnt" -gt 0 ]; do + if systemctl is-active "${unit}"; then + exit 0 + else + ret=$? + fi + + cnt=$((cnt - 1)) + sleep 1 +done + +exit $ret -- 2.20.1