From patchwork Thu Jun 29 09:11:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michal_Koutn=C3=BD?= X-Patchwork-Id: 114257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9505380vqr; Thu, 29 Jun 2023 02:26:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qY7BuWaEYyV3iwJmIv/FFEC7QDEEaNaolt9lAhPj1fcGifyAfu54sJnHh/lNsuXZ5SKJ2 X-Received: by 2002:a05:6a20:3d29:b0:111:77cf:96dd with SMTP id y41-20020a056a203d2900b0011177cf96ddmr2950527pzi.5.1688030780519; Thu, 29 Jun 2023 02:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688030780; cv=none; d=google.com; s=arc-20160816; b=Wjt5EIiNzbbnd2KY9JqbA2IuL90pKI1lRP//tNLeh/u/82bPRedxiMEZrv0Y93Y4nU H459R37tXXvLl/58z1kXAJGLxgEll8QKmxVa602PsyLwwn9XUP341dAMGZSEbyQwwPWw nvrqZSc9zrZCvSZIdUn30W9+d5l+8fBVI+9oEsabIVsuSkTHvz45HUZjQsZY9UQGOGTU Q9YjVL6VnVbWCT9Z/iWFkR7gkd3XlPfTvhCBtIga/I3QLCTiX+ZvO8ygE5tcBRPYQtQa oa72ddcEinUzanFnwrurxdTXALKEOqDuB1yKuBy5Gd3IesanZRyviBn1U8bEsvTJT8wy cIkQ== 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=MWY4rlizTsbE4lk/fbjSF0vRSuBEIrtI8kkmTHcKZeU=; fh=W9YjB8LblKMI9BlzaYswLs++QP273lsG58/F27dOPSw=; b=e2HvuOZtO7EuUQtdFioPEUS8yGRizCyFm+Cagy5TTTUjXGUEOF4Iuc2/d/je/NJ7Aq 7+HYatPR01ANoPUFezuPf7ptKFIxYwmHt+jb5GWoGf9g/M4IHPRiQykAeFurnL8UFzf7 NvDxf2n6DvDfVhKjQD6RTeNH9V3EpHJ5cpeGUo3Vg6RWAJ2NTbsg05k7lT3hAMmEyXcL 6tYVB4zpzXXls0tu9yIx+Ax8IKaQf900PnuKRrvJuAlsF/R2SuBF/f4t9Ydj5EMW+Qp9 SpdN9+Pib8z0fuLfI0V3sZ0LgFaD2s70Jy8apLxJo7vjAt+4qSYlu7GoUHDz2HXN203t kT8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="V433YG/Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p13-20020a056a000b4d00b0066a4fe6ad99si11003626pfo.148.2023.06.29.02.26.06; Thu, 29 Jun 2023 02:26:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="V433YG/Z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232329AbjF2JMC (ORCPT + 99 others); Thu, 29 Jun 2023 05:12:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232047AbjF2JL4 (ORCPT ); Thu, 29 Jun 2023 05:11:56 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0169210B; Thu, 29 Jun 2023 02:11:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 41E501F8D6; Thu, 29 Jun 2023 09:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1688029913; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MWY4rlizTsbE4lk/fbjSF0vRSuBEIrtI8kkmTHcKZeU=; b=V433YG/ZQoa/QQPs4M307VdqVQ2YhmL/Ph5DUDb08P8wd0oOJm91kqkrUxXAIUor5M5ka1 seag/s7rQD0NbBqcbc/zv0ua307vDPz8pJEmHiiSzH8Ip9tpdbVlDA/n5dZff6G2Er2Zwp TeZiFMiguSVTEKiYONtEG/vwLpcXqbA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1C12D139FF; Thu, 29 Jun 2023 09:11:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6MUPBtlKnWSMdQAAMHmgww (envelope-from ); Thu, 29 Jun 2023 09:11:53 +0000 From: =?utf-8?q?Michal_Koutn=C3=BD?= To: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Waiman Long , Zefan Li , Tejun Heo , Johannes Weiner , Shuah Khan Subject: [PATCH 2/3] selftests: cgroup: Minor code reorganizations Date: Thu, 29 Jun 2023 11:11:45 +0200 Message-ID: <20230629091146.28801-3-mkoutny@suse.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230629091146.28801-1-mkoutny@suse.com> References: <20230629091146.28801-1-mkoutny@suse.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770028564029916348?= X-GMAIL-MSGID: =?utf-8?q?1770028564029916348?= No functional change intended, these small changes are merged into one commit and they serve as a preparation for an upcoming new testcase. Signed-off-by: Michal Koutný --- MAINTAINERS | 1 + tools/testing/selftests/cgroup/cgroup_util.c | 2 ++ tools/testing/selftests/cgroup/cgroup_util.h | 2 ++ tools/testing/selftests/cgroup/test_core.c | 2 +- tools/testing/selftests/cgroup/test_cpuset_prs.sh | 2 +- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 35e19594640d..50e7056b4383 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5259,6 +5259,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git F: Documentation/admin-guide/cgroup-v1/cpusets.rst F: include/linux/cpuset.h F: kernel/cgroup/cpuset.c +F: tools/testing/selftests/cgroup/test_cpuset_prs.sh CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) M: Johannes Weiner diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c index e8bbbdb77e0d..0340d4ca8f51 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.c +++ b/tools/testing/selftests/cgroup/cgroup_util.c @@ -286,6 +286,8 @@ int cg_destroy(const char *cgroup) { int ret; + if (!cgroup) + return 0; retry: ret = rmdir(cgroup); if (ret && errno == EBUSY) { diff --git a/tools/testing/selftests/cgroup/cgroup_util.h b/tools/testing/selftests/cgroup/cgroup_util.h index c92df4e5d395..1df7f202214a 100644 --- a/tools/testing/selftests/cgroup/cgroup_util.h +++ b/tools/testing/selftests/cgroup/cgroup_util.h @@ -11,6 +11,8 @@ #define USEC_PER_SEC 1000000L #define NSEC_PER_SEC 1000000000L +#define TEST_UID 65534 /* usually nobody, any !root is fine */ + /* * Checks if two given values differ by less than err% of their sum. */ diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c index 600123503063..80aa6b2373b9 100644 --- a/tools/testing/selftests/cgroup/test_core.c +++ b/tools/testing/selftests/cgroup/test_core.c @@ -683,7 +683,7 @@ static int test_cgcore_thread_migration(const char *root) */ static int test_cgcore_lesser_euid_open(const char *root) { - const uid_t test_euid = 65534; /* usually nobody, any !root is fine */ + const uid_t test_euid = TEST_UID; int ret = KSFT_FAIL; char *cg_test_a = NULL, *cg_test_b = NULL; char *cg_test_a_procs = NULL, *cg_test_b_procs = NULL; diff --git a/tools/testing/selftests/cgroup/test_cpuset_prs.sh b/tools/testing/selftests/cgroup/test_cpuset_prs.sh index 2b5215cc599f..4afb132e4e4f 100755 --- a/tools/testing/selftests/cgroup/test_cpuset_prs.sh +++ b/tools/testing/selftests/cgroup/test_cpuset_prs.sh @@ -10,7 +10,7 @@ skip_test() { echo "$1" echo "Test SKIPPED" - exit 0 + exit 4 # ksft_skip } [[ $(id -u) -eq 0 ]] || skip_test "Test must be run as root!"