7
7
# real test to check that the kernel is configured to support at least 5
8
8
# pagetable levels.
9
9
10
- # 1 means the test failed
11
- exitcode=1
12
-
13
10
# Kselftest framework requirement - SKIP code is 4.
14
11
ksft_skip=4
15
12
16
- fail ()
13
+ skip ()
17
14
{
18
15
echo " $1 "
19
- exit $exitcode
16
+ exit $ksft_skip
20
17
}
21
18
22
19
check_supported_x86_64 ()
23
20
{
24
21
local config=" /proc/config.gz"
25
22
[[ -f " ${config} " ]] || config=" /boot/config-$( uname -r) "
26
- [[ -f " ${config} " ]] || fail " Cannot find kernel config in /proc or /boot"
23
+ [[ -f " ${config} " ]] || skip " Cannot find kernel config in /proc or /boot"
27
24
28
25
# gzip -dcfq automatically handles both compressed and plaintext input.
29
26
# See man 1 gzip under '-f'.
@@ -33,36 +30,31 @@ check_supported_x86_64()
33
30
else {print 1}; exit}' /proc/cpuinfo 2> /dev/null)
34
31
35
32
if [[ " ${pg_table_levels} " -lt 5 ]]; then
36
- echo " $0 : PGTABLE_LEVELS=${pg_table_levels} , must be >= 5 to run this test"
37
- exit $ksft_skip
33
+ skip " $0 : PGTABLE_LEVELS=${pg_table_levels} , must be >= 5 to run this test"
38
34
elif [[ " ${cpu_supports_pl5} " -ne 0 ]]; then
39
- echo " $0 : CPU does not have the necessary la57 flag to support page table level 5"
40
- exit $ksft_skip
35
+ skip " $0 : CPU does not have the necessary la57 flag to support page table level 5"
41
36
fi
42
37
}
43
38
44
39
check_supported_ppc64 ()
45
40
{
46
41
local config=" /proc/config.gz"
47
42
[[ -f " ${config} " ]] || config=" /boot/config-$( uname -r) "
48
- [[ -f " ${config} " ]] || fail " Cannot find kernel config in /proc or /boot"
43
+ [[ -f " ${config} " ]] || skip " Cannot find kernel config in /proc or /boot"
49
44
50
45
local pg_table_levels=$( gzip -dcfq " ${config} " | grep PGTABLE_LEVELS | cut -d' =' -f 2)
51
46
if [[ " ${pg_table_levels} " -lt 5 ]]; then
52
- echo " $0 : PGTABLE_LEVELS=${pg_table_levels} , must be >= 5 to run this test"
53
- exit $ksft_skip
47
+ skip " $0 : PGTABLE_LEVELS=${pg_table_levels} , must be >= 5 to run this test"
54
48
fi
55
49
56
50
local mmu_support=$( grep -m1 " mmu" /proc/cpuinfo | awk ' {print $3}' )
57
51
if [[ " $mmu_support " != " radix" ]]; then
58
- echo " $0 : System does not use Radix MMU, required for 5-level paging"
59
- exit $ksft_skip
52
+ skip " $0 : System does not use Radix MMU, required for 5-level paging"
60
53
fi
61
54
62
55
local hugepages_total=$( awk ' /HugePages_Total/ {print $2}' /proc/meminfo)
63
56
if [[ " ${hugepages_total} " -eq 0 ]]; then
64
- echo " $0 : HugePages are not enabled, required for some tests"
65
- exit $ksft_skip
57
+ skip " $0 : HugePages are not enabled, required for some tests"
66
58
fi
67
59
}
68
60
0 commit comments