]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-13-NSPAWN: the host kernel may not support /proc/kcore
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 25 Nov 2025 18:13:15 +0000 (03:13 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 7 Dec 2025 00:09:03 +0000 (09:09 +0900)
test/units/TEST-13-NSPAWN.nspawn-oci.sh

index 877482c0f1fb88205d114b71767172b55d80c114..1fd2a5ad76774b30c601215a0e61b69237532772 100755 (executable)
@@ -39,6 +39,12 @@ create_dummy_container "$OCI/rootfs"
 mkdir -p "$OCI/rootfs/opt/var"
 mkdir -p "$OCI/rootfs/opt/readonly"
 
+if [[ -e /proc/kcore ]]; then
+    HAVE_PROC_KCORE=1
+else
+    HAVE_PROC_KCORE=0
+fi
+
 # Let's start with a simple config
 cat >"$OCI/config.json" <<EOF
 {
@@ -376,8 +382,12 @@ test -b "$DEV"
 [[ "\$(stat -c '%t:%T' "$DEV")" == 4:2 ]]
 
 # Linux - maskedPaths
-test -e /proc/kcore
-cat /proc/kcore && exit 1
+if [[ "$HAVE_PROC_KCORE" == 1 ]]; then
+    test -e /proc/kcore
+    cat /proc/kcore && exit 1
+else
+    test ! -e /proc/kcore
+fi
 test ! -e /root/nonexistent
 
 # Linux - readonlyPaths