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_cxx
() {
38 local current_cpus
=("$@")
41 populate_testdir
"${current_cpus[@]}" >"$STD_OUTPUT" 2>"$STD_ERROR"
42 result
=$
("${CURDIR}/get_max_cpuid_from_sysfs_cxx" "$TESTDIR")
43 is
"$result" "$num_cpus" "get_max_cpuid_from_sysfs_cxx - cpu set: '${current_cpus[*]}', expected: '$num_cpus', result: '$result'"
49 diag
"get_max_cpuid_from_sysfs_cxx"
52 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
54 test_data
=(1 "cpu0" "cpu1")
55 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
57 test_data
=(1 "cpu1" "cpu0")
58 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
61 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
63 test_data
=(99 "cpu99")
64 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
66 test_data
=(3 "cpu0" "cpu3")
67 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
69 test_data
=(3 "cpufreq" "cpuidle" "cpu0" "cpu1" "cpu2" "cpu3")
70 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
72 test_data
=(0 "cpu" "cpu0")
73 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
75 test_data
=(5 "cpu" "cpu5")
76 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
80 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
83 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
85 test_data
=(-1 "cpua" "cpud")
86 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"
88 test_data
=(-1 "cpufreq" "cpuidle")
89 test_get_max_cpuid_from_sysfs_cxx
"${test_data[@]}"