From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH 4/4] testsute: Provide an example of hardware test
Date: Wed, 24 May 2023 04:45:14 +0200 [thread overview]
Message-ID: <20230524024514.17042-5-ubely@ilbers.de> (raw)
In-Reply-To: <20230524024514.17042-1-ubely@ilbers.de>
The example is tested with Raspberry Pi 3 B+.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
meta-isar/test/README.md | 24 ++++++++++++++++---
meta-isar/test/run_test_hw.sh | 10 ++++++++
meta-isar/test/sample_kas_config_hw.yml | 32 +++++++++++++++++++++++++
meta-isar/test/sample_test_hw.py | 13 ++++++++++
4 files changed, 76 insertions(+), 3 deletions(-)
create mode 100755 meta-isar/test/run_test_hw.sh
create mode 100644 meta-isar/test/sample_kas_config_hw.yml
create mode 100755 meta-isar/test/sample_test_hw.py
diff --git a/meta-isar/test/README.md b/meta-isar/test/README.md
index f8c6338c..4619aaae 100644
--- a/meta-isar/test/README.md
+++ b/meta-isar/test/README.md
@@ -1,16 +1,34 @@
-# Example of the downstream testcase
+# Common requirements
Use `meta-isar/test/` as working directory. Make sure `kas-container` is
available in $PATH (look at https://github.com/siemens/kas for it).
-Build an image:
+# Example of the downstream qemu-based testcase
+
+1. Build an image:
```
kas-container build sample_kas_config.yml
```
-Run testcase:
+2. Run testcase:
```
kas-container shell sample_kas_config.yml -c '/work/run_test.sh'
```
+
+# Example of the downstream hardware testcase (example for RPi 3b+)
+
+1. Build an image:
+
+```
+kas-container build sample_kas_config.yml
+```
+
+2. Flash resulted wic image to SD-card and boot the board
+
+3. Run testcase (adjust `host` to RPi's IP address):
+
+```
+kas-container shell sample_kas_config_hw.yml -c "/work/run_test_hw.sh -p host=192.168.100.117"
+```
diff --git a/meta-isar/test/run_test_hw.sh b/meta-isar/test/run_test_hw.sh
new file mode 100755
index 00000000..a72c0204
--- /dev/null
+++ b/meta-isar/test/run_test_hw.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -e
+
+test_dir=$(dirname $(realpath $0))
+
+. ${test_dir}/common.sh
+
+# Run SSH tests
+avocado run --max-parallel-tasks=1 /work/sample_test_hw.py -p test_script_dir=${test_dir} -p host=rpi $@
diff --git a/meta-isar/test/sample_kas_config_hw.yml b/meta-isar/test/sample_kas_config_hw.yml
new file mode 100644
index 00000000..69afc9c3
--- /dev/null
+++ b/meta-isar/test/sample_kas_config_hw.yml
@@ -0,0 +1,32 @@
+header:
+ version: 11
+
+build_system: isar
+
+distro: raspios-bullseye
+machine: rpi-arm-v7
+target: mc:rpi-arm-v7-bullseye:isar-image-ci
+repos:
+ isar:
+ url: "https://github.com/ilbers/isar.git"
+ refspec: next
+ layers:
+ meta:
+ meta-isar:
+
+bblayers_conf_header:
+ standard: |
+ BBPATH = "${TOPDIR}"
+ BBFILES ?= ""
+
+local_conf_header:
+ standard: |
+ DISTRO_ARCH ??= "armhf"
+ PATCHRESOLVE = "noop"
+
+ USERS += "root"
+ USER_root[password] ??= "$6$rounds=10000$RXeWrnFmkY$DtuS/OmsAS2cCEDo0BF5qQsizIrq6jPgXnwv3PHqREJeKd1sXdHX/ayQtuQWVDHe0KIO0/sVH8dvQm1KthF0d/"
+ crossbuild: |
+ ISAR_CROSS_COMPILE = "1"
+ ccache: |
+ USE_CCACHE = "1"
diff --git a/meta-isar/test/sample_test_hw.py b/meta-isar/test/sample_test_hw.py
new file mode 100755
index 00000000..47735823
--- /dev/null
+++ b/meta-isar/test/sample_test_hw.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+from cibase import CIBaseTest
+
+class SampleHwTest(CIBaseTest):
+ def test_sample_script(self):
+ self.init("/build")
+
+ host = self.params.get('host', default='raspberry')
+ port = self.params.get('port', default='22')
+
+ self.ssh_start(user='ci', host=host, port=port,
+ script='sample_script.sh')
--
2.20.1
next prev 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 ` [PATCH 3/4] testsuite: Separate common part of kas-based test example Uladzimir Bely
2023-05-24 2:45 ` Uladzimir Bely [this message]
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-5-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