From 11faf236604fbe5aa63b13ff0832c17c230eb91d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Wed, 6 Mar 2024 17:36:47 +0100 Subject: [PATCH] blkid: (tests) test output formats MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Weißschuh --- tests/expected/blkid/output-device-cache | 1 + tests/expected/blkid/output-device-probe | 1 + tests/expected/blkid/output-export-cache | 3 ++ tests/expected/blkid/output-export-probe | 7 ++++ tests/expected/blkid/output-full-cache | 1 + tests/expected/blkid/output-full-probe | 1 + tests/expected/blkid/output-udev-cache | 3 ++ tests/expected/blkid/output-udev-probe | 7 ++++ tests/expected/blkid/output-value-cache | 3 ++ tests/expected/blkid/output-value-probe | 7 ++++ tests/ts/blkid/blkid-output.img.xz | Bin 0 -> 156 bytes tests/ts/blkid/output | 46 +++++++++++++++++++++++ 12 files changed, 80 insertions(+) create mode 100644 tests/expected/blkid/output-device-cache create mode 100644 tests/expected/blkid/output-device-probe create mode 100644 tests/expected/blkid/output-export-cache create mode 100644 tests/expected/blkid/output-export-probe create mode 100644 tests/expected/blkid/output-full-cache create mode 100644 tests/expected/blkid/output-full-probe create mode 100644 tests/expected/blkid/output-udev-cache create mode 100644 tests/expected/blkid/output-udev-probe create mode 100644 tests/expected/blkid/output-value-cache create mode 100644 tests/expected/blkid/output-value-probe create mode 100644 tests/ts/blkid/blkid-output.img.xz create mode 100755 tests/ts/blkid/output 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 0000000000000000000000000000000000000000..126f33aba4bddbbf7ae0626d83f5212547e1372e GIT binary patch literal 156 zc-s4GUKJ6=z`*kC+7>sK12GK>ii|Q0P{6*Z{PhF={|q6q3`+f>iy9al?{BsDJ|21U zvRLT8iBTJ;F3>pp%2;9BoGG?FN{hp6xWC=`$o_d=wRY~6vwP;;Y~*h1I;s_$@hbby z|COuScdd_qa656%j6J{Bs~#;;d(Ob%XuEGm`qCp642%^G3PAhrx_mI*cqIKd6UcIw G$S434Iz#XP literal 0 Hc-jL100001 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 -- 2.47.2