summaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/shell/perf_sched_stats.sh
blob: 2b1410b050d04737fb3c2cc15c244aed9e7f27a3 (plain)
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
#!/bin/sh
# perf sched stats tests
# SPDX-License-Identifier: GPL-2.0

set -e

err=0
test_perf_sched_stats_record() {
  echo "Basic perf sched stats record test"
  if ! perf sched stats record true 2>&1 | \
    grep -E -q "[ perf sched stats: Wrote samples to perf.data ]"
  then
    echo "Basic perf sched stats record test [Failed]"
    err=1
    return
  fi
  echo "Basic perf sched stats record test [Success]"
}

test_perf_sched_stats_report() {
  echo "Basic perf sched stats report test"
  perf sched stats record true > /dev/null
  if ! perf sched stats report 2>&1 | grep -E -q "Description"
  then
    echo "Basic perf sched stats report test [Failed]"
    err=1
    rm perf.data
    return
  fi
  rm perf.data
  echo "Basic perf sched stats report test [Success]"
}

test_perf_sched_stats_live() {
  echo "Basic perf sched stats live mode test"
  if ! perf sched stats true 2>&1 | grep -E -q "Description"
  then
    echo "Basic perf sched stats live mode test [Failed]"
    err=1
    return
  fi
  echo "Basic perf sched stats live mode test [Success]"
}

test_perf_sched_stats_diff() {
  echo "Basic perf sched stats diff test"
  perf sched stats record true > /dev/null
  perf sched stats record true > /dev/null
  if ! perf sched stats diff > /dev/null
  then
    echo "Basic perf sched stats diff test [Failed]"
    err=1
    rm perf.data.old perf.data
    return
  fi
  rm perf.data.old perf.data
  echo "Basic perf sched stats diff test [Success]"
}

test_perf_sched_stats_record
test_perf_sched_stats_report
test_perf_sched_stats_live
test_perf_sched_stats_diff
exit $err