Skip to content

Commit 93bc899

Browse files
committed
tests: Fix targets/kernel version detection
It is really not a good idea to check minor version without checking major version is not lower first. Also try to prepare for situation when major target versions increases.
1 parent 52c63b5 commit 93bc899

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

tests/compat-test2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ dm_crypt_capi_support()
184184
VER_MAJ=$(echo $VER_STR | cut -f 1 -d.)
185185
VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
186186

187+
[ $VER_MAJ -gt 1 ] && return 0
187188
if [ $VER_MIN -ge 16 ]; then
188189
return 0
189190
fi
@@ -239,6 +240,7 @@ dm_crypt_sector_size_support()
239240
VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
240241
VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
241242

243+
[ $VER_MAJ -gt 1 ] && return 0
242244
if [ $VER_MIN -ge 17 -o \( $VER_MIN -eq 14 -a $VER_PTC -ge 5 \) ]; then
243245
return 0
244246
fi

tests/integrity-compat-test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ dm_integrity_features()
6161
VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
6262

6363
[ $VER_MAJ -lt 1 ] && return
64+
[ $VER_MAJ -gt 1 ] && {
65+
DM_INTEGRITY_META=1
66+
DM_INTEGRITY_RECALC=1
67+
DM_INTEGRITY_BITMAP=1
68+
DM_INTEGRITY_RESIZE_SUPPORTED=1
69+
DM_INTEGRITY_HMAC_FIX=1
70+
DM_INTEGRITY_RESET=1
71+
return
72+
}
6473
[ $VER_MIN -gt 1 ] && {
6574
DM_INTEGRITY_META=1
6675
DM_INTEGRITY_RECALC=1

tests/mode-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ dm_crypt_capi_support()
6464
VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
6565
VER_PTC=$(echo $VER_STR | cut -f 3 -d.)
6666

67+
[ $VER_MAJ -gt 1 ] && return 0
6768
if [ $VER_MIN -ge 16 ]; then
6869
return 0
6970
fi

tests/verity-compat-test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ check_version() # MAJ MIN
8383
VER_MIN=$(echo $VER_STR | cut -f 2 -d.)
8484

8585
test $VER_MAJ -gt $1 && return 0
86+
test $VER_MAJ -lt $1 && return 1
8687
test $VER_MIN -ge $2 && return 0
88+
8789
return 1
8890
}
8991

@@ -95,6 +97,7 @@ check_version_kernel()
9597
KER_MIN=$(echo $KER_STR | cut -f 2 -d.)
9698

9799
test $KER_MAJ -gt $1 && return 0
100+
test $KER_MAJ -lt $1 && return 1
98101
test $KER_MIN -ge $2 && return 0
99102

100103
return 1

0 commit comments

Comments
 (0)