From a15ecbd7a0f817d3af004538a99c511e4231d812 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Thu, 25 Sep 2025 12:35:00 +0200 Subject: [PATCH] test(SKIPCPIO): support 3cpio Support using 3cpio in the skipcpio test to allow not having `cpio` installed. --- test/TEST-81-SKIPCPIO/test.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/TEST-81-SKIPCPIO/test.sh b/test/TEST-81-SKIPCPIO/test.sh index 877317f00..1bdeb1c8e 100755 --- a/test/TEST-81-SKIPCPIO/test.sh +++ b/test/TEST-81-SKIPCPIO/test.sh @@ -7,16 +7,29 @@ set -eu TEST_DESCRIPTION="test skipcpio" test_check() { - (command -v cpio && command -v find && command -v diff) &> /dev/null + if ! command -v 3cpio &> /dev/null && ! command -v cpio &> /dev/null; then + echo "Neither 3cpio nor cpio are available." + return 1 + fi + + (command -v find && command -v diff) &> /dev/null } cpio_create() { - find . -print0 | sort -z | cpio -o --null -H newc + if command -v 3cpio &> /dev/null; then + find . | sort | 3cpio --create + else + find . -print0 | sort -z | cpio -o --null -H newc + fi } cpio_list_first() { local file="$1" - cpio --extract --quiet --list < "$file" + if command -v 3cpio &> /dev/null; then + 3cpio --list --parts 1 "$file" + else + cpio --extract --quiet --list < "$file" + fi } skipcpio_simple() { -- 2.47.3