From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA074CA27E for ; Tue, 21 Jul 2026 10:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784630192; cv=none; b=JzlJNwMU8wEX8lv5jAf1eF1oQFOzKv4jQrQSjp2cnt0Mh3ZOZoFu/QRPim6D67sp6QPzVJOY/VwPoI06SOFx36ZhjO8cQ7czBXUb10U9TwmDhjpa+4h46n4mG3c+H5UQA+GvfAts3PjFcH9QOJvp2IexASxxf8yv+ItTR3n8FUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784630192; c=relaxed/simple; bh=zwjhhRwEKrUVba7K5Vs5akPhk3ruFuPU2zVzf6EQLmU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=s1Ksg9KLA31/TRPslCaNOPYJ979YmvFiRb8EObNKJU5Ozqh2FTRCZg3zV26QAjkxLCw5GYdMpSg7J3kX5VJmBSyBdoOMWRPh7XJ1881TfnVBA1URu8P/B8zbPPqyNPGVpUJia0sCzSTOA/cKVKQGdMGygqmESFd5RZSpLAcJ+SI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rAmj2g1r; arc=none smtp.client-ip=209.85.128.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vdonnefort.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rAmj2g1r" Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49544a639e9so28162765e9.1 for ; Tue, 21 Jul 2026 03:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1784630188; x=1785234988; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=KFnRJSdtq0pC7EluIdIyn7oqOdGIzUl0l3gz+9na5tk=; b=rAmj2g1rHMngFPlLT1nx3wV2BBXICXzhu3E1GwVMgPIsWpCqJgEE1yAwx9swcUUr4I rABZ/YZrZDtIWMPkSuMhSEF81o5vXuMkBqTx/V69pmtcgLE7hzZUOdrJjXJ3Sl1LR9KL BElbQfacWDazaPn8h7p5kCaOhvDnSJelZX4xO1Y63Dd98T5XJuYkTkSHlgS7zr9j0ufZ XFX4514X2FGFg9hEm5ijcKluChPajd8fFVRlooj25Wsafpt4risxmpQEii4JHNwGQfF5 04jTE+WVr2XRBU5kby+BT6hKrxP/f4HnBrwBON0XfWB1zT90SJ1tX9+EunFibuDgF0d/ SSeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784630188; x=1785234988; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=KFnRJSdtq0pC7EluIdIyn7oqOdGIzUl0l3gz+9na5tk=; b=Y3IB6CmED5byRz8SyJCeyujbPVFMuELJGTXgRNMIs1kt285UVJZZAwoR4iZecu/1eL HApFGmmlMdBTRYR50OJnvNIsY0XnEAOhs8R1EuS8o0EGBZujhIchIeBHP6pIxVNMuQEQ Sq4/jzdRiBpQxRuYiY5ni+HbESspx9nD0cULp2EmFVhrGWx1zNR3Hr+hKWOAq5/pLjSX KRlrvkWCprCsZ5AkSqfnqmj7LPmEAyXq/P1Eb676qt7UF8RXt1YlNtiS5ZwFyVhEuh+u R1cUwUmN6kmNkzN3K5VSIx9wMrCxJuZ3Z4Wi8Y6HsTVY6jQt6c3r2M5hGw6kOL3R7mg/ ECXg== X-Forwarded-Encrypted: i=1; AHgh+Rp93OMfdS2bObLfNb8/hnwS++IbULEVO82c7QVkFkab6kSuPQ14Kj1NoEEMgMJtPISu5uDGvyQyxcTztbU=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8ABIqNsi3lNzfqwjDoAGGOHm9PC+nrd7wCO3Ox68Xb9VoXIJM p/VIk8XiBfls6YiaMneiq7m6DEOCQ5QECsttM3Ibn5UdvLW+R9Lo8jQs1K7YYtzv57yQk3v1P+C SBxRQGwYnensdJ2+xGEs6OA== X-Received: from wrbdh11.prod.google.com ([2002:a05:6000:a8b:b0:46d:7673:77d9]) (user=vdonnefort job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3553:b0:495:3f28:3f19 with SMTP id 5b1f17b1804b1-4954a508a24mr202524045e9.37.1784630188199; Tue, 21 Jul 2026 03:36:28 -0700 (PDT) Date: Tue, 21 Jul 2026 11:35:52 +0100 In-Reply-To: <20260721103603.342266-1-vdonnefort@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260721103603.342266-1-vdonnefort@google.com> X-Mailer: git-send-email 2.55.0.229.g6434b31f56-goog Message-ID: <20260721103603.342266-8-vdonnefort@google.com> Subject: [PATCH v3 07/18] tracing/remotes: selftests: Add a test for the dmesg tracefs file From: Vincent Donnefort To: rostedt@goodmis.org, mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org Cc: mathieu.desnoyers@efficios.com, kernel-team@android.com, linux-kernel@vger.kernel.org, Vincent Donnefort Content-Type: text/plain; charset="UTF-8" Exercise the newly introduced dmesg tracefs file that turns on and off the dmesg redirection. Signed-off-by: Vincent Donnefort diff --git a/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc b/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc new file mode 100644 index 000000000000..aebeea9dbab6 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc @@ -0,0 +1,72 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Test trace remote dmesg redirection +# requires: remotes/test + +. $TEST_DIR/remotes/functions + +test_dmesg() +{ + echo 0 > tracing_on + assert_unloaded + + # + # Test dmesg on/off when tracing is disabled + # + echo 1 > dmesg + test $(cat dmesg) -eq 1 + assert_loaded + + echo 0 > dmesg + test $(cat dmesg) -eq 0 + assert_unloaded + + # + # Test events are logged to dmesg + # + dmesg -c > /dev/null + + echo 1 > tracing_on + assert_loaded + echo 1 > dmesg + test $(cat dmesg) -eq 1 + + nr_events=128 + for i in $(seq 1 $nr_events); do + echo $i > write_event + done + + sleep 1 + output=$(mktemp $TMPDIR/remote_test.XXXXXX) + dmesg | grep "selftest id=" | sed 's/^[^]]*] //'> $output + + check_trace 1 $nr_events $output + + rm $output + + # + # Disable dmesg and Test events were not consumed by dmesg + # + echo 0 > dmesg + test $(cat dmesg) -eq 0 + + start_id=$(($nr_events + 1)) + end_id=$(($start_id + $nr_events)) + + for i in $(seq $start_id $end_id); do + echo $i > write_event + done + + sleep 1 + + output=$(dump_trace_pipe) + check_trace $start_id $end_id $output + rm $output +} + +if [ -z "$SOURCE_REMOTE_TEST" ]; then + set -e + + setup_remote_test + test_dmesg +fi diff --git a/tools/testing/selftests/ftrace/test.d/remotes/functions b/tools/testing/selftests/ftrace/test.d/remotes/functions index 05224fac3653..4a14aa72fdf0 100644 --- a/tools/testing/selftests/ftrace/test.d/remotes/functions +++ b/tools/testing/selftests/ftrace/test.d/remotes/functions @@ -8,6 +8,7 @@ setup_remote() cd remotes/$name/ echo 0 > tracing_on + echo 0 > dmesg clear_trace echo 7 > buffer_size_kb echo 0 > events/enable diff --git a/tools/testing/selftests/ftrace/test.d/remotes/hypervisor/dmesg.tc b/tools/testing/selftests/ftrace/test.d/remotes/hypervisor/dmesg.tc new file mode 100644 index 000000000000..bf4a3c145e7a --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/remotes/hypervisor/dmesg.tc @@ -0,0 +1,11 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Test the hypervisor trace dmesg redirection +# requires: remotes/hypervisor/write_event + +SOURCE_REMOTE_TEST=1 +. $TEST_DIR/remotes/dmesg.tc + +set -e +setup_remote "hypervisor" +test_dmesg -- 2.55.0.229.g6434b31f56-goog