[PATCH 4/7] test: sandbox: support testing with Labgrid

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Aug 13 00:01:58 PDT 2024


From: Bastian Krause <bst at pengutronix.de>

It turns out there is already support in Labgrid to execute an
interactive console application and run tests against it.

Switch our test/sandbox/sandbox_defconfig.yaml to use this, so we can
eventually test sandbox in CI as well.

For proper operation, we require that labgrid doesn't buffer output
of the barebox sandbox process, which was recently fixed in [1].

[1]: https://github.com/labgrid-project/labgrid/pull/1440

Signed-off-by: Bastian Krause <bst at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - no change
---
 test/emulate.pl                     |  6 +++---
 test/sandbox/sandbox_defconfig.yaml | 17 ++++++++++-------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/test/emulate.pl b/test/emulate.pl
index 086fae0f7708..df21d5c727bf 100755
--- a/test/emulate.pl
+++ b/test/emulate.pl
@@ -340,12 +340,12 @@ sub emulate {
 
 	    vsystem($temu{temu_bin}, "tinyemu.cfg", @OPTS) == 0
 		or die "Error running emulator: $?\n";
-    } elsif (defined $target{drivers}{NativeExecutableDriver}) {
-	    my %exec = %{$target{drivers}{NativeExecutableDriver}};
+    } elsif (defined $target{drivers}{ExternalConsoleDriver}) {
+	    my %exec = %{$target{drivers}{ExternalConsoleDriver}};
 
 	    pushd($args{builddir}) if $tuxmake;
 
-	    vsystem($exec{command}, @OPTS) == 0 or die "Error running emulator: $?\n";
+	    vsystem($exec{cmd}, @OPTS) == 0 or die "Error running emulator: $?\n";
     }
 
     popd() if $tuxmake;
diff --git a/test/sandbox/sandbox_defconfig.yaml b/test/sandbox/sandbox_defconfig.yaml
index 784f49146605..eb9ab7f17a55 100644
--- a/test/sandbox/sandbox_defconfig.yaml
+++ b/test/sandbox/sandbox_defconfig.yaml
@@ -1,12 +1,15 @@
 targets:
   main:
     drivers:
-      NativeExecutableDriver: # not yet supported by labgrid, only for interactive use
-        command: ./barebox
-        image: barebox
+      ExternalConsoleDriver:
+        cmd: !template "$LG_BUILDDIR/barebox"
+      ExternalPowerDriver:
+        cmd_on: 'true'
+        cmd_off: 'true'
+      BareboxDriver:
+        prompt: "barebox@[^:]+:[^ ]+ "
+      BareboxTestStrategy: {}
     runner:
       tuxmake_arch: um
-images:
-  barebox: !template "$LG_BUILDDIR/barebox"
-tools:
-  qemu: /usr/local/bin/temu
+imports:
+  -  ../strategy.py
-- 
2.39.2




More information about the barebox mailing list