public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v2 1/3] testsuite: Check availability of script to run over ssh
Date: Fri, 24 Mar 2023 08:01:40 +0100	[thread overview]
Message-ID: <20230324070142.27122-2-ubely@ilbers.de> (raw)
In-Reply-To: <20230324070142.27122-1-ubely@ilbers.de>

Running local scripts on remote machine over ssh is implemented as
`cat <script> | ssh ...". This always returns PASSED in case script
not found at specified location since the error code `cat` produces
in this case is masked by `ssh` command that finishes OK.

This fix is intended for downstreams that set custom script location
by passing `-p test_script_dir=<path>` to avocado arguments.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 testsuite/cibuilder.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 9e84c3a3..484a90b3 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -248,6 +248,10 @@ class CIBuilder(Test):
         script_dir = self.params.get('test_script_dir',
                                      default=os.path.abspath(os.path.dirname(__file__))) + '/'
         script_path = script_dir + script
+        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,
                              stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         return rc
-- 
2.20.1


  reply	other threads:[~2023-03-24  7:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24  7:01 [PATCH v2 0/3] Creating custom testcases based on Isar one Uladzimir Bely
2023-03-24  7:01 ` Uladzimir Bely [this message]
2023-03-24  7:01 ` [PATCH v2 2/3] testsuite: Move test scripts to their own subdirectory Uladzimir Bely
2023-03-24  7:01 ` [PATCH v2 3/3] testsuite: Exmaple of custom testcase for downstreams Uladzimir Bely
2023-03-26 17:30   ` Uladzimir Bely
2023-03-31  6:48 ` [PATCH v2 0/3] Creating custom testcases based on Isar one Uladzimir Bely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230324070142.27122-2-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox