blob: 4d176349b2bcd75fcfd4cb3050029efb0c3670e8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Test trace remote reset
# requires: remotes/test
. $TEST_DIR/remotes/functions
check_reset()
{
write_event_path="write_event"
taskset=""
clear_trace
# Is the buffer empty?
output=$(dump_trace_pipe)
test $(wc -l $output | cut -d ' ' -f1) -eq 0
if $(echo $(pwd) | grep -q "per_cpu/cpu"); then
write_event_path="../../write_event"
cpu_id=$(echo $(pwd) | sed -e 's/.*per_cpu\/cpu//')
taskset="taskset -c $cpu_id"
fi
rm $output
# Can we properly write a new event?
$taskset echo 7890 > $write_event_path
output=$(dump_trace_pipe)
test $(wc -l $output | cut -d ' ' -f1) -eq 1
grep -q "id=7890" $output
rm $output
}
test_global_interface()
{
output=$(mktemp $TMPDIR/remote_test.XXXXXX)
# Confidence check
echo 123456 > write_event
output=$(dump_trace_pipe)
grep -q "id=123456" $output
rm $output
# Reset single event
echo 1 > write_event
check_reset
# Reset lost events
for i in $(seq 1 10000); do
echo 1 > write_event
done
check_reset
}
test_percpu_interface()
{
[ "$(get_cpu_ids | wc -l)" -ge 2 ] || return 0
for cpu in $(get_cpu_ids); do
taskset -c $cpu echo 1 > write_event
done
check_non_empty=0
for cpu in $(get_cpu_ids); do
cd per_cpu/cpu$cpu/
if [ $check_non_empty -eq 0 ]; then
check_reset
check_non_empty=1
else
# Check we have only reset 1 CPU
output=$(dump_trace_pipe)
test $(wc -l $output | cut -d ' ' -f1) -eq 1
rm $output
fi
cd -
done
}
test_reset()
{
test_global_interface
test_percpu_interface
}
if [ -z "$SOURCE_REMOTE_TEST" ]; then
set -e
setup_remote_test
test_reset
fi
|