Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3254919rdb; Sat, 9 Dec 2023 20:05:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzWxP/nRakT3EL3qgbntHz2iTaJVE2cL0LpTBo5BqjVkmVYo4L+Zc5RwXnwObcJeNyeEi0 X-Received: by 2002:a05:6359:608c:b0:170:17eb:9c40 with SMTP id ry12-20020a056359608c00b0017017eb9c40mr2400301rwb.33.1702181151031; Sat, 09 Dec 2023 20:05:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702181150; cv=none; d=google.com; s=arc-20160816; b=F0aV02pBxgNMNppj3y5mOKEGkdVbaUyiWtIMDfSv7pCf14lvVqJ9MpAPknwnw+YDNg Kdi8uToWcdV+TJVrJQddXXgZ9SbkNxmOIU72Z18uSXiY+K0JHEOqnWs9gKzqhqtGYGg/ RIsXMkuQRYlTuXU6LN7uzUDvs78PbOggZp8TnkTvnu1Rcx7IjdT+5UhAsB2FUfYUx2rA vFfAcL0YwaP4LrbIZmQRuF0mGuKdJmJOWxGAfOSODUOFlH3Zo0OMdXD1shx5NfBBDg+M 11oeNcI1dAeuTWLYnZRrxxP8MFZR5k5cNK25GPcXFAJOrPhNgn7CRZHTZRpaqobKMjPw TW+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:subject:cc:to:from:date :user-agent:message-id; bh=LL+M6cFVrFxl6tvP0L/d8dotBikTYSybMvyiJ88/0uw=; fh=pL1t9p0RxD5qCgSUniSa3P4+XmpksJYPzX6TE+dndao=; b=UuM997Mg415Iz7pn2B1HRniqDmloBhf8UY8tC9uiyvoxW+JGuOqUuBdHipW1niRYnK B+21+8BbFZen4j/UqYwLPX24BQU5N5uGsg2uEDIS/YYF0e7aj6MyAYLWT2E5Lbde8N6M IbQqVA0nqBxuLKXmoimESRZ4pnmYBx6vYuAA4TaniUKzACSxd62+NCwXn+0w72q/tFSV DhF6dWHUR3VihyvAUORaXjrIvq6p5BheAXnCrgc9TbkiFiATxaWc72ZYg8WIuLSBPWLa FsEG9/dCV73/j4GSeL25rxk9/CkKeM6QH/3ptAb0g4pt5LS7jN3Ioewtw78p4XHDuA8B VXxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x3-20020a170902ea8300b001d07490028bsi4015367plb.178.2023.12.09.20.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 20:05:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 85C0F8067B61; Sat, 9 Dec 2023 20:05:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231978AbjLJEFH (ORCPT + 99 others); Sat, 9 Dec 2023 23:05:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231512AbjLJEEI (ORCPT ); Sat, 9 Dec 2023 23:04:08 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8900310E for ; Sat, 9 Dec 2023 20:04:15 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C84EC433C9; Sun, 10 Dec 2023 04:04:15 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1rCB3k-000000021SI-24ci; Sat, 09 Dec 2023 23:04:52 -0500 Message-ID: <20231210040452.274868572@goodmis.org> User-Agent: quilt/0.67 Date: Sat, 09 Dec 2023 22:54:18 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tzvetomir Stoyanov , Vincent Donnefort , Kent Overstreet Subject: [PATCH 14/14] ringbuffer/selftest: Add basic selftest to test chaning subbuf order References: <20231210035404.053677508@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sat, 09 Dec 2023 20:05:46 -0800 (PST) From: "Steven Rostedt (Google)" Add a self test that will write into the trace buffer with differ trace sub buffer order sizes. Signed-off-by: Steven Rostedt (Google) --- .../ftrace/test.d/00basic/ringbuffer_order.tc | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc diff --git a/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc b/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc new file mode 100644 index 000000000000..c0d76dc724d3 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/00basic/ringbuffer_order.tc @@ -0,0 +1,46 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Change the ringbuffer size +# requires: buffer_subbuf_order +# flags: instance + +get_buffer_data_size() { + sed -ne 's/^.*data.*size:\([0-9][0-9]*\).*/\1/p' events/header_page +} + +a="1234567890" + +make_str() { + cnt=$1 + s="" + while [ $cnt -gt 10 ]; do + s="${s}${a}" + cnt=$((cnt-10)) + done + while [ $cnt -gt 0 ]; do + s="${s}X" + cnt=$((cnt-1)) + done + echo -n $s +} + +test_buffer() { + + size=`get_buffer_data_size` + + str=`make_str $size` + + echo $str > trace_marker + + grep -q $a trace +} + +ORIG=`cat buffer_subbuf_order` + +for a in `seq 0 4`; do + echo 0 > buffer_subbuf_order + test_buffer +done + +echo $ORIG > buffer_subbuf_order + -- 2.42.0