xref: /linux/tools/testing/selftests/ftrace/test.d/00basic/snapshot.tc (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
182f4f3e6SMasami Hiramatsu#!/bin/sh
282f4f3e6SMasami Hiramatsu# description: Snapshot and tracing setting
3*3591e90fSMasami Hiramatsu# requires: snapshot
482f4f3e6SMasami Hiramatsu# flags: instance
582f4f3e6SMasami Hiramatsu
682f4f3e6SMasami Hiramatsuecho "Set tracing off"
782f4f3e6SMasami Hiramatsuecho 0 > tracing_on
882f4f3e6SMasami Hiramatsu
982f4f3e6SMasami Hiramatsuecho "Allocate and take a snapshot"
1082f4f3e6SMasami Hiramatsuecho 1 > snapshot
1182f4f3e6SMasami Hiramatsu
1282f4f3e6SMasami Hiramatsu# Since trace buffer is empty, snapshot is also empty, but allocated
1382f4f3e6SMasami Hiramatsugrep -q "Snapshot is allocated" snapshot
1482f4f3e6SMasami Hiramatsu
1582f4f3e6SMasami Hiramatsuecho "Ensure keep tracing off"
1682f4f3e6SMasami Hiramatsutest `cat tracing_on` -eq 0
1782f4f3e6SMasami Hiramatsu
1882f4f3e6SMasami Hiramatsuecho "Set tracing on"
1982f4f3e6SMasami Hiramatsuecho 1 > tracing_on
2082f4f3e6SMasami Hiramatsu
2182f4f3e6SMasami Hiramatsuecho "Take a snapshot again"
2282f4f3e6SMasami Hiramatsuecho 1 > snapshot
2382f4f3e6SMasami Hiramatsu
2482f4f3e6SMasami Hiramatsuecho "Ensure keep tracing on"
2582f4f3e6SMasami Hiramatsutest `cat tracing_on` -eq 1
2682f4f3e6SMasami Hiramatsu
2782f4f3e6SMasami Hiramatsuexit 0
28