diff options
Diffstat (limited to '')
29 files changed, 116 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..9a56926 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: preprocess +# We don't use gcc but need it to avoid #945772 +Depends: diffutils, gcc 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" diff --git a/debian/tests/preprocess-data/builtin.in b/debian/tests/preprocess-data/builtin.in new file mode 100644 index 0000000..6a13e96 --- /dev/null +++ b/debian/tests/preprocess-data/builtin.in @@ -0,0 +1 @@ +builtin diff --git a/debian/tests/preprocess-data/builtin.out b/debian/tests/preprocess-data/builtin.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/debian/tests/preprocess-data/builtin.out diff --git a/debian/tests/preprocess-data/excludemissing.in b/debian/tests/preprocess-data/excludemissing.in new file mode 100644 index 0000000..4d71975 --- /dev/null +++ b/debian/tests/preprocess-data/excludemissing.in @@ -0,0 +1,3 @@ +does-not-exist +foo +does-not-exist - diff --git a/debian/tests/preprocess-data/excludemissing.out b/debian/tests/preprocess-data/excludemissing.out new file mode 100644 index 0000000..a476456 --- /dev/null +++ b/debian/tests/preprocess-data/excludemissing.out @@ -0,0 +1 @@ +kernel/drivers/foo.ko diff --git a/debian/tests/preprocess-data/filelist b/debian/tests/preprocess-data/filelist new file mode 100644 index 0000000..2a6fbf3 --- /dev/null +++ b/debian/tests/preprocess-data/filelist @@ -0,0 +1,18 @@ +extra/foo.ko +extra/hyp-hen.ko +extra/under_score.ko +kernel/drivers/foo.ko +kernel/drivers/hyp-hen.ko +kernel/drivers/under_score.ko +kernel/drivers/subdir/bar.ko +kernel/drivers/subdir/baz.ko +modules.alias +modules.alias.bin +modules.builtin.bin +modules.dep +modules.dep.bin +modules.devname +modules.order +modules.softdep +modules.symbols +modules.symbols.bin diff --git a/debian/tests/preprocess-data/hyphen.in b/debian/tests/preprocess-data/hyphen.in new file mode 100644 index 0000000..3645353 --- /dev/null +++ b/debian/tests/preprocess-data/hyphen.in @@ -0,0 +1,2 @@ +hyp-hen +under-score diff --git a/debian/tests/preprocess-data/hyphen.out b/debian/tests/preprocess-data/hyphen.out new file mode 100644 index 0000000..001fbd3 --- /dev/null +++ b/debian/tests/preprocess-data/hyphen.out @@ -0,0 +1,2 @@ +kernel/drivers/hyp-hen.ko +kernel/drivers/under_score.ko diff --git a/debian/tests/preprocess-data/include.in b/debian/tests/preprocess-data/include.in new file mode 100644 index 0000000..8645503 --- /dev/null +++ b/debian/tests/preprocess-data/include.in @@ -0,0 +1,2 @@ +#include <common> +foo diff --git a/debian/tests/preprocess-data/include.out b/debian/tests/preprocess-data/include.out new file mode 100644 index 0000000..09ca089 --- /dev/null +++ b/debian/tests/preprocess-data/include.out @@ -0,0 +1,2 @@ +kernel/drivers/foo.ko +kernel/drivers/subdir/bar.ko diff --git a/debian/tests/preprocess-data/missing.err b/debian/tests/preprocess-data/missing.err new file mode 100644 index 0000000..c9f581c --- /dev/null +++ b/debian/tests/preprocess-data/missing.err @@ -0,0 +1 @@ +missing module does-not-exist diff --git a/debian/tests/preprocess-data/missing.in b/debian/tests/preprocess-data/missing.in new file mode 100644 index 0000000..6702195 --- /dev/null +++ b/debian/tests/preprocess-data/missing.in @@ -0,0 +1 @@ +does-not-exist diff --git a/debian/tests/preprocess-data/missing.out b/debian/tests/preprocess-data/missing.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/debian/tests/preprocess-data/missing.out diff --git a/debian/tests/preprocess-data/missing.rc b/debian/tests/preprocess-data/missing.rc new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/debian/tests/preprocess-data/missing.rc @@ -0,0 +1 @@ +1 diff --git a/debian/tests/preprocess-data/missingdir.err b/debian/tests/preprocess-data/missingdir.err new file mode 100644 index 0000000..aad5c3a --- /dev/null +++ b/debian/tests/preprocess-data/missingdir.err @@ -0,0 +1,2 @@ +pattern missing/dir/* refers to nonexistent subdirectory +Died at SOMEWHERE, <$fh> line 1. diff --git a/debian/tests/preprocess-data/missingdir.in b/debian/tests/preprocess-data/missingdir.in new file mode 100644 index 0000000..3af1147 --- /dev/null +++ b/debian/tests/preprocess-data/missingdir.in @@ -0,0 +1 @@ +missing/dir/* diff --git a/debian/tests/preprocess-data/missingdir.out b/debian/tests/preprocess-data/missingdir.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/debian/tests/preprocess-data/missingdir.out diff --git a/debian/tests/preprocess-data/missingdir.rc b/debian/tests/preprocess-data/missingdir.rc new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/debian/tests/preprocess-data/missingdir.rc @@ -0,0 +1 @@ +1 diff --git a/debian/tests/preprocess-data/modules.builtin b/debian/tests/preprocess-data/modules.builtin new file mode 100644 index 0000000..4f01ad9 --- /dev/null +++ b/debian/tests/preprocess-data/modules.builtin @@ -0,0 +1 @@ +kernel/blah/builtin.ko diff --git a/debian/tests/preprocess-data/modules/common b/debian/tests/preprocess-data/modules/common new file mode 100644 index 0000000..5716ca5 --- /dev/null +++ b/debian/tests/preprocess-data/modules/common @@ -0,0 +1 @@ +bar diff --git a/debian/tests/preprocess-data/simple.in b/debian/tests/preprocess-data/simple.in new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/debian/tests/preprocess-data/simple.in @@ -0,0 +1 @@ +foo diff --git a/debian/tests/preprocess-data/simple.out b/debian/tests/preprocess-data/simple.out new file mode 100644 index 0000000..a476456 --- /dev/null +++ b/debian/tests/preprocess-data/simple.out @@ -0,0 +1 @@ +kernel/drivers/foo.ko diff --git a/debian/tests/preprocess-data/underscore.in b/debian/tests/preprocess-data/underscore.in new file mode 100644 index 0000000..15f1fb8 --- /dev/null +++ b/debian/tests/preprocess-data/underscore.in @@ -0,0 +1,2 @@ +hyp_hen +under_score diff --git a/debian/tests/preprocess-data/underscore.out b/debian/tests/preprocess-data/underscore.out new file mode 100644 index 0000000..001fbd3 --- /dev/null +++ b/debian/tests/preprocess-data/underscore.out @@ -0,0 +1,2 @@ +kernel/drivers/hyp-hen.ko +kernel/drivers/under_score.ko diff --git a/debian/tests/preprocess-data/wilddoublestar.in b/debian/tests/preprocess-data/wilddoublestar.in new file mode 100644 index 0000000..e1d26f4 --- /dev/null +++ b/debian/tests/preprocess-data/wilddoublestar.in @@ -0,0 +1 @@ +kernel/drivers/** diff --git a/debian/tests/preprocess-data/wilddoublestar.out b/debian/tests/preprocess-data/wilddoublestar.out new file mode 100644 index 0000000..ccd912a --- /dev/null +++ b/debian/tests/preprocess-data/wilddoublestar.out @@ -0,0 +1,5 @@ +kernel/drivers/foo.ko +kernel/drivers/hyp-hen.ko +kernel/drivers/subdir/bar.ko +kernel/drivers/subdir/baz.ko +kernel/drivers/under_score.ko diff --git a/debian/tests/preprocess-data/wildstar.in b/debian/tests/preprocess-data/wildstar.in new file mode 100644 index 0000000..a68e216 --- /dev/null +++ b/debian/tests/preprocess-data/wildstar.in @@ -0,0 +1 @@ +kernel/drivers/* diff --git a/debian/tests/preprocess-data/wildstar.out b/debian/tests/preprocess-data/wildstar.out new file mode 100644 index 0000000..ad33cd5 --- /dev/null +++ b/debian/tests/preprocess-data/wildstar.out @@ -0,0 +1,3 @@ +kernel/drivers/foo.ko +kernel/drivers/hyp-hen.ko +kernel/drivers/under_score.ko |