Skip to content

Commit 3e1d95b

Browse files
committed
selftests: kallsyms: fix and clarify current test boundaries
Provide and clarify the existing ranges and what you should expect. Fix the gen_test_kallsyms.sh script to accept different ranges. Fixes: 84b4a51 ("selftests: add new kallsyms selftests") Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 7ea1355 commit 3e1d95b

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

lib/Kconfig.debug

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3003,9 +3003,39 @@ config TEST_KALLSYMS_D
30033003
tristate
30043004
depends on m
30053005

3006+
choice
3007+
prompt "Kallsym test range"
3008+
default TEST_KALLSYMS_LARGE
3009+
help
3010+
Selecting something other than "Fast" will enable tests which slow
3011+
down the build and may crash your build.
3012+
3013+
config TEST_KALLSYMS_FAST
3014+
bool "Fast builds"
3015+
help
3016+
You won't really be testing kallsysms, so this just helps fast builds
3017+
when allmodconfig is used..
3018+
3019+
config TEST_KALLSYMS_LARGE
3020+
bool "Enable testing kallsyms with large exports"
3021+
help
3022+
This will enable larger number of symbols. This will slow down
3023+
your build considerably.
3024+
3025+
config TEST_KALLSYMS_MAX
3026+
bool "Known kallsysms limits"
3027+
help
3028+
This will enable exports to the point we know we'll start crashing
3029+
builds.
3030+
3031+
endchoice
3032+
30063033
config TEST_KALLSYMS_NUMSYMS
30073034
int "test kallsyms number of symbols"
3008-
default 100
3035+
range 2 10000
3036+
default 2 if TEST_KALLSYMS_FAST
3037+
default 100 if TEST_KALLSYMS_LARGE
3038+
default 10000 if TEST_KALLSYMS_MAX
30093039
help
30103040
The number of symbols to create on TEST_KALLSYMS_A, only one of which
30113041
module TEST_KALLSYMS_B will use. This also will be used

lib/tests/module/gen_test_kallsyms.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ NUM_SYMS=$2
77
SCALE_FACTOR=$3
88
TEST_TYPE=$(echo $TARGET | sed -e 's|lib/tests/module/test_kallsyms_||g')
99
TEST_TYPE=$(echo $TEST_TYPE | sed -e 's|.c||g')
10+
FIRST_B_LOOKUP=1
11+
12+
if [[ $NUM_SYMS -gt 2 ]]; then
13+
FIRST_B_LOOKUP=$((NUM_SYMS/2))
14+
fi
1015

1116
gen_template_module_header()
1217
{
@@ -52,10 +57,10 @@ ____END_MODULE
5257

5358
gen_template_module_data_b()
5459
{
55-
printf "\nextern int auto_test_a_%010d;\n\n" 28
60+
printf "\nextern int auto_test_a_%010d;\n\n" $FIRST_B_LOOKUP
5661
echo "static int auto_runtime_test(void)"
5762
echo "{"
58-
printf "\nreturn auto_test_a_%010d;\n" 28
63+
printf "\nreturn auto_test_a_%010d;\n" $FIRST_B_LOOKUP
5964
echo "}"
6065
}
6166

0 commit comments

Comments
 (0)