From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7268555392064421888 X-Received: by 2002:a05:6402:51cd:b0:51d:cfeb:fc3b with SMTP id r13-20020a05640251cd00b0051dcfebfc3bmr1338012edd.1.1692342430361; Fri, 18 Aug 2023 00:07:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:aa7:cc90:0:b0:522:3a21:f22d with SMTP id p16-20020aa7cc90000000b005223a21f22dls365473edt.2.-pod-prod-04-eu; Fri, 18 Aug 2023 00:07:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE38yLp0TN3iozogpnziAqCpO1ZuN+yNVl3SwQCOkz9R/ShyFjbnmyK9jvEzqnurJ3OdPDE X-Received: by 2002:a05:6402:343:b0:523:b37e:b840 with SMTP id r3-20020a056402034300b00523b37eb840mr1497575edw.26.1692342428372; Fri, 18 Aug 2023 00:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692342428; cv=none; d=google.com; s=arc-20160816; b=k+Dye/zUZlEECGsrXkH1mF0jkw9BhR8VU0ljI2tJqObjvzDeLBYJmVg/iNcB4vIyAq eli3x4QtkkIR2BsQr8y1R+2zUq+vgV9YlCCe3+Hsr/fphTQiTlCZX58aLiMhxPpvkJSN kPLdJPVX/dtAaWoNslNLRneBymlpAHShutGQ+pl8LjE5rCWo+Gu3/LqsnZ3eYytA0c7Y /WGhWstMoLuhm6UQrU0BUbU7xoRHs1pgAL3pHCnqOqrzz0bD2j+ESotYkAdQ7du4i/32 CpXJljumLkByxHCU5eVdux+dAq6FbfxNtVS/n8oFStSZF2X6KUhbawuPDRfCQlM1JbTz /tJQ== 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=nIvj4G5UtwObc86fvyd871/i7W/zOB1dVkBIOgnjo8o=; fh=swRs1+OhWjovx1IrvOlKBWsdq9manB5qdcuGoHoh5Ak=; b=eXGhFnnxWO2MYg+uELPz2SbVKCPrAwGWHl0iXoNH8jwphhNiPFamnIoWIa6iaB8W6w jnijIhjycoUxpuR+nbWIYQQ26yr2F02Vdh7ZH8d6tWtNFwpbB5qVYvAdocudJNNS/Q0W 0QElDwaDlXLFdM6lnGbeTa9wYt2Vc/+iHgdrRey7PJBH6vNinUDEZG8SDYfteBKyXnOA Gmy3XfahbmY2BlQol9zbqTMB174t4GzLcc6Os6uSKOPXo/z/+giFZmUzkTL/r0tt5bEn 8OLc0ATboi7YORX2L9njDaIga9XKACCHDrrcePRHxUaSeUFh7vv7r1lfa1CV1TQHy03l I6Dg== 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 dm17-20020a05640222d100b0051fe05f750asi141190edb.2.2023.08.18.00.07.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Aug 2023 00:07:08 -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 37I7769h024239 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Aug 2023 09:07:07 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH 1/8] cibuilder.py: Support custom arguments passing to CI scripts Date: Fri, 18 Aug 2023 09:06:59 +0200 Message-Id: <20230818070706.27913-2-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: FuA+GJzmSm2v With this change, it becomes possible to add custom arguments to the scripts we want to run remotely on the target. This means that remote script execution process is now consist of two parts: delivering the script on board and running it with custom arguments. An interface of the call doesn't change just allowing to add space-separated arguments: ``` self.vm_start(script='test_script arg1 arg2 .. argN') ``` Signed-off-by: Uladzimir Bely --- testsuite/cibuilder.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py index a03ff050..80b3aa88 100755 --- a/testsuite/cibuilder.py +++ b/testsuite/cibuilder.py @@ -246,13 +246,25 @@ class CIBuilder(Test): def run_script(self, script, cmd_prefix): script_dir = self.params.get('test_script_dir', default=os.path.abspath(os.path.dirname(__file__))) + '/scripts/' - script_path = script_dir + script + script_path = script_dir + script.split()[0] + script_args = ' '.join(script.split()[1:]) + + self.log.debug("script_path: '%s'" % (script_path)) + self.log.debug("script args: '%s'" % (script_args)) + if not os.path.exists(script_path): self.log.error('Script not found: ' + script_path) return 2 - rc = subprocess.call('cat ' + script_path + ' | ' + str(cmd_prefix), shell=True, + # Copy the script to the target + rc = subprocess.call('cat %s | %s install -m 755 /dev/stdin ./ci.sh' % (script_path, cmd_prefix), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + time.sleep(1) + + # Run the script remotely with the arguments + if rc == 0: + rc = subprocess.call('%s ./ci.sh %s' % (cmd_prefix, script_args), shell=True, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return rc -- 2.20.1