Skip to contentSkip to conversation

labgrid: Deal with strange Python error

PATCH In review Simon Glass 2 participants 7 messages Feb 21, 2025 – Mar 5, 2025 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 labgrid: Deal with strange Python error

Add a way to work around an unexplained Python message which appears sometimes with Python 3.12.3

Make the file executable while we are here.

---

 bin/getrole.labgrid-sjg | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 bin/getrole.labgrid-sjg
bin/getrole.labgrid-sjg +10 -1
old mode 100644
new mode 100755
index 52fc3ce..7cef0a5
@@ -21,5 +21,14 @@
 
 [ -n "${do_configure}" ] && config_arg=",config_file"
 
+# The following spurious output is present with Python 3.12 on Ubuntu 24.04 so
+# use a redirection to drop it:
+
+# Error in sys.excepthook:
+#
+# Original exception was:
+#
+
 exec labgrid-client -r "${target}" -a query -n \
-	UBootProviderDriver:board,board_extra,source_dir,build_dir,build_dir_extra${config_arg}
+	UBootProviderDriver:board,board_extra,source_dir,build_dir,build_dir_extra${config_arg} \
+	2>/dev/null
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 ellesmere: Add QEMU config for riscv, arm, x86

Add symlinks so that the (non-labgrid) lab works on ellesmere.

---

 bin/ellesmere/conf.qemu-riscv32_na     | 1 +
 bin/ellesmere/conf.qemu-riscv32_spl_na | 1 +
 bin/ellesmere/conf.qemu-riscv64_na     | 1 +
 bin/ellesmere/conf.qemu-x86_64_na      | 1 +
 bin/ellesmere/conf.qemu-x86_na         | 1 +
 bin/ellesmere/conf.qemu_arm64_na       | 1 +
 bin/ellesmere/conf.qemu_arm_na         | 1 +
 7 files changed, 7 insertions(+)
 create mode 120000 bin/ellesmere/conf.qemu-riscv32_na
 create mode 120000 bin/ellesmere/conf.qemu-riscv32_spl_na
 create mode 120000 bin/ellesmere/conf.qemu-riscv64_na
 create mode 120000 bin/ellesmere/conf.qemu-x86_64_na
 create mode 120000 bin/ellesmere/conf.qemu-x86_na
 create mode 120000 bin/ellesmere/conf.qemu_arm64_na
 create mode 120000 bin/ellesmere/conf.qemu_arm_na
bin/ellesmere/conf.qemu-riscv32_na new file +1 -0
new file mode 120000
index 0000000..0646dbc
@@ -0,0 +1 @@
+../travis-ci/conf.qemu-riscv32_na
\ No newline at end of file
bin/ellesmere/conf.qemu-riscv32_spl_na new file +1 -0
new file mode 120000
index 0000000..ceda23f
@@ -0,0 +1 @@
+../travis-ci/conf.qemu-riscv32_spl_na
\ No newline at end of file
bin/ellesmere/conf.qemu-riscv64_na new file +1 -0
new file mode 120000
index 0000000..085574b
@@ -0,0 +1 @@
+../travis-ci/conf.qemu-riscv64_na
\ No newline at end of file
bin/ellesmere/conf.qemu-x86_64_na new file +1 -0
new file mode 120000
index 0000000..3a1470e
@@ -0,0 +1 @@
+../travis-ci/conf.qemu-x86_64_na
\ No newline at end of file
bin/ellesmere/conf.qemu-x86_na new file +1 -0
new file mode 120000
index 0000000..f6e7e5a
@@ -0,0 +1 @@
+../travis-ci/conf.qemu-x86_na
\ No newline at end of file
bin/ellesmere/conf.qemu_arm64_na new file +1 -0
new file mode 120000
index 0000000..cf56db1
@@ -0,0 +1 @@
+../travis-ci/conf.qemu_arm64_na
\ No newline at end of file
bin/ellesmere/conf.qemu_arm_na new file +1 -0
new file mode 120000
index 0000000..aa91a9f
@@ -0,0 +1 @@
+../travis-ci/conf.qemu_arm_na
\ No newline at end of file
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/3 RFC: Add some network info for ellesmere lab

