tools/testing/selftests/ftrace/test.d/remotes/trace.tc

Source file repositories/reference/linux-study-clean/tools/testing/selftests/ftrace/test.d/remotes/trace.tc

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/ftrace/test.d/remotes/trace.tc
Extension
.tc
Size
1931 bytes
Lines
103
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Test trace remote non-consuming read
# requires: remotes/test

. $TEST_DIR/remotes/functions

test_trace()
{
	echo 0 > tracing_on
    assert_unloaded

    echo 7 > buffer_size_kb
    echo 1 > tracing_on
    assert_loaded

    # Simple test: Emit few events and try to read them
    for i in $(seq 1 8); do
        echo $i > write_event
    done

    check_trace 1 8 trace

    #
    # Test interaction with consuming read
    #

    cat trace_pipe > /dev/null &
    pid=$!

    sleep 1
    kill $pid

    test $(wc -l < trace) -eq 0

    for i in $(seq 16 32); do
        echo $i > write_event
    done

    check_trace 16 32 trace

    #
    # Test interaction with reset
    #

    echo 0 > trace

    test $(wc -l < trace) -eq 0

    for i in $(seq 1 8); do
        echo $i > write_event
    done

    check_trace 1 8 trace

    #
    # Test interaction with lost events
    #

    # Ensure the writer is not on the reader page by reloading the buffer
    reload_remote

    # Ensure ring-buffer overflow by emitting events from the same CPU
    for cpu in $(get_cpu_ids); do
        break
    done

    events_per_page=$(($(get_page_size) / $(get_selftest_event_size))) # Approx: does not take TS into account
    nr_events=$(($events_per_page * 2))
    for i in $(seq 1 $nr_events); do

Annotation

Implementation Notes