From: Thomas Weißschuh Date: Wed, 6 Mar 2024 16:36:47 +0000 (+0100) Subject: blkid: (tests) test output formats X-Git-Tag: v2.42-start~472^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11faf236604fbe5aa63b13ff0832c17c230eb91d;p=thirdparty%2Futil-linux.git blkid: (tests) test output formats Signed-off-by: Thomas Weißschuh --- diff --git a/tests/expected/blkid/output-device-cache b/tests/expected/blkid/output-device-cache new file mode 100644 index 000000000..59762f5c7 --- /dev/null +++ b/tests/expected/blkid/output-device-cache @@ -0,0 +1 @@ +blkid-output.img diff --git a/tests/expected/blkid/output-device-probe b/tests/expected/blkid/output-device-probe new file mode 100644 index 000000000..59762f5c7 --- /dev/null +++ b/tests/expected/blkid/output-device-probe @@ -0,0 +1 @@ +blkid-output.img diff --git a/tests/expected/blkid/output-export-cache b/tests/expected/blkid/output-export-cache new file mode 100644 index 000000000..0de13f424 --- /dev/null +++ b/tests/expected/blkid/output-export-cache @@ -0,0 +1,3 @@ +DEVNAME=blkid-output.img +LABEL=tM-CM-)s\"\'^J\ t +TYPE=cramfs diff --git a/tests/expected/blkid/output-export-probe b/tests/expected/blkid/output-export-probe new file mode 100644 index 000000000..55f2d00d1 --- /dev/null +++ b/tests/expected/blkid/output-export-probe @@ -0,0 +1,7 @@ +DEVNAME=blkid-output.img +LABEL=tM-CM-)s\"\'^J\ t +FSSIZE=4096 +VERSION=2 +ENDIANNESS=LITTLE +TYPE=cramfs +USAGE=filesystem diff --git a/tests/expected/blkid/output-full-cache b/tests/expected/blkid/output-full-cache new file mode 100644 index 000000000..287e327ab --- /dev/null +++ b/tests/expected/blkid/output-full-cache @@ -0,0 +1 @@ +blkid-output.img: LABEL="tM-CM-)s\"'^J t" TYPE="cramfs" diff --git a/tests/expected/blkid/output-full-probe b/tests/expected/blkid/output-full-probe new file mode 100644 index 000000000..8763ecee3 --- /dev/null +++ b/tests/expected/blkid/output-full-probe @@ -0,0 +1 @@ +blkid-output.img: LABEL="tM-CM-)s\"'^J t" FSSIZE="4096" VERSION="2" ENDIANNESS="LITTLE" TYPE="cramfs" USAGE="filesystem" diff --git a/tests/expected/blkid/output-udev-cache b/tests/expected/blkid/output-udev-cache new file mode 100644 index 000000000..8e0e6a6a8 --- /dev/null +++ b/tests/expected/blkid/output-udev-cache @@ -0,0 +1,3 @@ +ID_FS_LABEL=tés"'_t +ID_FS_LABEL_ENC=tés\x22\x27\x0a\x20t +ID_FS_TYPE=cramfs diff --git a/tests/expected/blkid/output-udev-probe b/tests/expected/blkid/output-udev-probe new file mode 100644 index 000000000..59a3224bb --- /dev/null +++ b/tests/expected/blkid/output-udev-probe @@ -0,0 +1,7 @@ +ID_FS_LABEL=tés"'_t +ID_FS_LABEL_ENC=tés\x22\x27\x0a\x20t +ID_FS_FSSIZE=4096 +ID_FS_VERSION=2 +ID_FS_ENDIANNESS=LITTLE +ID_FS_TYPE=cramfs +ID_FS_USAGE=filesystem diff --git a/tests/expected/blkid/output-value-cache b/tests/expected/blkid/output-value-cache new file mode 100644 index 000000000..71e840265 --- /dev/null +++ b/tests/expected/blkid/output-value-cache @@ -0,0 +1,3 @@ +tés"' + t +cramfs diff --git a/tests/expected/blkid/output-value-probe b/tests/expected/blkid/output-value-probe new file mode 100644 index 000000000..56cac729d --- /dev/null +++ b/tests/expected/blkid/output-value-probe @@ -0,0 +1,7 @@ +tés"' + t +4096 +2 +LITTLE +cramfs +filesystem diff --git a/tests/ts/blkid/blkid-output.img.xz b/tests/ts/blkid/blkid-output.img.xz new file mode 100644 index 000000000..126f33aba Binary files /dev/null and b/tests/ts/blkid/blkid-output.img.xz differ diff --git a/tests/ts/blkid/output b/tests/ts/blkid/output new file mode 100755 index 000000000..ff77f1dbe --- /dev/null +++ b/tests/ts/blkid/output @@ -0,0 +1,46 @@ +#!/bin/bash + +# +# Copyright (C) 2024 Thomas Weißschuh +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="output formatting" + +. "$TS_TOPDIR"/functions.sh + +ts_init "$*" + +ts_check_test_command "$TS_CMD_BLKID" +ts_check_prog "xz" + +outimg="$TS_OUTDIR"/blkid-output.img +xz -dc "$TS_SELF"/blkid-output.img.xz > $outimg + +_blkid() { + "$TS_CMD_BLKID" --cache-file "$TS_OUTDIR"/blkid.cache "$@" "$outimg" | sed -e "s#$TS_OUTDIR/##" +} + +for format in value udev export full device; do + ts_init_subtest "$format-probe" + _blkid --probe --output "$format" >> "$TS_OUTPUT" + ts_finalize_subtest + + ts_init_subtest "$format-cache" + _blkid --output "$format" >> "$TS_OUTPUT" + ts_finalize_subtest +done + +ts_finalize