In reply to Simon Glass

Provide network configuration so that some networking tests can be run on ellesmere.

---

 py/ellesmere/ellesmere_tftp.py                | 32 ++++++++++++++++
 py/ellesmere/u_boot_boardenv_qemu_arm64_na.py | 18 +++++++++
 py/ellesmere/u_boot_boardenv_qemu_arm_na.py   | 18 +++++++++
 py/ellesmere/u_boot_boardenv_rpi_3_32b.py     | 38 +++++++++++++++++++
 4 files changed, 106 insertions(+)
 create mode 100644 py/ellesmere/ellesmere_tftp.py
 create mode 100644 py/ellesmere/u_boot_boardenv_qemu_arm64_na.py
 create mode 100644 py/ellesmere/u_boot_boardenv_qemu_arm_na.py
 create mode 100644 py/ellesmere/u_boot_boardenv_rpi_3_32b.py
py/ellesmere/ellesmere_tftp.py new file +32 -0
new file mode 100644
index 0000000..d2aeb58
@@ -0,0 +1,32 @@
+import os
+import binascii
+
+def file2env(file_name, addr=None):
+    """Create dictionary describing file
+
+    @filename:  name of the file to be described
+    @addr:      address used for loading the file as int (e.g. 0x40400000)
+    Return:     dictionary describing the file with entries
+                * fn    - filename
+                * size  - file size in bytes
+                * crc32 - checksum using CRC-32 algorithm
+                * addr  - loading address, optional
+    """
+    file_full = '/tmp/b/qemu_arm64/' + file_name
+
+    if not os.path.isfile(file_full):
+        print(f'{file_full} not found')
+        return None
+
+    ret = {
+        "fn": file_name,
+        "size": os.path.getsize(file_full),
+    }
+
+    with open(file_full, 'rb') as fd:
+        ret["crc32"] = hex(binascii.crc32(fd.read()) & 0xffffffff)[2:]
+
+    if addr is not None:
+        ret['addr'] = addr
+
+    return ret
py/ellesmere/u_boot_boardenv_qemu_arm64_na.py new file +18 -0
new file mode 100644
index 0000000..23db106
@@ -0,0 +1,18 @@
+import os
+import ellesmere_tftp
+
+#env__net_static_env_vars = [
+    #('ipaddr', '192.168.4.41'),
+    #('netmask', '255.255.255.0'),
+    #('serverip', '192.168.4.1'),
+#]
+
+env__net_uses_pci = True
+env__net_dhcp_server = True
+env__net_tftp_readable_file = ellesmere_tftp.file2env('u-boot.bin', 0x40400000)
+env__efi_loader_helloworld_file = ellesmere_tftp.file2env('helloworld.efi', 0x40400000)
+env__efi_loader_grub_file = ellesmere_tftp.file2env('grubaa64.efi', 0x40400000)
+env__efi_fit_tftp_file = {
+    'addr' : 0x40400000,
+    "dn" : os.environ['UBOOT_TRAVIS_BUILD_DIR'],
+}
py/ellesmere/u_boot_boardenv_qemu_arm_na.py new file +18 -0
new file mode 100644
index 0000000..23db106
@@ -0,0 +1,18 @@
+import os
+import ellesmere_tftp
+
+#env__net_static_env_vars = [
+    #('ipaddr', '192.168.4.41'),
+    #('netmask', '255.255.255.0'),
+    #('serverip', '192.168.4.1'),
+#]
+
+env__net_uses_pci = True
+env__net_dhcp_server = True
+env__net_tftp_readable_file = ellesmere_tftp.file2env('u-boot.bin', 0x40400000)
+env__efi_loader_helloworld_file = ellesmere_tftp.file2env('helloworld.efi', 0x40400000)
+env__efi_loader_grub_file = ellesmere_tftp.file2env('grubaa64.efi', 0x40400000)
+env__efi_fit_tftp_file = {
+    'addr' : 0x40400000,
+    "dn" : os.environ['UBOOT_TRAVIS_BUILD_DIR'],
+}
py/ellesmere/u_boot_boardenv_rpi_3_32b.py new file +38 -0
new file mode 100644
index 0000000..9cc2e1f
@@ -0,0 +1,38 @@
+import ellesmere_tftp
+
+env__net_uses_usb = True
+
+env__net_dhcp_server = True
+
+env__tftp_boot_test_skip = False
+
+env__net_tftp_bootable_file = {
+    'fn': 'v6.6/image.fit.nocomp',
+    'addr': 0x00200000,
+    'size': 85984256,
+    'crc32': '754c839a',
+    'pattern': 'Linux',
+    'config': 'conf-852',
+}
+
+# Details regarding a file that may be read from a TFTP server. This variable
+# may be omitted or set to None if PXE testing is not possible or desired.
+env__net_pxe_bootable_file = {
+    'fn': 'default',
+    'addr': 0x00200000,
+    'size': 64,
+    'timeout': 50000,
+    'pattern': 'Linux',
+    'valid_label': '1',
+    'invalid_label': '2',
+    'exp_str_invalid': 'Skipping install for failure retrieving',
+    'local_label': '3',
+    'exp_str_local': 'missing environment variable: localcmd',
+    'empty_label': '4',
+    'exp_str_empty': 'No kernel given, skipping boot',
+}
+
+# False or omitted if a PXE boot test should be tested.
+# If PXE boot testing is not possible or desired, set this variable to True.
+# For example: If pxe configuration file is not proper to boot
+env__pxe_boot_test_skip = False
Signature · 1 line
2.43.0
#3 lore raw

