From patchwork Sat Feb 10 23:50:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Bartosik?= X-Patchwork-Id: 199352 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1704850dyd; Sat, 10 Feb 2024 16:06:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWlnI6SEM9K2yYNRgwwjwbta0CF9WGKJmXUOfpzQbHiZBGKwxcCQ0NAmX26uKZqN8miPPTsSv4xP3hI4nPsee9qIiw+ng== X-Google-Smtp-Source: AGHT+IF+kkEo+X9GuB6zHx97iGy7TeruxgMcQ8ZUxoW3BfO6nChoGrRFgSNwHuB2+Krw14hhq5NW X-Received: by 2002:aa7:d584:0:b0:560:5e65:c0cc with SMTP id r4-20020aa7d584000000b005605e65c0ccmr2013131edq.11.1707609977526; Sat, 10 Feb 2024 16:06:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707609977; cv=pass; d=google.com; s=arc-20160816; b=nSBBN1VKX2+WdpvWUpdg6QbhsVjjWXtl7UCE50bR/HCdCSx74hWNI379eMEd+tbl0X 5oi8QV/LNe8UDslysnkkv6g6aU0EQMJFDo+gllgN5C+5Y3fYN5RIn3O9xRFrZOlqw+Zt W5d/nzreS9uoy4VGk9s+/+N0V8uhhG0voScG2d0xCZLvUlW6tYtFFypN3EVAUEEldN3M ItEsTPEpz7PNUic6q03Sg4YQJ49Z9mtVnZy32rz3S3NQmu8nPDTFpeMJ2BCXtbOlF/GC /O+qklyk8rYSKLzXHSpjztwn5J6t303+xJQQs8lDYRRtOKx5syZYRVgkb91u+uXxw1kC gyWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=HHV7suuu0MQVPrlCL4QBuTUyH7QVgFtZQstutgzVcQw=; fh=G7cC4QdCdLW5655kTQgLm+zETlrqnf59zV4NDMiLFQk=; b=JRGGQhNbRd+twBapgiMJ9xRvH5x5eHDROteEhIB1+wBNhS9NcfqhNaE8UFwghWHZ9Z qOO+041svhjyuNGlDwSwxi+Gw1jGLc224JfBwChLWKr53IWsajQwPSgHrW9+wccLJO9i aEHXFAjiq++3dUmaQlbCpoXcvHD2nsVel7VyXFhTcXgR4cJE1JidSlXes9ysAFxKGR0J JngHXdfqEDKNag1bgJUN1WKGv+xqLm4l4+e8pLdvwGT80/m5SnElzWh4y1c/xcyiPEd7 S9JJIYROhCGL00DkIQtSlh4ORVnSczCRnDMxUELpQlQGHhTICBjHBVb1aH9LMOPoY297 /HUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OrY7vkPI; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60618-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60618-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCX6vyLKngeC0uqGHpgfqyRvunwwm1WuwJqzq1CXoErsThjhZXZjtT0tg6QXb0/VUyFnSWcWLTuoEks8ZwMkErfdIIraDQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cq24-20020a056402221800b0055a83daf80bsi1199524edb.665.2024.02.10.16.06.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 16:06:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60618-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OrY7vkPI; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60618-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60618-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A77151F28BD0 for ; Sat, 10 Feb 2024 23:59:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2938D61674; Sat, 10 Feb 2024 23:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="OrY7vkPI" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 CC8595FF1D for ; Sat, 10 Feb 2024 23:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707609091; cv=none; b=FFlGdgwa8npbhnxtMCkrYr/DVDW+qN1QTeSZ8+CP9CHCM33iEL1xTYXkRmo/zx9TkVGsffda5ZHb22SEHLv04hE08/119CrW2hlkMiPcg9sZB8lBJpz0jw3yCTcSldWtHyVjCtIih4kzFkJG5nqVXS5So1pZCKrLQcc4j4pNfbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707609091; c=relaxed/simple; bh=1+xODvvWPgW5Ey947YSOiV5Ka4qflMD9dB/LgxDIO4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RL1AZ5/dkBrKzz876r3FYEx+4y/wP+XgKJQZabJDnM3QPNNEm2K0EuKFGeUb37h9mSTCf6PkP5Vz0gYUkA7lUA1jfzIiaEvs6+C+zLU8VVgY5SPhhBIMXsIXBwkdhPz8lnrkOR5BQWtPxXaZCApSLXZNj1rEp7v+5KRL3gc3YXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=OrY7vkPI; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d0ed7cbd76so5745611fa.1 for ; Sat, 10 Feb 2024 15:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707609088; x=1708213888; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HHV7suuu0MQVPrlCL4QBuTUyH7QVgFtZQstutgzVcQw=; b=OrY7vkPIcbR800yeHVwwf2DWeMWm9OUYTOi5oYfrCbTAojuSH7/ZCZkpXnhATslqRb TACahH0GAgwnGrxGU8hB+3EQiAj0keEdBFBtATXyuXuth0y1Efwj0NiOle0YzKY6ubdn giL0IvqweQGE7Srn8Knw0ak9CQQy6Rw/n9aOg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707609088; x=1708213888; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HHV7suuu0MQVPrlCL4QBuTUyH7QVgFtZQstutgzVcQw=; b=EH/IDqbJOjUNNCJqEPL7tWbmfl5KAJYIJoIngb7xJbK01qA7MPIuGC23KHDHvCr8bt swbu84WF66cb7eWXkfTlkGtK1JL3PnZJyJs3UNit76uxvBGtiaAIgQdN1zaoZTAXbnbD +7Ctlf1WmoiiIb+zgfIvnRTjnmcvQS88ToxwHXOszADb9amiKuonyaYnBZ/awVLRLhll 0xHN5KOapwqGhamlAzPoQMvCq2unBPXcG0mz2GmxxxiiZzLZ7wvu8VIxR3kwfwBUCkPk OlCGqwJaF5t5ucUbmu4sXdM3/xB3YoLSAab7ydKTAJyg5bfsMq6ddQYelgqqtDJuCO/T wCpQ== X-Forwarded-Encrypted: i=1; AJvYcCWWHuqg2HFiRxS9U258EIEG0k75eA/kcRHG/KLSmmAPI2ulmhJ5MU+JrvovVyQs2mtGmtBDVE29HO7zuoom2d5AaqB9289x7vUKyNXT X-Gm-Message-State: AOJu0Yz6QjekUacUmVhr1uzbzJ4XvzeLXIwpGE3fCUA72GAFvlWKoDdN /1pUeP/zqJPcGXrp0fVHOVQJip6KoLNxgflO85MeA80yuA/brjV7/86IE/rD X-Received: by 2002:a05:6512:694:b0:511:46c0:d879 with SMTP id t20-20020a056512069400b0051146c0d879mr2706309lfe.47.1707609088031; Sat, 10 Feb 2024 15:51:28 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWPnn4rYFYIJcNIDuMVlr5Y9w3eMCoHlsJ7HtlfNP0w3XDg1MdZ6/t6dMLiJ6v/K2mJ6ordG5d+sB/AHwS7GynNaBVPaTW/PS9LttOJz9zXSslShef6J2AwAk7ZqszpwTMQ2uacQZRsHyZyUj1XWHdH37aVq3klpfsd4gTQDY1teYqCSjUJG3LH8XMfQ23tgIDmJstg8y70z7MHhvO09U1gbJ5uem+JRY1GlQeSA1MPSwGencRZHPuRekmKubfgDDmhmafqmAB81yQ2rOz62tXwpoeXAzh3bn8OX3COnnsg/e7GC0v6mrfksbzRiyPssWzSH/YIY5KWbS6W6phgZrqA6z7nzEJyLTd2LUeY8d6mdFFw5zX3JPXQVR3MsIrVris3JaeRIo26EJbY/1ipUdwPUaZ6o3RJhk3TVMx4jMwLsMrU+hSgZpDQlwbDCRPgGbcnLlWSZHzr6+bjE4O4gCikdG2Tz5NAGyxYE2X8XlXaIbd22sD8QzgbqeTFWOrByhMyb0jAcRsuo/BsX8BQc6v0rJWjnnWmh+aCLPzS/KJDRYZToutg/UfFFf7ARs0HNzikatOZVlog80cMq1DYcBwA/3wO2KtyUx1+0hfyFr2BrjSaiQ== Received: from ukaszb-l.roam.corp.google.com (alfa56.extreme-net.one.pl. [213.77.89.56]) by smtp.gmail.com with ESMTPSA id o27-20020a056512051b00b0051179ae1846sm365561lfb.280.2024.02.10.15.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 15:51:27 -0800 (PST) From: =?utf-8?q?=C5=81ukasz_Bartosik?= To: Jason Baron , Jim Cromie , Greg Kroah-Hartman , Andrew Morton , Kees Cook , Douglas Anderson Cc: Guenter Roeck , Yaniv Tzoreff , Benson Leung , Steven Rostedt , Vincent Whitchurch , Pekka Paalanen , Sean Paul , Daniel Vetter , Simon Ser , John Ogness , Petr Mladek , Sergey Senozhatsky , linux-kernel@vger.kernel.org, upstream@semihalf.com Subject: [PATCH v4 35/39] dyndbg-test: add test which verifies default dst Date: Sun, 11 Feb 2024 00:50:05 +0100 Message-ID: <20240210235009.2405808-36-ukaszb@chromium.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240210235009.2405808-1-ukaszb@chromium.org> References: <20240210235009.2405808-1-ukaszb@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790558839809750458 X-GMAIL-MSGID: 1790558839809750458 Add test which verifies default trace destination feature. Signed-off-by: Ɓukasz Bartosik --- .../dynamic_debug/dyndbg_selftest.sh | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh index 4a0340d2c3e8..ae386e4de6a4 100755 --- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh +++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh @@ -195,6 +195,16 @@ function check_err_msg() { fi } +# $1 - default destination to check +function check_default_dst() { + dst=$(tail -50 /proc/dynamic_debug/control | grep "#: Default trace destination" | \ + cut -d':' -f3 | sed -e 's/^[[:space:]]*//') + if [ "$dst" != "$1" ]; then + echo -e "${RED}: $BASH_SOURCE:$BASH_LINENO default dest '$dst' does not match with '$1'" + exit + fi +} + function basic_tests { echo -e "${GREEN}# BASIC_TESTS ${NC}" ddcmd =_ # zero everything (except class'd sites) @@ -343,6 +353,70 @@ function test_flags { ifrmmod test_dynamic_debug } +# test verifies default destination +function test_default_destination { + echo -e "${GREEN}# TEST_DEFAULT_DESTINATION ${NC}" + + check_default_dst 0 + modprobe test_dynamic_debug + + ddcmd class,D2_CORE,+T # default dest is 0 + check_match_ct =T 1 -v + + ddcmd open foo # foo becomes default dest + is_trace_instance_opened foo + check_trace_instance_dir foo 1 + check_default_dst foo + + ddcmd class,D2_CORE,+T # default dest is foo + check_match_ct =T:foo 1 -v + + ddcmd open,0 # reopening sets default dest to 0 + check_default_dst 0 + + ddcmd class,D2_CORE,-T + check_match_ct =:foo 1 -v + + ddcmd class,D2_CORE,+T # default dest is 0 but since callsite was already labelled + # then reuse label + check_match_ct =T:foo 1 -v + + ddcmd open bar # bar becomes default dest + is_trace_instance_opened bar + check_trace_instance_dir bar 1 + check_default_dst bar + + ddcmd class,D2_KMS,+T # default dest is bar + check_match_ct =T:bar 1 -v + + ddcmd class,D2_KMS,+T:0 # set 0 dest explicitly + check_match_ct =T 1 -v + + ddcmd class,D2_KMS,-T + + ddcmd open,foo # reopening sets default dest to foo + check_default_dst foo + + ddcmd class,D2_KMS,+T # default dest is 0 but since callsite was already labelled + # then reuse label + check_match_ct =T:foo 2 -v + + ddcmd "class D2_CORE -T:0" + ddcmd "class D2_KMS -T:0" + check_default_dst foo + + ddcmd close foo + is_trace_instance_closed foo + check_default_dst 0 # after closing foo which was default dest we revert + # to 0 as default dest + + ddcmd close bar + is_trace_instance_closed bar + check_default_dst 0 + + ifrmmod test_dynamic_debug +} + function test_actual_trace { echo -e "${GREEN}# TEST_ACTUAL_TRACE ${NC}" ddcmd =_ @@ -790,6 +864,7 @@ tests_list=( comma_terminator_tests test_percent_splitting test_flags + test_default_destination test_actual_trace cycle_tests_normal cycle_not_best_practices