Lines Matching +full:cpu +full:- +full:2
2 # SPDX-License-Identifier: GPL-2.0
4 # A test that makes sure that sysdata runtime CPU data is properly set
7 # There are 3 different tests, every time sent using a random CPU.
8 # - Test #1
10 # - Test #2
12 # - Test #3
17 set -euo pipefail
19 SCRIPTDIR=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")")
25 if [[ ! -f "${NETCONS_PATH}/userdata/cpu_nr_enabled" ]]
27 echo "Populate CPU configfs path not available in ${NETCONS_PATH}/userdata/cpu_nr_enabled" >&2
36 if [[ ! -f "${NETCONS_PATH}/userdata/taskname_enabled" ]]
38 …e taskname sysdata append. Configfs not available in ${NETCONS_PATH}/userdata/taskname_enabled" >&2
47 if [[ ! -f "${NETCONS_PATH}/userdata/release_enabled" ]]
49 …ble release sysdata append. Configfs not available in ${NETCONS_PATH}/userdata/release_enabled" >&2
58 if [[ ! -f "${NETCONS_PATH}/userdata/msgid_enabled" ]]
60 … enable msgid sysdata append. Configfs not available in ${NETCONS_PATH}/userdata/msgid_enabled" >&2
88 # 6.11.1-0_fbk0_rc13_509_g30d75cea12f7,13,1822,115075213798,-;netconsole selftest: netcons_gtJHM
90 # cpu=X
98 if [ ! -f "$OUTPUT_FILE" ]; then
99 echo "FAIL: File was not generated." >&2
103 if ! grep -q "${MSG}" "${OUTPUT_FILE}"; then
104 echo "FAIL: ${MSG} not found in ${OUTPUT_FILE}" >&2
105 cat "${OUTPUT_FILE}" >&2
109 # Check if cpu=XX exists in the file and matches the one used
111 if ! grep -q "cpu=${CPU}\+" "${OUTPUT_FILE}"; then
112 echo "FAIL: 'cpu=${CPU}' not found in ${OUTPUT_FILE}" >&2
113 cat "${OUTPUT_FILE}" >&2
117 if ! grep -q "taskname=${SENDER}" "${OUTPUT_FILE}"; then
118 echo "FAIL: 'taskname=echo' not found in ${OUTPUT_FILE}" >&2
119 cat "${OUTPUT_FILE}" >&2
123 if ! grep -q "msgid=[0-9]\+$" "${OUTPUT_FILE}"; then
124 echo "FAIL: 'msgid=<id>' not found in ${OUTPUT_FILE}" >&2
125 cat "${OUTPUT_FILE}" >&2
134 RELEASE=$(uname -r)
136 if [ ! -f "$OUTPUT_FILE" ]; then
137 echo "FAIL: File was not generated." >&2
141 if ! grep -q "release=${RELEASE}" "${OUTPUT_FILE}"; then
142 echo "FAIL: 'release=${RELEASE}' not found in ${OUTPUT_FILE}" >&2
143 cat "${OUTPUT_FILE}" >&2
148 # Test if MSG content exists in OUTPUT_FILE but no `cpu=` and `taskname=`
151 if [ ! -f "$OUTPUT_FILE" ]; then
152 echo "FAIL: File was not generated." >&2
156 if ! grep -q "${MSG}" "${OUTPUT_FILE}"; then
157 echo "FAIL: ${MSG} not found in ${OUTPUT_FILE}" >&2
158 cat "${OUTPUT_FILE}" >&2
162 if grep -q "cpu=" "${OUTPUT_FILE}"; then
163 echo "FAIL: 'cpu= found in ${OUTPUT_FILE}" >&2
164 cat "${OUTPUT_FILE}" >&2
168 if grep -q "taskname=" "${OUTPUT_FILE}"; then
169 echo "FAIL: 'taskname= found in ${OUTPUT_FILE}" >&2
170 cat "${OUTPUT_FILE}" >&2
174 if grep -q "release=" "${OUTPUT_FILE}"; then
175 echo "FAIL: 'release= found in ${OUTPUT_FILE}" >&2
176 cat "${OUTPUT_FILE}" >&2
180 if grep -q "msgid=" "${OUTPUT_FILE}"; then
181 echo "FAIL: 'msgid= found in ${OUTPUT_FILE}" >&2
182 cat "${OUTPUT_FILE}" >&2
198 taskset -c "${CPU}" echo "${MSG}: ${TARGET}" > /dev/kmsg
200 busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}"
207 modprobe netdevsim 2> /dev/null || true
208 modprobe netconsole 2> /dev/null || true
226 # Send message from a random CPU
228 # Random CPU in the system
229 CPU=$((RANDOM % $(nproc)))
231 MSG="Test #1 from CPU${CPU}"
245 # TEST #2
248 # Get a new random CPU
249 CPU=$((RANDOM % $(nproc)))
251 MSG="Test #2 from CPU${CPU}"
261 CPU=$((RANDOM % $(nproc)))
263 MSG="Test #3 from CPU${CPU}"
269 # At this time, cpu= shouldn't be present in the msg