Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp892425rdg; Fri, 13 Oct 2023 04:37:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhYInu/Rb8xDmC7vW6MEm2Qgkz7prF6jDUlTnaYPwli3gb5UBtsiu7y3mk8+j2GKhFWq7R X-Received: by 2002:a05:6a20:3942:b0:174:33c:24cd with SMTP id r2-20020a056a20394200b00174033c24cdmr7844716pzg.15.1697197073597; Fri, 13 Oct 2023 04:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697197073; cv=none; d=google.com; s=arc-20160816; b=aMzxhY6AssgxWpKBgAXl4brNpmRaEzVvPwd4NapLJftAvQnl1WoIhj/21yiQyeH5NB wkrb79lD+rwYJ9zPlsfeCaB8n+IyrXD9hyqMk0mJRdtwAqJfxS9y5engOHXUNNe6hIlD jzyEMRESfn+z3Evr4FwWej6OiW9ydtL/ziQgpNoj7DRKdv9BtOsRZnKthxPKRcBOpdnR HYMvQN1z7MXVtTr//lVxVqRLnzPu84jAEYmfhnXSnFcZaZqHX22Oi8Oa2weXRRyk2qAk yapDzYjUpeZaZWA7joAt+5AL6NCC9tnPYyGU7F4ER394GH9AzP4zseFBUbnB8/2qNvLY XjVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cCd5mi12bBiYREKptr9IoJkJ+aJG1Lk5wOU4aNG9KTs=; fh=33DkgOLZOhGl4RjlhWAp5nFcYUbqyWwnGv4zJFDsNbM=; b=gxk+BO3o+X8CrowgGs1WDTKFjXW58gyxtCJuPJJyw0Zd1bXX/+sjm9Llvp730dRmno PLuIkQ4X989qBapo1w83s88gHIcFWsVoT/AwLL4eZSXVEZuWR7qHDzTqDlfoKQlpk7gY RQhnrm+enIF/l8eW93hembuNtuK2FfShZqGTuB/zRGDVDeQWtyJPtYYwNBREJaW5dces lzaMXpHi65oIMzqxm5HYAXwwqXOBKU7EC/z01J02EzU31kAl7J+c1bEM7W99qORsIT/X jMhZRGdJV7tHL0AZvMSsKxLFt0ULi4uxwafHp36xcj0sDImHT7SbgLny2bH6jjgI/pk3 9yng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TKmo4iCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b69-20020a633448000000b005ae39764b64si220395pga.135.2023.10.13.04.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 04:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TKmo4iCr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 99D06839FC6B; Fri, 13 Oct 2023 04:37:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbjJMLhe (ORCPT + 99 others); Fri, 13 Oct 2023 07:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbjJMLh3 (ORCPT ); Fri, 13 Oct 2023 07:37:29 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4127AFB; Fri, 13 Oct 2023 04:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697197046; x=1728733046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cfv3EM5E0tBqtXV+hKYl3ZgICecUfniEzURX03Z8tNE=; b=TKmo4iCrm2vj///VfpyTfj9+d38+93Nh8k5RdOHKiR5+TCtefpaKhu4K DNHrYSa8DPGeMtZyuh/OG7FLkOplbfWgiaDsedF9c4HgQ/nMYq6Z2DwJI n5jOYlv+GmDe5d8eGFlsFYnOu0W/3FTsdJUqoRcYHtWQt+EelbY655KsI g2kPqmciAZaL53S1E5Gzz5fXf8i4rY3pwMfHkXxgT70dstSSx1VeA28uG cPLSbJqZzZWEyR3WRpaZtr+/mkwtoKMrLzpnkWKpUgV9YVtZ13rj9Z/Ue hitquRY2BBdtjqua1utK2Zc1dvzleiNBwJMU5B4WdAbh9XjySHU9oCW57 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10861"; a="449353278" X-IronPort-AV: E=Sophos;i="6.03,222,1694761200"; d="scan'208";a="449353278" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2023 04:37:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10861"; a="754675723" X-IronPort-AV: E=Sophos;i="6.03,222,1694761200"; d="scan'208";a="754675723" Received: from bsankiew-mobl.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.0.114]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2023 04:37:21 -0700 From: Maciej Wieczor-Retman To: Christian Brauner , Shuah Khan , Christian Kellner Cc: ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v6 4/8] selftests/pidfd: Fix ksft print formats Date: Fri, 13 Oct 2023 13:36:28 +0200 Message-ID: <7c62fbcb94b5d3df6c18830b19593c69857aac1e.1697196663.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Fri, 13 Oct 2023 04:37:50 -0700 (PDT) Compiling pidfd selftest after adding a __printf() attribute to ksft_print_msg() and ksft_test_result_pass() exposes -Wformat warnings in error_report(), test_pidfd_poll_exec_thread(), child_poll_exec_test(), test_pidfd_poll_leader_exit_thread(), child_poll_leader_exit_test(). The ksft_test_result_pass() in error_report() expects a string but doesn't provide any argument after the format string. All the other calls to ksft_print_msg() in the functions mentioned above have format strings that don't match with other passed arguments. Fix format specifiers so they match the passed variables. Add a missing variable to ksft_test_result_pass() inside error_report() so it matches other cases in the switch statement. Fixes: 2def297ec7fb ("pidfd: add tests for NSpid info in fdinfo") Signed-off-by: Maciej Wieczor-Retman --- Changelog v6: - Add an explanation to the patch message on how the warnings that the patch resolves were caught. (Shuah) Changelog v2: - Add fixes tag to patch message. tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 2 +- tools/testing/selftests/pidfd/pidfd_test.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c index 4e86f927880c..01cc37bf611c 100644 --- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c +++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c @@ -62,7 +62,7 @@ static void error_report(struct error *err, const char *test_name) break; case PIDFD_PASS: - ksft_test_result_pass("%s test: Passed\n"); + ksft_test_result_pass("%s test: Passed\n", test_name); break; default: diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index 00a07e7c571c..c081ae91313a 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -381,13 +381,13 @@ static int test_pidfd_send_signal_syscall_support(void) static void *test_pidfd_poll_exec_thread(void *priv) { - ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n", + ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n", getpid(), syscall(SYS_gettid)); ksft_print_msg("Child Thread: doing exec of sleep\n"); execl("/bin/sleep", "sleep", str(CHILD_THREAD_MIN_WAIT), (char *)NULL); - ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", + ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); return NULL; } @@ -427,7 +427,7 @@ static int child_poll_exec_test(void *args) { pthread_t t1; - ksft_print_msg("Child (pidfd): starting. pid %d tid %d\n", getpid(), + ksft_print_msg("Child (pidfd): starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); pthread_create(&t1, NULL, test_pidfd_poll_exec_thread, NULL); /* @@ -480,10 +480,10 @@ static void test_pidfd_poll_exec(int use_waitpid) static void *test_pidfd_poll_leader_exit_thread(void *priv) { - ksft_print_msg("Child Thread: starting. pid %d tid %d ; and sleeping\n", + ksft_print_msg("Child Thread: starting. pid %d tid %ld ; and sleeping\n", getpid(), syscall(SYS_gettid)); sleep(CHILD_THREAD_MIN_WAIT); - ksft_print_msg("Child Thread: DONE. pid %d tid %d\n", getpid(), syscall(SYS_gettid)); + ksft_print_msg("Child Thread: DONE. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); return NULL; } @@ -492,7 +492,7 @@ static int child_poll_leader_exit_test(void *args) { pthread_t t1, t2; - ksft_print_msg("Child: starting. pid %d tid %d\n", getpid(), syscall(SYS_gettid)); + ksft_print_msg("Child: starting. pid %d tid %ld\n", getpid(), syscall(SYS_gettid)); pthread_create(&t1, NULL, test_pidfd_poll_leader_exit_thread, NULL); pthread_create(&t2, NULL, test_pidfd_poll_leader_exit_thread, NULL); -- 2.42.0