hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#! @testdir@/xeno-test-run
 
usage()
{
    cat <<EOF
xeno-test -h or xeno-test --help
 
This help text.
 
 
xeno-test [ -l "load command" ] [ -k ] [ -r ] [ -- ] [ latency test options ]
 
Run a basic test/benchmark of Xenomai on your platform, by first starting a
few unit tests, then running the latency test under the load generated by
"load-command".
 
By default, the load command is "dohell 900", which will generate load during
15 minutes. To generate a more realistic load see dohell help.
 
This script accepts the -k option to tell the unit test loop to keep
going upon a failing test. Otherwise xeno-test stops immediately.
 
If the script is passed the -r option, real-time stress is added to the test,
with the help of the "switchtest" test. But beware: the latency test figures are
then no longer meaningful.
 
For running test in a virtual machine use the --vm option. This option relaxes
some of the timing thresholds.
 
Any other option passed on the command line is passed to the latency test.
 
Example:
xeno-test -l "dohell -s 192.168.0.5 -m /mnt -l /ltp" -t 2
 
Will generate load including network load using the server at IP address
192.168.0.5, some I/O under the moint point /mnt, and the LTP testsuite
installed under the /ltp directory, and use the latency test by measuring the
timer irq latency.
EOF
}
 
start_timesyncd()
{
    if $timesyncd_was_running; then
        systemctl start systemd-timesyncd
        timesyncd_was_running=false
    fi
}
trap start_timesyncd EXIT
 
keep_going=
run_on_vm=
rt_load=false
timesyncd_was_running=false
 
while :; do
    case "$1" in
   -h|--help)
       usage
       exit 0
       ;;
 
   -k)
       keep_going=--keep-going
       shift
       ;;
 
   --vm)
       run_on_vm=--vm
       shift
       ;;
 
   -r)
       rt_load=true
       shift
       ;;
 
   --)
       shift
       break
       ;;
 
   ""|*)
       break
       ;;
    esac
done
 
set -ex
 
echo 0 > /proc/xenomai/latency || :
 
testdir=@testdir@
 
if which systemctl > /dev/null && systemctl is-active --quiet systemd-timesyncd; then
    timesyncd_was_running=true
    systemctl stop systemd-timesyncd
fi
 
$testdir/smokey --run $run_on_vm $keep_going random_alloc_rounds=64 pattern_check_rounds=64
 
start_timesyncd
 
$testdir/clocktest -D -T 30 -C CLOCK_HOST_REALTIME || $testdir/clocktest -T 30
$testdir/switchtest -T 30
 
start_load
 
if $rt_load; then
    check_alive $testdir/switchtest
    check_alive $testdir/switchtest -s 1000
fi
 
check_alive $testdir/latency ${1+"$@"}
 
wait_load