Re: [u-boot-test-hooks PATCH 3/3] RFC: Add some network info for ellesmere lab

Quoted 7 lines · Simon Glass

Provide network configuration so that some networking tests can be run on ellesmere.

---

 py/ellesmere/ellesmere_tftp.py                | 32 ++++++++++++++++

Erm, can't you just use py/travis-ci/travis_tftp.py as-is? And yes, we should rename "travis" out of files/variables since it's been forever and a half since we used travis-ci.org.

Signature · 1 line
Tom
#4 lore raw

Re: (subset) [u-boot-test-hooks PATCH 1/3] labgrid: Deal with strange Python error

In reply to Simon Glass
Quoted 6 lines · Simon Glass

Add a way to work around an unexplained Python message which appears sometimes with Python 3.12.3

Make the file executable while we are here.

Applied to u-boot/u-boot-test-hooks.git/master, thanks!

Signature · 1 line
Tom
#5 lore raw

Re: (subset) [u-boot-test-hooks PATCH 1/3] labgrid: Deal with strange Python error

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 6 lines · Simon Glass

Add a way to work around an unexplained Python message which appears sometimes with Python 3.12.3

Make the file executable while we are here.

Applied to u-boot/u-boot-test-hooks.git/master, thanks!

I have seen a few responses like this. Is there a way in the tool to indicate which 'part' was applied?

It's not a problem to leave things out...I saw your comments and will take a look.

Regards,
SImon

#6 lore raw

Re: (subset) [u-boot-test-hooks PATCH 1/3] labgrid: Deal with strange Python error

Quoted 9 lines · Simon Glass

Hi Tom,

Quoted 6 lines · Tom Rini
Quoted 3 lines · Simon Glass

Add a way to work around an unexplained Python message which appears sometimes with Python 3.12.3

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Make the file executable while we are here.

Applied to u-boot/u-boot-test-hooks.git/master, thanks!

I have seen a few responses like this. Is there a way in the tool to indicate which 'part' was applied?

Looking at https://b4.docs.kernel.org/en/latest/maintainer/ty.html I don't see it, I'll go poke Konstantin and see if he wants a request filed.

Signature · 1 line
Tom