diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 09:43:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 09:43:48 +0000 |
commit | 9f9e2107834eea0b2c52e36977978089d5416fa3 (patch) | |
tree | c11e850afb8d1dba988ab15f2b0a7be6364209dc /debian/tests/preprocess | |
parent | Adding upstream version 2.105. (diff) | |
download | kernel-wedge-9f9e2107834eea0b2c52e36977978089d5416fa3.tar.xz kernel-wedge-9f9e2107834eea0b2c52e36977978089d5416fa3.zip |
Adding debian version 2.105.debian/2.105debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/preprocess')
-rwxr-xr-x | debian/tests/preprocess | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/tests/preprocess b/debian/tests/preprocess new file mode 100755 index 0000000..3106f75 --- /dev/null +++ b/debian/tests/preprocess @@ -0,0 +1,57 @@ +#!/bin/sh -eu + +datadir="debian/tests/preprocess-data" +moddir="$AUTOPKGTEST_TMP/modules" + +# Create dummy module files and modules.builtin +while read -r filename; do + mkdir -p "$moddir/$(dirname "$filename")" + touch "$moddir/$filename" +done < "$datadir/filelist" +cp "$datadir/modules.builtin" "$moddir/" + +# Access $moddir via a symlink, to test for Debian Bug #955210 +ln -nsf "$moddir" "${moddir}.symlink" +moddir="${moddir}.symlink" + +my_rc=0 + +export KW_DEFCONFIG_DIR="$PWD/$datadir" +for input in "$datadir"/*.in; do + name="$(basename "${input%.in}")" + echo "I: Testing preprocess case $name" + + output="$AUTOPKGTEST_TMP/$name.out" + error="$AUTOPKGTEST_TMP/$name.err" + rc=0; commands/preprocess "$input" "$moddir" >"$output" 2>"$error" || rc=$? + + # Replace source locations in error messages, so expected error + # messages don't need to be updated for every change of line no. + sed -i 's/at [^ ]* line [0-9]*/at SOMEWHERE/' "$error" + + # Find expected output, error messages and exit code + exp_output="$datadir/$name.out" + if [ -f "$datadir/$name.err" ]; then + exp_error="$datadir/$name.err" + else + exp_error=/dev/null + fi + if [ -f "$datadir/$name.rc" ]; then + exp_rc="$(cat "$datadir/$name.rc")" + else + exp_rc=0 + fi + + # Compare actual with expected + if diff -q "$exp_output" "$output" && diff -q "$exp_error" "$error" \ + && [ "$rc" = "$exp_rc" ]; then + echo "I: pass" + else + diff -u "$exp_output" "$output" || true + diff -u "$exp_error" "$error" || true + echo "E: rc=$rc" + my_rc=1 + fi +done + +exit "$my_rc" |