xref: /linux/tools/testing/selftests/ftrace/test.d/remotes/unloading.tc (revision 5ea5880764cbb164afb17a62e76ca75dc371409d)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Test trace remote unloading
4# requires: remotes/test
5
6. $TEST_DIR/remotes/functions
7
8test_unloading()
9{
10    # No reader, writing
11    assert_loaded
12
13    # No reader, no writing
14    echo 0 > tracing_on
15    assert_unloaded
16
17    # 1 reader, no writing
18    cat trace_pipe &
19    pid=$!
20    sleep 1
21    assert_loaded
22    kill $pid
23    assert_unloaded
24
25    # No reader, no writing, events
26    echo 1 > tracing_on
27    echo 1 > write_event
28    echo 0 > tracing_on
29    assert_loaded
30
31    # Test reset
32    clear_trace
33    assert_unloaded
34}
35
36if [ -z "$SOURCE_REMOTE_TEST" ]; then
37    set -e
38
39    setup_remote_test
40    test_unloading
41fi
42