2 # SPDX-License-Identifier: GPL-2.0-or-later
4 if [ "x${URCU_TESTS_SRCDIR:-}" != "x" ]; then
5 UTILSSH
="$URCU_TESTS_SRCDIR/utils/utils.sh"
7 UTILSSH
="$(dirname "$0")/../utils/utils.sh"
10 # shellcheck source=../utils/utils.sh
13 # shellcheck source=../../utils/tap.sh
14 source "$URCU_TESTS_SRCDIR/utils/tap.sh"
16 CURDIR
="${URCU_TESTS_BUILDDIR}/unit"
18 STD_OUTPUT
="/dev/null"
30 for i
in "${cpus[@]}"; do
35 test_get_max_cpuid_from_sysfs
() {
38 local current_cpus
=("$@")
41 populate_testdir
"${current_cpus[@]}" >"$STD_OUTPUT" 2>"$STD_ERROR"
42 result
=$
("${CURDIR}/get_max_cpuid_from_sysfs" "$TESTDIR")
43 is
"$result" "$num_cpus" "get_max_cpuid_from_sysfs - cpu set: '${current_cpus[*]}', expected: '$num_cpus', result: '$result'"
47 if [ "$URCU_TESTS_OS_TYPE" == "linux" ]; then
50 diag
"get_max_cpuid_from_sysfs"
53 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
55 test_data
=(1 "cpu0" "cpu1")
56 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
58 test_data
=(1 "cpu1" "cpu0")
59 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
62 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
64 test_data
=(99 "cpu99")
65 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
67 test_data
=(3 "cpu0" "cpu3")
68 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
70 test_data
=(3 "cpufreq" "cpuidle" "cpu0" "cpu1" "cpu2" "cpu3")
71 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
73 test_data
=(0 "cpu" "cpu0")
74 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
76 test_data
=(5 "cpu" "cpu5")
77 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
81 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
84 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
86 test_data
=(-1 "cpua" "cpud")
87 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
89 test_data
=(-1 "cpufreq" "cpuidle")
90 test_get_max_cpuid_from_sysfs
"${test_data[@]}"
92 plan_skip_all
"Linux specific tests."