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 3/4] testsuite: Separate common part of kas-based test example
Date: Wed, 24 May 2023 04:45:13 +0200	[thread overview]
Message-ID: <20230524024514.17042-4-ubely@ilbers.de> (raw)
In-Reply-To: <20230524024514.17042-1-ubely@ilbers.de>

Avocado installation and configuration are steps required
by any kind of testing (qemu or hardware).

Separate appropriate stuff out of run_test.sh.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta-isar/test/common.sh      | 30 ++++++++++++++++++++++++++++++
 meta-isar/test/run_test.sh    | 33 +++++----------------------------
 meta-isar/test/sample_test.py |  0
 3 files changed, 35 insertions(+), 28 deletions(-)
 create mode 100755 meta-isar/test/common.sh
 mode change 100644 => 100755 meta-isar/test/sample_test.py

diff --git a/meta-isar/test/common.sh b/meta-isar/test/common.sh
new file mode 100755
index 00000000..e0e4ee6c
--- /dev/null
+++ b/meta-isar/test/common.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+set -e
+
+# Make Isar testsuite accessable
+export PYTHONPATH=${PYTHONPATH}:${TESTSUITEDIR}
+
+# install avocado in virtualenv in case it is not there already
+if ! command -v avocado > /dev/null; then
+    sudo apt-get -y update
+    sudo apt-get -y install virtualenv
+    rm -rf /tmp/avocado_venv
+    virtualenv --python python3 /tmp/avocado_venv
+    source /tmp/avocado_venv/bin/activate
+    pip install avocado-framework==100.1
+fi
+
+# Start tests in this dir
+BASE_DIR="/build/avocado"
+
+# Provide working path
+mkdir -p .config/avocado
+cat <<EOF > .config/avocado/avocado.conf
+[datadir.paths]
+base_dir = ${BASE_DIR}/
+data_dir = ${BASE_DIR}/data
+logs_dir = ${BASE_DIR}/logs
+test_dir = ${BASE_DIR}/test
+EOF
+export VIRTUAL_ENV="./"
diff --git a/meta-isar/test/run_test.sh b/meta-isar/test/run_test.sh
index c4a7d4ac..6083e635 100755
--- a/meta-isar/test/run_test.sh
+++ b/meta-isar/test/run_test.sh
@@ -1,17 +1,10 @@
 #!/usr/bin/env bash
 
-# Make Isar testsuite accessable
-export PYTHONPATH=${PYTHONPATH}:${TESTSUITEDIR}
+set -e
 
-# install avocado in virtualenv in case it is not there already
-if ! command -v avocado > /dev/null; then
-    sudo apt-get -y update
-    sudo apt-get -y install virtualenv
-    rm -rf /tmp/avocado_venv
-    virtualenv --python python3 /tmp/avocado_venv
-    source /tmp/avocado_venv/bin/activate
-    pip install avocado-framework==100.1
-fi
+test_dir=$(dirname $(realpath $0))
+
+. ${test_dir}/common.sh
 
 # Install qemu
 if ! command -v qemu-system-aarch64 > /dev/null; then
@@ -19,21 +12,5 @@ if ! command -v qemu-system-aarch64 > /dev/null; then
   sudo apt-get -y install --no-install-recommends qemu-system-aarch64 ipxe-qemu
 fi
 
-# Start tests in this dir
-BASE_DIR="/build/avocado"
-
-# Provide working path
-mkdir -p .config/avocado
-cat <<EOF > .config/avocado/avocado.conf
-[datadir.paths]
-base_dir = ${BASE_DIR}/
-data_dir = ${BASE_DIR}/data
-logs_dir = ${BASE_DIR}/logs
-test_dir = ${BASE_DIR}/test
-EOF
-export VIRTUAL_ENV="./"
-
-tsd=$(dirname $(realpath $0))/scripts
-
 # Run SSH tests
-avocado run --max-parallel-tasks=1 /work/sample_test.py -p test_script_dir=${tsd}
+avocado run --max-parallel-tasks=1 /work/sample_test.py -p test_script_dir=${test_dir}
diff --git a/meta-isar/test/sample_test.py b/meta-isar/test/sample_test.py
old mode 100644
new mode 100755
-- 
2.20.1


  parent reply	other threads:[~2023-05-24  2:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  2:45 [PATCH 0/4] Basic hardware testing support Uladzimir Bely
2023-05-24  2:45 ` [PATCH 1/4] cibuilder.py: Refactor vm_start related functions Uladzimir Bely
2023-05-24  2:45 ` [PATCH 2/4] testsuite: Add an interface to run commands over ssh Uladzimir Bely
2023-05-24  2:45 ` Uladzimir Bely [this message]
2023-05-24  2:45 ` [PATCH 4/4] testsute: Provide an example of hardware test Uladzimir Bely
2023-05-24  3:06 ` [PATCH 0/4] Basic hardware testing support MOESSBAUER, Felix
2023-05-24  4:30   ` Florian Bezdeka
2023-05-24 11:37     ` Jan Kiszka
2023-05-31 21:01 ` 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=20230524024514.17042-4-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