Skip to content

Commit

Permalink
selftests/ftrace: Use loopback address instead of localhost
Browse files Browse the repository at this point in the history
Use raw loopback address instead of localhost, because
"localhost" can depend on nsswitch and in some case
we can not resolve the localhost.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
  • Loading branch information
Masami Hiramatsu authored and Shuah Khan (Samsung OSG) committed Oct 24, 2018
1 parent 72ce3da commit cec3adf
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 25 deletions.
4 changes: 0 additions & 4 deletions tools/testing/selftests/ftrace/test.d/event/event-enable.tc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ fail() { #msg
exit_fail
}

yield() {
ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
}

if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
Expand Down
4 changes: 0 additions & 4 deletions tools/testing/selftests/ftrace/test.d/event/event-pid.tc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ fail() { #msg
exit_fail
}

yield() {
ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
}

if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ fail() { #msg
exit_fail
}

yield() {
ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
}

if [ ! -f set_event -o ! -d events/sched ]; then
echo "event tracing is not supported"
exit_unsupported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ fail() { #msg
exit_fail
}

yield() {
ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
}

if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then
echo "event tracing is not supported"
exit_unsupported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ fail() { # msg
exit_fail
}

yield() {
ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
}

do_test() {
disable_tracing

Expand Down
6 changes: 6 additions & 0 deletions tools/testing/selftests/ftrace/test.d/functions
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,9 @@ initialize_ftrace() { # Reset ftrace to initial-state
clear_trace
enable_tracing
}

LOCALHOST=127.0.0.1

yield() {
ping $LOCALHOST -c 1 || sleep .001 || usleep 1 || sleep 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo 'hist:keys=comm:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/
echo 'hist:keys=next_comm:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger
echo 'hist:keys=pid,prio,comm:vals=lat:sort=pid,prio' > events/synthetic/wakeup_latency/trigger

ping localhost -c 3
ping $LOCALHOST -c 3
if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
fail "Failed to create inter-event histogram"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ echo 'waking+wakeup_latency u64 lat; pid_t pid' >> synthetic_events
echo 'hist:keys=pid,lat:sort=pid,lat:ww_lat=$waking_lat+$wakeup_lat:onmatch(synthetic.wakeup_latency).waking+wakeup_latency($ww_lat,pid)' >> events/synthetic/wakeup_latency/trigger
echo 'hist:keys=pid,lat:sort=pid,lat' >> events/synthetic/waking+wakeup_latency/trigger

ping localhost -c 3
ping $LOCALHOST -c 3
if ! grep -q "pid:" events/synthetic/waking+wakeup_latency/hist; then
fail "Failed to create combined histogram"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ echo "Test histogram variables,simple expression support and onmatch action"
echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger
echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > events/synthetic/wakeup_latency/trigger
ping localhost -c 5

ping $LOCALHOST -c 5
if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
fail "Failed to create onmatch action inter-event histogram"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ echo "Test histogram variables,simple expression support and onmatch-onmax actio
echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid,next_comm):onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > events/synthetic/wakeup_latency/trigger
ping localhost -c 5

ping $LOCALHOST -c 5
if [ ! grep -q "ping" events/synthetic/wakeup_latency/hist -o ! grep -q "max:" events/sched/sched_switch/hist]; then
fail "Failed to create onmatch-onmax action inter-event histogram"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ echo "Test onmax action"

echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_waking/trigger
echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
ping localhost -c 3

ping $LOCALHOST -c 3
if ! grep -q "max:" events/sched/sched_switch/hist; then
fail "Failed to create onmax action inter-event histogram"
fi
Expand Down

0 comments on commit cec3adf

Please sign in to comment.