43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
function die()
|
||
|
{
|
||
|
printf '%s\n' "$*" >&2
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
set -e
|
||
|
|
||
|
cd modalias.prov.testdata
|
||
|
test -x ../../modalias.prov || die "No ../../modalias.prov"
|
||
|
|
||
|
# Copy and add -t option to modalias.prov
|
||
|
cp ../../modalias.prov modalias.prov
|
||
|
patch -p1 <<"EOF"
|
||
|
--- a/modalias.prov
|
||
|
+++ b/modalias.prov
|
||
|
@@ -86,6 +86,17 @@ combine_modaliases() {
|
||
|
print_modaliases "$class" "$variants" "$pos"
|
||
|
}
|
||
|
|
||
|
+if [ "$#" = 2 ] && [ "$1" = "-t" ]; then
|
||
|
+ cat -- "$2" \
|
||
|
+ | { while read line; do echo "${#line} $line"; done } \
|
||
|
+ | LC_ALL=C sort -u \
|
||
|
+ | combine_modaliases \
|
||
|
+ >"$2.test"
|
||
|
+ echo "Comparing results for $2"
|
||
|
+ diff -u "$2.right" "$2.test" && rm -- "$2.test"
|
||
|
+ exit
|
||
|
+fi
|
||
|
+
|
||
|
for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do
|
||
|
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
||
|
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
||
|
EOF
|
||
|
|
||
|
find | grep '\.ko.*\.modalias$' | xargs -n1 ./modalias.prov -t
|
||
|
|
||
|
# Rename newly generated .test as .right
|
||
|
#find | grep '\.ko.*\.modalias$' | xargs -I'{}' mv '{}'.test '{}'.right
|