summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/ftrace/test.d/remotes/unloading.tc
blob: cac2190183f64b3e05993a0bf77eca62b4090a97 (plain) (blame)
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
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Test trace remote unloading
# requires: remotes/test

. $TEST_DIR/remotes/functions

test_unloading()
{
    # No reader, writing
    assert_loaded

    # No reader, no writing
    echo 0 > tracing_on
    assert_unloaded

    # 1 reader, no writing
    cat trace_pipe &
    pid=$!
    sleep 1
    assert_loaded
    kill $pid
    assert_unloaded

    # No reader, no writing, events
    echo 1 > tracing_on
    echo 1 > write_event
    echo 0 > tracing_on
    assert_loaded

    # Test reset
    clear_trace
    assert_unloaded
}

if [ -z "$SOURCE_REMOTE_TEST" ]; then
    set -e

    setup_remote_test
    test_unloading
fi