]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test: add docker as a fallback in addition to podman
authorJo Zzsi <jozzsicsataban@gmail.com>
Sun, 27 Oct 2024 22:02:23 +0000 (18:02 -0400)
committerLaszlo <laszlo.gombos@gmail.com>
Mon, 28 Oct 2024 00:20:20 +0000 (20:20 -0400)
doc_site/modules/ROOT/pages/developer/hacking.adoc
test/test-podman.sh [deleted file]
test/test.sh [new file with mode: 0755]

index af236f7b531f75a19b2bdb68d9aac98305556866..3dfb57cff9d46b1d936a00256c9081aeb6df89d8 100644 (file)
@@ -255,17 +255,17 @@ All processes started before should be killed here.
 
 == Testsuite
 
-=== Rootless in a container with podman
+=== In a container
 
 [,console]
 ----
 $ cd <DRACUT_SOURCE>
-$ test/test-podman.sh [TESTS] [CONTAINER]
+$ test/test.sh [CONTAINER] [TESTS]
 ----
 
 with `[CONTAINER]` being one of the
 https://github.com/orgs/dracut-ng/packages[github `dracut-ng` containers],
-e.g. `ghcr.io/dracut-ng/fedora:latest`.
+e.g. `fedora`.
 
 === On bare metal
 
diff --git a/test/test-podman.sh b/test/test-podman.sh
deleted file mode 100755 (executable)
index 85eed74..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-TESTS=$1
-CONTAINER=$2
-
-[ -z "$CONTAINER" ] && CONTAINER='ghcr.io/dracut-ng/fedora'
-
-podman run --rm -it --device=/dev/kvm -v "$PWD"/:/z "$CONTAINER" /z/test/test-github.sh id "$TESTS"
diff --git a/test/test.sh b/test/test.sh
new file mode 100755 (executable)
index 0000000..25b29f1
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+CONTAINER=$1
+TESTS=$2
+
+[ -z "$CONTAINER" ] && CONTAINER='fedora'
+
+if command -v podman &> /dev/null; then
+    podman run --rm -it --device=/dev/kvm -e V=0 -v "$PWD"/:/z "ghcr.io/dracut-ng/$CONTAINER" /z/test/test-github.sh id "$TESTS"
+else
+    docker run --rm -it --device=/dev/kvm -e V=0 -v "$PWD"/:/z "ghcr.io/dracut-ng/$CONTAINER" /z/test/test-github.sh id "$TESTS"
+fi