~registry/kmod/master

« back to all changes in this revision

Viewing changes to testsuite/populate-modules.sh

  • Committer: Lucas De Marchi
  • Date: 2021-02-06 03:52:00 UTC
  • Revision ID: git-v1:1921c370c25cb4735105397c285ffa38a04b286b
testsuite: compress modules if feature is enabled

Since the output needs to be the same, regardless if the module is
compressed, change populate-modules.sh to conditionally compress the
module if that feature is enabled.

This way we can execute the tests with any build-time configuration and
it should still pass.

Suggested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Michal Suchánek <msuchanek@suse.de>
Tested-by: Michal Suchánek <msuchanek@suse.de>
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
MODULE_PLAYGROUND=$1
6
6
ROOTFS=$2
 
7
CONFIG_H=$3
 
8
 
 
9
feature_enabled() {
 
10
        local feature=$1
 
11
        grep KMOD_FEATURES  $CONFIG_H | head -n 1 | grep -q \+$feature
 
12
}
7
13
 
8
14
declare -A map
9
15
map=(
99
105
 
100
106
# start poking the final rootfs...
101
107
 
102
 
# gzip these modules
103
 
for m in "${gzip_array[@]}"; do
104
 
    gzip "$ROOTFS/$m"
105
 
done
 
108
# compress modules with each format if feature is enabled
 
109
if feature_enabled ZLIB; then
 
110
        for m in "${gzip_array[@]}"; do
 
111
            gzip "$ROOTFS/$m"
 
112
        done
 
113
fi
106
114
 
107
 
# zstd-compress these modules
108
 
for m in "${zstd_array[@]}"; do
109
 
    zstd --rm $ROOTFS/$m
110
 
done
 
115
if feature_enabled ZSTD; then
 
116
        for m in "${zstd_array[@]}"; do
 
117
            zstd --rm $ROOTFS/$m
 
118
        done
 
119
fi
111
120
 
112
121
for m in "${attach_sha1_array[@]}"; do
113
122
    cat "${MODULE_PLAYGROUND}/dummy.sha1" >>"${ROOTFS}/$m"