From patchwork Tue Jul 20 13:33:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=jfqdE8R9; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfnr31Mdz9sWX for ; Tue, 20 Jul 2021 23:34:24 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 61AB83C6BD7 for ; Tue, 20 Jul 2021 15:34:21 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id E44223C2B48 for ; Tue, 20 Jul 2021 15:34:07 +0200 (CEST) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id 968B36008F6 for ; Tue, 20 Jul 2021 15:34:07 +0200 (CEST) Received: by mail-lf1-x136.google.com with SMTP id y42so35830275lfa.3 for ; Tue, 20 Jul 2021 06:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S5VWBTnBXqkir1Cy8ZaFZbstsLWfUTJ8pLwtKKnsfS8=; b=jfqdE8R9vsckjszNdF5oVNITjko9hC/utePivbcjYzZT3qNgK9T8mcGgC7pTYgaB1T StJBdIGrfeINvApo7YNwRqIJ99HjHiy4ztUvxWl6RwcqSKKpnNGqHF0YQyHBsLe60yOv BxrrtxSypM+mrosMQb0JUgU+8/S9OF499zKD686lqNDc8bLAe/OAD6udDrwsP7LkoxxQ jPx5zKP1QRmCJzoJx1/rbtE3G/YVjItSzibMtTX/O6xNxSMBgya2gJ+C0l/Jt9HQJOo7 9G0IBIg4RIUSdIHrYqZZiEP+gKBNj9jj19vHijefg3QaLhiok/N0OfM7wPhqJuzukN3Q m5uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S5VWBTnBXqkir1Cy8ZaFZbstsLWfUTJ8pLwtKKnsfS8=; b=eyqdrdnMorZKdUBu39NT0MVi6nAvuzU5GEl99ZRDwQMR78R4IxgeJ6lvmiZmwEtaQK SV2CSIUFgzwJ/qr652qcvNyi5bnbxr+dGuzCEpTMlY5Z5pmgawfommyPYQRniZobcKO8 0/Hhdocl3PsgbMLHVE+8/3X3K+T7RZbqflZ935KuqglH2lfpFLYWcMLOHnuWgYWG0nap Im5tgYqI+7v0BK3mtjIKf9p5frNsBLSkK0PLWswyBwvwFtWKS5G5DJL4D26UQknQy0T6 XLRrbq3y7sVY36X5m3RAtgM+uBoeqFzdXVokamaeNVWeWcptXVm7j+wYT8H6mQp+25Ln TB7A== X-Gm-Message-State: AOAM533SOgoVN2NBgUQV4BDJ6Rknyly7Gn4nJzQ2Br6glmuy6GLduDW9 wNlyxSwNoTAipxCShHRmYfLMtLYMLSqz X-Google-Smtp-Source: ABdhPJzLbpvLMfNn9J57utIJm2bpZ+Mac5ONAsriw77EOOl8Yi899OaXyJdm0uykWJPS8zmTAMYiAA== X-Received: by 2002:ac2:5b03:: with SMTP id v3mr14926502lfn.188.1626788046796; Tue, 20 Jul 2021 06:34:06 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:06 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:09 +0300 Message-Id: <20210720133324.21752-2-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 01/16] lib/tst_sched: add ltp tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The new tst_sched_*() invoke libc variant first, and if ENOSYS errno has been returned, tries to invoke syscall directly. musl implementation returns ENOSYS for some sched_*() functions due to commit 1e21e78bf7a5 ("add support for thread scheduling (POSIX TPS option)"). Signed-off-by: Alexey Kodanev --- include/tst_sched.h | 16 ++++++++++++++++ lib/tst_sched.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 include/tst_sched.h create mode 100644 lib/tst_sched.c diff --git a/include/tst_sched.h b/include/tst_sched.h new file mode 100644 index 000000000..0e5d61344 --- /dev/null +++ b/include/tst_sched.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (c) 2021, BELLSOFT. All rights reserved. + */ + +#ifndef TST_SCHED_H_ +#define TST_SCHED_H_ + +#include + +int tst_sched_setparam(pid_t pid, const struct sched_param *param); +int tst_sched_getparam(pid_t pid, struct sched_param *param); +int tst_sched_setscheduler(pid_t pid, int policy, const struct sched_param *param); +int tst_sched_getscheduler(pid_t pid); + +#endif /* TST_SCHED_H_ */ diff --git a/lib/tst_sched.c b/lib/tst_sched.c new file mode 100644 index 000000000..d53273d8e --- /dev/null +++ b/lib/tst_sched.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2021, BELLSOFT. All rights reserved. + */ + +#include +#include +#include "tst_sched.h" +#include "lapi/syscalls.h" + +#define TST_SCHED_COMMON(SCALL, ...) do { \ + int ret = SCALL(__VA_ARGS__); \ + if (ret == -1 && errno == ENOSYS) \ + return syscall(__NR_##SCALL, __VA_ARGS__); \ + return ret; \ +} while (0) + +int tst_sched_setparam(pid_t pid, const struct sched_param *param) +{ + TST_SCHED_COMMON(sched_setparam, pid, param); +} + +int tst_sched_getparam(pid_t pid, struct sched_param *param) +{ + TST_SCHED_COMMON(sched_getparam, pid, param); +} + +int tst_sched_setscheduler(pid_t pid, int policy, const struct sched_param *param) +{ + TST_SCHED_COMMON(sched_setscheduler, pid, policy, param); +} + +int tst_sched_getscheduler(pid_t pid) +{ + TST_SCHED_COMMON(sched_getscheduler, pid); +} From patchwork Tue Jul 20 13:33:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=wzb4lUar; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfp32rkLz9sWq for ; Tue, 20 Jul 2021 23:34:34 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 731DC3C81B0 for ; Tue, 20 Jul 2021 15:34:32 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id B0B2A3C2B48 for ; Tue, 20 Jul 2021 15:34:08 +0200 (CEST) Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 0AC8A20034E for ; Tue, 20 Jul 2021 15:34:08 +0200 (CEST) Received: by mail-lj1-x22d.google.com with SMTP id e14so12617499ljo.7 for ; Tue, 20 Jul 2021 06:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XBwax4a0fgGxf4yolXOhVP6m+1fe9diCHcr0mpEmJHg=; b=wzb4lUarQI5Psm9ZE3rDpNwwQl/tgExSAcY2B/oICaD0GqXIj2dLh58tNUT2rdAdwW AB2mVfuHjKwp9we7VwzGE98OhMxOv3SSn6Q9xR2IPhM9LKdO2wzFvWTJwJjGD8hkJqas ZencwOUaWvtGXvD+t0+Jg8uM857yJWZIw0kxJ81OWbltqvZFnhb8f56ZuzWvcdRbZ4u0 jEEpj2z17fcdQIeQArCG9Nhpc9pd+1vxS5kkZtfsMVPw8LfDy18S+ZamlRnw7F+Sj94I r1sqcBZfYhRnKeZ/ln+qMnON7Y03htWMtbCdX8M6K5iHxDiXIAlfM+wpY66Ivsih1w1+ zmbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XBwax4a0fgGxf4yolXOhVP6m+1fe9diCHcr0mpEmJHg=; b=bHQ8HBNR2Yz9dHlARFurpS6ws/x/ahN4GwEW2ub9l1HD9bwk3arQ+ac5VADuOGPjfO KoZ2MXq8t6mto1ujtChvgv0vEkiYRP5/JMdzjK2ZoV3I3fCZmXwCz65nnMI2Up9HLZNP ySHw+XDhwem3oinNgJOVTJaZKyuEWCNs5cTLezRSRWSd87X8nyyc+FBdZRpu4n8EvWE7 KNBBjtrIVpadIhxjXIpHMIi92RIBYruxGVhVnJnz3oxyvf/exDtPQGlmTdYTIR6SBe1M vmyE7Ruem9k6U55sWzn7vIECpB8R2VnTI34f481LmglTMw2wqNVEa7z78rRHuobNLeVb +bHQ== X-Gm-Message-State: AOAM533s4IyTzCb8c4tgYbd/VSzbwRqgBGy8lYsY2FB4iV8dvATI3wwQ dlUB+eL8jbr+UnrogIN5rTm6jZF5cC+W X-Google-Smtp-Source: ABdhPJyEwsJT8nQ1moA7l8YoV/6Q/Q2D8EgGQhmeIUIguHbR8M60OM4Mu5FKUELa82XW2RBKiaUyeQ== X-Received: by 2002:a2e:a54d:: with SMTP id e13mr3310592ljn.1.1626788047358; Tue, 20 Jul 2021 06:34:07 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:07 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:10 +0300 Message-Id: <20210720133324.21752-3-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH 02/16] syscalls/sched_getparam01: use tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- testcases/kernel/syscalls/sched_getparam/sched_getparam01.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c index efb697707..c24d1c917 100644 --- a/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c +++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c @@ -21,8 +21,8 @@ #include #include #include -#include #include "tst_test.h" +#include "tst_sched.h" static pid_t pids[2] = {0, 0}; @@ -35,8 +35,8 @@ static void verify_sched_getparam(unsigned int n) child_pid = SAFE_FORK(); if (!child_pid) { - TST_EXP_PASS_SILENT(sched_getparam(pids[n], ¶m), - "sched_getparam(%d)", pids[n]); + TST_EXP_PASS_SILENT(tst_sched_getparam(pids[n], ¶m), + "sched_getparam(%d)", pids[n]); if (!TST_PASS) exit(0); From patchwork Tue Jul 20 13:33:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=eyNXrplQ; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfpF2q5mz9sX3 for ; Tue, 20 Jul 2021 23:34:45 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 6B12F3C981B for ; Tue, 20 Jul 2021 15:34:42 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 353DC3C2B48 for ; Tue, 20 Jul 2021 15:34:09 +0200 (CEST) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id BF32420034E for ; Tue, 20 Jul 2021 15:34:08 +0200 (CEST) Received: by mail-lf1-x130.google.com with SMTP id b26so35840193lfo.4 for ; Tue, 20 Jul 2021 06:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mCYi6Xu1yTNhkqv3qx6yaFuUxy+i8v/TAK5y4ZQTgKI=; b=eyNXrplQEwwYmIZka4t4TrCFGGn70PRcytT01W5CFqSmXWN3VdisXeMp7a82FLFSgh /8z8ccPina+fSQw1znjUmCubndbDtSJjsrfj3oovrLAvXFoaUXX2HVkWSgLUXOOTXDTk 5UKIuB/Y7CyUMtTDZvzeG+Cx6A74M8nAa2i3u9iHnDCUeZUoCnSrbDqDS2sysN3Ryf9k 74Inyo0BeD4f2DJ+GQJo8o8av1Ox+wwfPWQUNZKjWqWp7H9/yDRXHQtny0mHk6OsA2Ra w37TzzboyzCUuNOW+aTUEIcxuiBii/6EacBd/t/UaxjAZyxqKf50FDpfGU5ixJPxkXuz mcbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mCYi6Xu1yTNhkqv3qx6yaFuUxy+i8v/TAK5y4ZQTgKI=; b=T0/wPk+0W3ZhMtr9VE4U8NUVJF685xBMxLjAVX6gXw5ICz6p5GQw/HcHvzdqxWNY/7 aFPOFLQL2IZbSKPL9dmEDvmO938tIfdzfF/zNDt9DzB/P6c3LPcW4tlQVkTGmVMSEyBR B67C3wz9vO8C4TT3xiefW+bJx3EvUPDplTgbAId0ZYNPqEf80SCzEBXPo1r3w6IgLMZg pp+vNt4Ul1CZcCL7WysTnMv2mOtVPdZHPWg4P8710aygSa9SkdCBmRu3bG3LfrrgSwOZ KHenmKHgh5IdsiznVTbdDwE6meT5ddVPNM4kuolb9v2iH0jFxtWtpWATEkzM2fZoTvpg h8nQ== X-Gm-Message-State: AOAM531M2rawwTw4fKo6SAMZkVM0319OhYlp4qrDg4wqMk0L/O1Djvlx gh4M8jYFUFGzsYis4gqOc49RZxZOf5C+ X-Google-Smtp-Source: ABdhPJxucvCVS+c5jSBaWKgcmf5jZsXuaUj+nEQECr9YsVbLRE8KIO+dpkoSJYKirhLHt1X7iLyQPA== X-Received: by 2002:ac2:4e09:: with SMTP id e9mr3107171lfr.431.1626788048059; Tue, 20 Jul 2021 06:34:08 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:07 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:11 +0300 Message-Id: <20210720133324.21752-4-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH 03/16] syscalls/sched_getparam03: use tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- testcases/kernel/syscalls/sched_getparam/sched_getparam03.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c index 19ecaf147..451bfdc50 100644 --- a/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c +++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c @@ -17,8 +17,8 @@ */ #include -#include #include "tst_test.h" +#include "tst_sched.h" static struct sched_param param; static pid_t unused_pid; @@ -43,7 +43,7 @@ static void verify_sched_getparam(unsigned int n) { struct test_case_t *tc = &test_cases[n]; - TST_EXP_FAIL(sched_getparam(*(tc->pid), tc->p), tc->exp_errno, "%s", tc->desc); + TST_EXP_FAIL(tst_sched_getparam(*(tc->pid), tc->p), tc->exp_errno, "%s", tc->desc); } static void setup(void) From patchwork Tue Jul 20 13:33:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=PP/xw04X; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfpQ1Psjz9sXb for ; Tue, 20 Jul 2021 23:34:53 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 62C6E3C6EED for ; Tue, 20 Jul 2021 15:34:51 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 26A8A3C81AF for ; Tue, 20 Jul 2021 15:34:10 +0200 (CEST) Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 885391400DB3 for ; Tue, 20 Jul 2021 15:34:09 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id s13so14316459lfi.12 for ; Tue, 20 Jul 2021 06:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RJ2xBftM7w4OU7tTP/v/NCCkj7Hq9nLvMDuD0tN5Qpo=; b=PP/xw04XzMEXYmBpWz32WWnSZ8at8m4iqCzFKz3Yy9UKsBFA+fmwLRxJkE9gERkTNE HzOU+L+/Wo1D5SuzN61QvdU6bic5bM06ak6NH2MvQU8vHUmdiaOMTPYrsih/DabsgB5v IGn9l58WHERwzadIv9aNE0SBL07yb8xRJIF0qi/YyXPlBpO6VQPD+gHH0tdtU+1+lxAp vnPO2ap72ynd/uJd2hVKyKzkIlsu69owuKDsO1Cghgd/YjXWVdoNlzXyyQO0eK1j+G9B Jen89muDRNVwEQyIQf3Tkh32fXLeKg8iyD5z3e1gZdSMRU6TGrKuY2wJCy4iwh0/sOFw ftgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RJ2xBftM7w4OU7tTP/v/NCCkj7Hq9nLvMDuD0tN5Qpo=; b=susJ/cNlURXzjd8pHXUzWNqcAQ+tfDCKx5ByfACkbV2vhu/wKftgsFcTOEWpxMnbHz b2T4DUTVAsyARm0fXFzhx0bTQDL70D1EioxQ/+mes9DpcS5cHHDiboFC0BbLbzh47wuj /49OaufrLgcdbNDsER+Ik5XV4k5tZAmIc3cbL5wVSJJVotK6d+qAiiXpynk7PpnuA5GA ehLuU/n4Yd28BDrMkK3GIvZak23JrQNtyHILlFgQaaeavQEmCu4gZZ2oXQiuLbGNGDzc eNzNBm0l/oDVLSbS/5OGpSqC9WR4GuwVZVm1qAJhBUtuopDMNRH1p8aNNJUiy5e0yBNC cBnQ== X-Gm-Message-State: AOAM532+0JUiUNnh+Ko/j5i4vS2yduwjSVKxnbWebxAzS0rUVxsiwqjO qahiVlBshk/EKZdPlXZodNIEaNqZkLfs X-Google-Smtp-Source: ABdhPJzHjI9yWEWW2foQC6SaHkYItkbWJyC+6wecQQq9AqEsmTQcD8iu//gQn6cJZmnnvg9ZHVcX8A== X-Received: by 2002:a19:fc13:: with SMTP id a19mr23169331lfi.581.1626788048828; Tue, 20 Jul 2021 06:34:08 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:08 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:12 +0300 Message-Id: <20210720133324.21752-5-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 04/16] syscalls/sched_setparam01: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setparam/sched_setparam01.c | 135 +++--------------- 1 file changed, 18 insertions(+), 117 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c index a2272eb18..d677736a1 100644 --- a/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c +++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c @@ -1,128 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021, BELLSOFT. All rights reserved. * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * + * AUTHOR: Saji Kumar.V.R */ -/********************************************************** - * - * TEST IDENTIFIER : sched_setparam01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sched_setparam(2) - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Saji Kumar.V.R - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * DESCRIPTION - * This is a Phase I test for the sched_setparam(2) system call. - * It is intended to provide a limited exposure of the system call. - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if system call failed (return=-1) - * Log the errno and Issue a FAIL message. - * Otherwise, Issue a PASS message. - * - * Cleanup: - * Print errno log and/or timing stats if options given + +/*\ + * [Description] * - * USAGE: - * sched_setparam01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -h : Show help screen - * -f : Turn off functional testing - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -p : Pause for SIGUSR1 before starting - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Basic test for sched_setparam(2) * - ****************************************************************/ - -#include -#include -#include "test.h" - -static void setup(); -static void cleanup(); - -char *TCID = "sched_setparam01"; -int TST_TOTAL = 1; - -static struct sched_param param; - -int main(int ac, char **av) -{ - - int lc; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - /* - * Call sched_setparam(2) with pid=0 sothat it will - * set the scheduling parameters for the calling process - */ - TEST(sched_setparam(0, ¶m)); - - if (TEST_RETURN == 0) { - tst_resm(TPASS, "sched_setparam() returned %ld", - TEST_RETURN); - } else { - tst_resm(TFAIL | TTERRNO, - "Test Failed, sched_setparam()" "returned %ld", - TEST_RETURN); - } - } + * Call sched_setparam(2) with pid=0 so that it will + * set the scheduling parameters for the calling process + */ - cleanup(); - tst_exit(); -} +#include "tst_test.h" +#include "tst_sched.h" -/* setup() - performs all ONE TIME setup for this test */ -void setup(void) +static void run(void) { + struct sched_param p = { .sched_priority = 0 }; - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; - - param.sched_priority = 0; - + TST_EXP_PASS(tst_sched_setparam(0, &p)); } -/* - *cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ -} +static struct tst_test test = { + .test_all = run, +}; From patchwork Tue Jul 20 13:33:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=yiRFU+KQ; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfpZ5Y9Rz9sXb for ; Tue, 20 Jul 2021 23:35:02 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 9B6753C9824 for ; Tue, 20 Jul 2021 15:35:00 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id D01493C6CDA for ; Tue, 20 Jul 2021 15:34:10 +0200 (CEST) Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 379621A00CAD for ; Tue, 20 Jul 2021 15:34:10 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id t20so15321406ljd.2 for ; Tue, 20 Jul 2021 06:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=09mmlejcnQGweMTVet8lck1dEkw3HX15QBOU7/dsCxE=; b=yiRFU+KQtZDQsWo4DDQK4+DE/dW0KojNclDfUeNWA3YfKKxr+Ux0MZIVJj8pZnSH5t ZzbvZZrzBa5g9EyurU+bwRMbjXCK/G+7E7wmpNzWyE1PG5PzTRsp85XNNDtE0QZEhs7X jhuoyE+6IXWGqBBsWfFCOBBqJGdh7YOGBYOIDrM617lCffvZGJQYyAsqJ/jTdkc7jsPL 1e+/MB8nkr85gd34mLvt7Wwntg0Hw9FtSfhb0cbLzxBlpP87GyS/QkPZUh7cBR/7cHOc QzHz/aE1Ldjgmumk4GHMNJsjwDWeDeC5ni85AjJ6lNw0stZJroLSZuoiTppO6yrsJtoT eDUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=09mmlejcnQGweMTVet8lck1dEkw3HX15QBOU7/dsCxE=; b=TUwQhGA8HOv/1eDD1Jl3rPahIT8szDPkr9xcGQpBtqnYf9FMTwGrg/l0v7F2Ji/IiL pSUPup61P19NtlXVrEdfzhBDuOhr9CmSAdnj7KfDit7wyz3QhcgvdmSgjaLmG9rr0TWf rPU6mWyZj7AESx0pn1In2Ml4FG/fJlb9mhaX/J9+/kGEe6uGKK4WJH50sVia0a4ivNWP VoSdhavmXeFKuNhHLjdBWNgRwfqiNPwzZTFveKbogyVFqLu3A4+QKSEmt4VljXCk0N0F dJqnobLq8avj+PmhEjJjer03G1Nk3zEC+3LeDCWXjLxtNiX1dYzdI52t4rjLVXUYgAZi pAhw== X-Gm-Message-State: AOAM532sa+CLqeYPme7+S75L5pKbiJkC3OsE/xxid+tHuHglzFbWdDL3 8giN2PE7ufj8XkJycXI2TXKPLEK1yOLk X-Google-Smtp-Source: ABdhPJyCDlQaA+GLneYVJc2zfDMTtQOGLJGUPF129HmmBzRa4+oOaUv2sZ3itSDR+xnfsF9SMJ/k7A== X-Received: by 2002:a2e:bd08:: with SMTP id n8mr26467206ljq.379.1626788049482; Tue, 20 Jul 2021 06:34:09 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:09 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:13 +0300 Message-Id: <20210720133324.21752-6-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 05/16] syscalls/sched_setparam02: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setparam/sched_setparam02.c | 195 ++++-------------- 1 file changed, 35 insertions(+), 160 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c index 132cc9d6c..de7ec208e 100644 --- a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c +++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c @@ -1,184 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021, BELLSOFT. All rights reserved. * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * AUTHOR: Saji Kumar.V.R */ -/********************************************************** - * - * TEST IDENTIFIER : sched_setparam02 - * - * EXECUTED BY : root / superuser - * - * TEST TITLE : Checks functionality for sched_setparam(2) - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Saji Kumar.V.R - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * DESCRIPTION - * This test changes the scheduling priority for current process - * and verifies it by calling sched_getparam(). - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Change scheduling policy to SCHED_FIFO - * - * Test: - * Loop if the proper options are given. - * Execute system call - * If scheduling priority is set properly, - * TEST passed - * else - * TEST failed - * - * Cleanup: - * Print errno log and/or timing stats if options given + +/*\ + * [Description] * - * USAGE: - * sched_setparam02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -h : Show help screen - * -f : Turn off functional testing - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -p : Pause for SIGUSR1 before starting - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Checks functionality for sched_setparam(2) * - ****************************************************************/ + * This test changes the scheduling priority for current process + * and verifies it by calling sched_getparam(). + */ -#include -#include -#include "test.h" +#include "tst_test.h" +#include "tst_sched.h" #define FIFO_OR_RR_PRIO 5 #define OTHER_PRIO 0 -static void setup(); -static void cleanup(); -static int verify_priority(int); - -char *TCID = "sched_setparam02"; - -static struct sched_param param; -static struct sched_param param1 = { 1 }; - static struct test_cases_t { char *desc; int policy; int priority; -} testcases[] = { + int param; +} tcases[] = { { - "Test with policy SCHED_FIFO", SCHED_FIFO, FIFO_OR_RR_PRIO}, { - "Test with policy SCHED_RR", SCHED_RR, FIFO_OR_RR_PRIO}, { - "Test with SCHED_OTHER", SCHED_OTHER, OTHER_PRIO} + "Test with policy SCHED_FIFO", SCHED_FIFO, FIFO_OR_RR_PRIO, 1}, { + "Test with policy SCHED_RR", SCHED_RR, FIFO_OR_RR_PRIO, 1}, { + "Test with SCHED_OTHER", SCHED_OTHER, OTHER_PRIO, 0} }; -int TST_TOTAL = sizeof(testcases) / sizeof(testcases[0]); - -int main(int ac, char **av) -{ - - int lc, i; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - for (i = 0; i < TST_TOTAL; ++i) { - - if (i == 2) { - param1.sched_priority = 0; - } else { - param1.sched_priority = 1; - } - if ((sched_setscheduler(0, testcases[i].policy, - ¶m1)) == -1) { - tst_brkm(TBROK, cleanup, "sched_setscheduler()" - " failed"); - } - param.sched_priority = testcases[i].priority; - /* - * Call sched_setparam(2) with pid=0 sothat it will - * set the scheduling parameters for the calling process - */ - TEST(sched_setparam(0, ¶m)); - - if ((TEST_RETURN == 0) && (verify_priority(i))) { - tst_resm(TPASS, "%s Passed", testcases[i].desc); - } else { - tst_resm(TFAIL | TTERRNO, - "%s Failed. sched_setparam()" - " returned %ld", testcases[i].desc, - TEST_RETURN); - } - } - } - - /* cleanup and exit */ - cleanup(); - - tst_exit(); - -} - -/* setup() - performs all ONE TIME setup for this test */ -void setup(void) +static void run(unsigned int n) { - tst_require_root(); + struct test_cases_t *tc = &tcases[n]; + struct sched_param p = { .sched_priority = tc->param }; - tst_sig(NOFORK, DEF_HANDLER, cleanup); + TST_EXP_PASS_SILENT(tst_sched_setscheduler(0, tc->policy, &p)); - TEST_PAUSE; + p.sched_priority = tc->priority; + TST_EXP_PASS_SILENT(tst_sched_setparam(0, &p)); -} + p.sched_priority = -1; + TST_EXP_PASS_SILENT(tst_sched_getparam(0, &p)); -/* - *cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ + if (p.sched_priority == tc->priority) + tst_res(TPASS, "got expected priority %d", p.sched_priority); + else + tst_res(TFAIL, "unexpected priority value %d, expected %d", + p.sched_priority, tc->priority); } -/* - * verify_priority() - This function checks whether the priority is - * set correctly - */ -int verify_priority(int i) -{ - struct sched_param p; - - if ((sched_getparam(0, &p)) == 0) { - if (p.sched_priority == testcases[i].priority) { - return 1; - } else { - tst_resm(TWARN, "sched_getparam() returned priority" - " value as %d", p.sched_priority); - return 0; - } - } - - tst_resm(TWARN, "sched_getparam() failed"); - return 0; -} +static struct tst_test test = { + .needs_root = 1, + .test = run, + .tcnt = ARRAY_SIZE(tcases), +}; From patchwork Tue Jul 20 13:33:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507549 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=otqw5geZ; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfpm2DN3z9sXb for ; Tue, 20 Jul 2021 23:35:12 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0127B3C81ED for ; Tue, 20 Jul 2021 15:35:10 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id C28D93C81A7 for ; Tue, 20 Jul 2021 15:34:11 +0200 (CEST) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 164D31400DB3 for ; Tue, 20 Jul 2021 15:34:11 +0200 (CEST) Received: by mail-lf1-x134.google.com with SMTP id u13so35777024lfs.11 for ; Tue, 20 Jul 2021 06:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qsrcqaTW8fK4GyLWda+HZMSa4Bo8YKqm6Izoh3j/TCE=; b=otqw5geZBgJheN/NqRmCXULgDe6yg7pZBO0qHfpeASpm1Lo0xRPvZdrJNz4ZU7os4T naJZSK/8/8IGxYPgLdrhG2ccATmDt/EmXV0Sy23n6e2OmTCCvRm8ESONnT9iu7l2rpjS N2s2uRQbWFnwrQCR+9iKnjDRexxyp4+eMEAwMF3dCjb5kamGlVzVvm6+BSakbLIiVukI 2hvIFx6Qlwh7sa9GiEWkNHEsYI8vSTHmC/mZPQwdnkVzw1eBnltsypY5G/K7x7ElpJ73 nRjxA1e5yW1AX4lCDOEzgUXCJEMRMQ7CT8EFU15TuvpQZUyDHmfg/GXqbeO0eEOEmQjc 6BDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qsrcqaTW8fK4GyLWda+HZMSa4Bo8YKqm6Izoh3j/TCE=; b=hcxWhkiXXVEYL/hQR8z5Bt/ruqLeG2wihHGj+MV1Oe2b9/VUMtKw8Ty5Bym6R9+Unw bQ4Otoz8Of6q4AnKQ8eas+hOm30RQVsppF478ZXxhsaNBxSc64N3LKnQMtvR9XFMBjda Pw1uv+8AxrvRMyXcif1Q14P+pKZI29a6UT4+sqTlxYXlgKpUFjqSQfhU+zExAmgOM39N S0tyyjRhspmDJmBUtDoiY3cPGEUhLqu1oVT9jMoQXEEI3p4DEWJv1oBQKgTJnl/KapZe Jg/QpJC6uMl28Kb9cUgknIm0e/+Oll0saAVKkd7+zZr9/1E+ZbMLzLjDWz6opw2+I1h5 KVaw== X-Gm-Message-State: AOAM5322lSAAmz2cMah8e8inuwYAaqUXl9RBwyvD1Gqame5LMloNitym lGHq5Q7CI+bFqXG/HAIXfxI6/UlWMPSn X-Google-Smtp-Source: ABdhPJzT1pU8FXT1p4woS8hypfuur1e45EZEFF81mDFgqoPkWEELJpt+fidgFDAKuVH8g6wiIDUd8Q== X-Received: by 2002:ac2:41c5:: with SMTP id d5mr22117294lfi.56.1626788050148; Tue, 20 Jul 2021 06:34:10 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:09 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:14 +0300 Message-Id: <20210720133324.21752-7-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 06/16] syscalls/sched_setparam03: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setparam/sched_setparam03.c | 215 ++++-------------- 1 file changed, 40 insertions(+), 175 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c index 252364e2e..e9571a9b1 100644 --- a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c +++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c @@ -1,196 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021, BELLSOFT. All rights reserved. * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * + * AUTHOR: Saji Kumar.V.R */ -/********************************************************** - * - * TEST IDENTIFIER : sched_setparam03 - * - * EXECUTED BY : root / superuser - * - * TEST TITLE : Checks functionality for sched_setparam(2) for pid!=0 - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Saji Kumar.V.R - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * DESCRIPTION - * This test forks a child & changes its parent's scheduling priority - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * Change scheduling policy to SCHED_FIFO - * - * Test: - * Loop if the proper options are given. - * Fork a child - * - * CHILD: - * Changes scheduling priority for parent - * - * PARENT: - * If scheduling priority is set properly, - * TEST passed - * else - * TEST failed - * - * Cleanup: - * Print errno log and/or timing stats if options given + +/*\ + * [Description] * - * USAGE: - * sched_setparam03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -h : Show help screen - * -f : Turn off functional testing - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -p : Pause for SIGUSR1 before starting - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Checks functionality for sched_setparam(2) for pid != 0 * - ****************************************************************/ - -#include -#include -#include -#include -#include "test.h" - -#define NEW_PRIORITY 5 - -static void setup(); -static void cleanup(); -static int verify_priority(); + * This test forks a child and changes its parent's scheduling priority. + */ -char *TCID = "sched_setparam03"; -int TST_TOTAL = 1; +#include -static struct sched_param param = { NEW_PRIORITY }; +#include "tst_test.h" +#include "tst_sched.h" -int main(int ac, char **av) +static void run(void) { - - int lc; - int status; + struct sched_param p5 = { .sched_priority = 5 }; + struct sched_param p; pid_t child_pid; - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; + child_pid = SAFE_FORK(); - switch (child_pid = FORK_OR_VFORK()) { - - case -1: - /* fork() failed */ - tst_resm(TFAIL, "fork() failed"); - continue; - - case 0: - /* Child */ - - /* - * Call sched_setparam(2) with pid = getppid() so that - * it will set the scheduling parameters for parent - * process - */ - TEST(sched_setparam(getppid(), ¶m)); - - if (TEST_RETURN == -1) { - err(0, "sched_setparam returned %ld", - TEST_RETURN); - } - exit(1); - - default: - /* Parent */ - if ((waitpid(child_pid, &status, 0)) < 0) { - tst_resm(TFAIL, "wait() failed"); - continue; - } - - /* - * Verify that parent's scheduling priority has - * changed. - */ - if ((WIFEXITED(status)) && (WEXITSTATUS(status)) && - (verify_priority())) { - tst_resm(TPASS, "Test Passed"); - } else { - tst_resm(TFAIL, "Test Failed"); - } - } + if (!child_pid) { + /* + * Call sched_setparam(2) with pid = getppid() so that + * it will set the scheduling parameters for parent + * process + */ + TST_EXP_PASS_SILENT(tst_sched_setparam(getppid(), &p5)); + exit(0); } + tst_reap_children(); + + TST_EXP_PASS_SILENT(tst_sched_getparam(0, &p)); - cleanup(); - tst_exit(); + if (p.sched_priority == p5.sched_priority) + tst_res(TPASS, "got expected priority %d", p.sched_priority); + else + tst_res(TFAIL, "got priority %d, expected %d", + p.sched_priority, p5.sched_priority); } -/* setup() - performs all ONE TIME setup for this test */ void setup(void) { - struct sched_param p = { 1 }; - - tst_require_root(); - - tst_sig(FORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; - - /* Change scheduling policy to SCHED_FIFO */ - if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1) { - tst_brkm(TBROK, cleanup, "sched_setscheduler() failed"); - } + struct sched_param p = { .sched_priority = 1 }; + TST_EXP_PASS_SILENT(tst_sched_setscheduler(0, SCHED_FIFO, &p)); } -/* - *cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ -} - -/* - * verify_priority() - This function checks whether the priority is - * set correctly - */ -int verify_priority(void) -{ - struct sched_param p; - - if ((sched_getparam(0, &p)) == 0) { - if (p.sched_priority == NEW_PRIORITY) { - return 1; - } else { - tst_resm(TWARN, "sched_getparam() returned priority" - " value as %d", p.sched_priority); - return 0; - } - } - - tst_resm(TWARN, "sched_getparam() failed"); - return 0; -} +static struct tst_test test = { + .forks_child = 1, + .needs_root = 1, + .setup = setup, + .test_all = run, +}; From patchwork Tue Jul 20 13:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=K/rjn+5n; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfq423dsz9sWq for ; Tue, 20 Jul 2021 23:35:24 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 025203C981B for ; Tue, 20 Jul 2021 15:35:22 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3EB813C981A for ; Tue, 20 Jul 2021 15:34:12 +0200 (CEST) Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 968921400DC8 for ; Tue, 20 Jul 2021 15:34:11 +0200 (CEST) Received: by mail-lf1-x135.google.com with SMTP id y42so35830561lfa.3 for ; Tue, 20 Jul 2021 06:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c78qejh+gOT9Pfpv0jV9lSIrgm4wrQXr+wgQYVJXJVo=; b=K/rjn+5nYKksWVN6Jy2/v39QoUoY5IMJuBm0Kvy0aGVnyh6VDylmd2E7L4LFiwtbiB rUmwEZas/VYG8R4HVLVabIiL+RFBFAizpf3EzqRiUNRRJP67hSD5V85EW8wGf+F1NFpM OtWUEAAr0a1qa540NGbLE6BQ4Buo4698jJzSc2EAL7+4hmyGdSOiZIg9wpYGlpLB/uur Ol+oALdeNN+gJE65RdmE66OiPlhttSinh4OhpjTLz+Iuj+0Cp+dZcQtFN7IIe7EzVuuN PPMqIpe34BpF+zbIjS4S4cYneTmwApaPdEXoPHbrmfvf3JDCIcTYc0vspvbYZpEa1qV9 XdYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c78qejh+gOT9Pfpv0jV9lSIrgm4wrQXr+wgQYVJXJVo=; b=futZhkCFxi8W37bcnf7lzvYU3r+yWJco8TcYm/oh5o3+BNPwIWX2Z3Ezzh+LuGqskH 0EqmRc+jYdKnj7nA0iRtprx2q972nO1mtUvkSuKLmOT7nVyDaaMNk0OzUDH7MfuA8jQn XurKO7V7VwGSW8JngyLguxLkgI6ccNFFLEFTg6QTcH+sdbeecVLCJRmJyVU7ghnWzQk3 l+c1XW9J8gQfvUzEoOjgJaEmf9GP0MYyYEixQmD1+XnGNX2d4zbXUs3MNVUT4UB88bWO fIljvEXtr9PG5pII6lisk2J9kfsDLsFdmV9xYY8kREXVoZ/b85ZZduysnTpvl9y/CTZs 6a0w== X-Gm-Message-State: AOAM530xhnhFPSnxCa4+1n+yAUMZpG4dGQLUijXMYBG1MuNTX4wa0gKO kfOrH3QObBsZFy/iyAV76kPitoZKmrCn X-Google-Smtp-Source: ABdhPJw3VHDpVm4hAGdrjwQ+ZSWC67YIk3fEdDJKaoMcsGk58lE3O2vAHxv5ZzYQy2ntNIh/8tdSZw== X-Received: by 2002:ac2:57c5:: with SMTP id k5mr22419476lfo.72.1626788050859; Tue, 20 Jul 2021 06:34:10 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:10 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:15 +0300 Message-Id: <20210720133324.21752-8-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 07/16] syscalls/sched_setparam04: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setparam/sched_setparam04.c | 161 ++++-------------- 1 file changed, 30 insertions(+), 131 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c index f6e017d3d..d80fd0d2a 100644 --- a/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c +++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c @@ -1,34 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021, BELLSOFT. All rights reserved. * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * AUTHOR: Saji Kumar.V.R */ - /******************************************************************* - * - * TEST IDENTIFIER : sched_setparam04 - * - * EXECUTED BY : anyone - * - * TEST TITLE : testing error conditions for sched_setparam(2) - * - * TEST CASE TOTAL : 4 - * - * AUTHOR : Saji Kumar.V.R + +/*\ + * [Description] * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). + * Testing error conditions for sched_setparam(2) * * DESCRIPTION * Verify that, @@ -41,129 +21,48 @@ * 4) sched_setparam(2) returns -1 sets errno to EINVAL if the * value for p.sched_priority is other than 0 for scheduling * policy, SCHED_OTHER - * - * ALGORITHM - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Execute system call - * Check return code, if (system call failed (return=-1)) & - * (errno set == expected errno) - * Issue sys call fails with expected return value and errno. - * Otherwise, - * Issue sys call returns unexpected value. - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * USAGE: - * sched_setparam04 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -h : Show help screen - * -f : Turn off functional testing - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -p : Pause for SIGUSR1 before starting - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - *********************************************************************/ - -#include -#include -#include -#include "test.h" + */ -static void cleanup(void); -static void setup(void); +#include -static struct sched_param param = { 0 }; -static struct sched_param param1 = { 1 }; +#include "tst_test.h" +#include "tst_sched.h" -char *TCID = "sched_setparam04"; +static struct sched_param p = { .sched_priority = 0 }; +static struct sched_param p1 = { .sched_priority = 1 }; static pid_t unused_pid; static pid_t inval_pid = -1; static pid_t zero_pid; -static struct test_case_t { +static struct test_cases_t { char *desc; pid_t *pid; struct sched_param *p; int exp_errno; - char err_desc[10]; -} test_cases[] = { +} tcases[] = { { - "test with non-existing pid", &unused_pid, ¶m, ESRCH, "ESRCH"}, { - "test invalid pid value", &inval_pid, ¶m, EINVAL, "EINVAL"}, { - "test with invalid address for p", &zero_pid, NULL, EINVAL, "EINVAL"}, { - "test with invalid p.sched_priority", &zero_pid, ¶m1, EINVAL, - "EINVAL"} + "test with non-existing pid", &unused_pid, &p, ESRCH}, { + "test invalid pid value", &inval_pid, &p, EINVAL,}, { + "test with invalid address for p", &zero_pid, NULL, EINVAL}, { + "test with invalid p.sched_priority", &zero_pid, &p1, EINVAL} }; -int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]); - -int main(int ac, char **av) +static void setup(void) { - int lc, ind; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); /* global setup */ - - /* The following loop checks looping state if -i option given */ - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset tst_count in case we are looping */ - tst_count = 0; - - for (ind = 0; ind < TST_TOTAL; ind++) { - /* - * call the system call with the TEST() macro - */ - TEST(sched_setparam(*(test_cases[ind].pid), - test_cases[ind].p)); - - if ((TEST_RETURN == -1) && - (TEST_ERRNO == test_cases[ind].exp_errno)) { - tst_resm(TPASS, "expected failure; Got %s", - test_cases[ind].err_desc); - } else { - tst_resm(TFAIL, "Call failed to produce " - "expected error; Expected errno: %d " - "Got : %d, %s", - test_cases[ind].exp_errno, - TEST_ERRNO, strerror(TEST_ERRNO)); - } - } - } - - cleanup(); - - tst_exit(); + unused_pid = tst_get_unused_pid(); } -/* - * setup() - performs all the ONE TIME setup for this test. - */ -void setup(void) +static void run(unsigned int n) { - unused_pid = tst_get_unused_pid(cleanup); - - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; + struct test_cases_t *tc = &tcases[n]; + TST_EXP_FAIL(tst_sched_setparam(*tc->pid, tc->p), tc->exp_errno, + "%s", tc->desc); } -/* - * cleanup() - performs all the ONE TIME cleanup for this test at completion - * or premature exit. - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .setup = setup, + .test = run, + .tcnt = ARRAY_SIZE(tcases), +}; From patchwork Tue Jul 20 13:33:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=2IrdyKzy; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfqM13L3z9sf9 for ; Tue, 20 Jul 2021 23:35:42 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CB13E3C9824 for ; Tue, 20 Jul 2021 15:35:39 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 2D2163C981A for ; Tue, 20 Jul 2021 15:34:12 +0200 (CEST) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 29E0B1A00CA3 for ; Tue, 20 Jul 2021 15:34:12 +0200 (CEST) Received: by mail-lj1-x234.google.com with SMTP id r16so31070418ljk.9 for ; Tue, 20 Jul 2021 06:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R4ZsajDHjosqWgJmpXSvQ67041FpaVQeb0v/na85pJw=; b=2IrdyKzyaq6S0wrebMilZ/DaKlqKRYmNYYHlMRTb1/uu95WJPS6qb18I+0riY6Dtj8 cDND8fUXLDT6xMFZO3YLuOqc/QhHMjMBfsjCxbBBwd2xzLQh719+73QtiniScGOjjts3 KDZ2BohIwR1RNSL3sxaDyEk65a2fsHkTWUrJYZHqBFNiCkBduZFwjojJipGR9k4aqgtC wirDwOLfDsORklzDGSPjoWJEIKKh1Df5i0tFRGO+To+AYKJVYpksB/fp9ujW8lfJVd9k soSFyC+9V7mLgXCV6GYiBNLdhty+RZlZo/3VTM8ZxQTFnyGvppQOF7AkF4f+crDtOvts /0jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R4ZsajDHjosqWgJmpXSvQ67041FpaVQeb0v/na85pJw=; b=dEKPnzLQjWND1MX4pmOEK7p/mHDotlLlhxsvJwwcFfNZp7HiC+qdo920yk52lDqvYl +yQ/czgMMhrtD7MiEItPUAhm8xBGcn3ivueMvb5ytp9onIVeshzHRMYGiSYj6sK7lW6N up8Kd+8Ziz3KIVe19Zu6iFoAeC/G8mXUBHlpjKbeX8LG7hhBrem76xYcC2VZXly2m36d xz89ewVq7mSGCoY6U4fs9FF2lV6WV57OBfibmYSSwAjA65PTzMBQhU0HuVCea277S1VA m84cDF+3Tc1t6odtxrFEXJjzaUucm6nRaZvusyhXl1f/Ta+lfk9/LX7HbM151RONgGh9 FGGw== X-Gm-Message-State: AOAM533h7aphuhB3ZQi00RmNBL22VzpHRitqrWNidY6rHB14co0MXW3j fKlcx/rpsZ6m+4UwCyB9YULc2mb8Enfx X-Google-Smtp-Source: ABdhPJynz4Sh7i5Kgpv922rOZPJ+OG7HEnkSOcR5e4hhSwB+weH3T6WbFT9VaOsjALcSKdANG7Ux1A== X-Received: by 2002:a2e:9b02:: with SMTP id u2mr27362615lji.111.1626788051432; Tue, 20 Jul 2021 06:34:11 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:11 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:16 +0300 Message-Id: <20210720133324.21752-9-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 08/16] syscalls/sched_setparam05: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setparam/sched_setparam05.c | 186 +++--------------- 1 file changed, 26 insertions(+), 160 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c index 53db641d7..36d7c4123 100644 --- a/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c +++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c @@ -1,176 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2021, BELLSOFT. All rights reserved. * Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * + * AUTHOR: Saji Kumar.V.R */ -/********************************************************** - * - * TEST IDENTIFIER : sched_setparam05 - * - * EXECUTED BY : root/superuser - * - * TEST TITLE : verify that sched_setparam() fails if the user does - * not have proper privilages - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Saji Kumar.V.R - * - * SIGNALS - * Uses SIGUSR1 to pause before test if option set. - * (See the parse_opts(3) man page). - * - * DESCRIPTION - * Verify that sched_setparam() fails if the user does - * not have proper privilages - * - * Setup: - * Setup signal handling. - * Pause for SIGUSR1 if option specified. - * - * Test: - * Loop if the proper options are given. - * Fork a child - * - * CHILD: - * Changes euid to "nobody" user. - * Try to Change scheduling priority for parent - * If call failed with errno = EPERM, - * Test passed - * else - * Test failed - * - * PARENT: - * wait for child to finish - * - * Cleanup: - * Print errno log and/or timing stats if options given - * - * USAGE: - * sched_setparam05 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -h : Show help screen - * -f : Turn off functional testing - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -p : Pause for SIGUSR1 before starting - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + +/*\ + * [Description] * - ****************************************************************/ + * Verify that sched_setparam() fails if the user does not have proper + * privileges. + */ -#include -#include +#include #include -#include -#include "test.h" - -static void setup(); -static void cleanup(); - -char *TCID = "sched_setparam05"; -int TST_TOTAL = 1; - -static struct sched_param param = { 0 }; -static char nobody_uid[] = "nobody"; -struct passwd *ltpuser; +#include "tst_test.h" +#include "tst_sched.h" -int main(int ac, char **av) +static void run(void) { + pid_t child_pid = SAFE_FORK(); - int lc; - int status; - pid_t child_pid; + if (!child_pid) { + struct sched_param p = { .sched_priority = 0 }; + struct passwd *pw = SAFE_GETPWNAM("nobody"); - tst_parse_opts(ac, av, NULL, NULL); + SAFE_SETEUID(pw->pw_uid); + TST_EXP_FAIL(tst_sched_setparam(getppid(), &p), EPERM); - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - switch (child_pid = FORK_OR_VFORK()) { - - case -1: - /* fork() failed */ - tst_resm(TFAIL, "fork() failed"); - continue; - - case 0: - /* Child */ - - /* Switch to nobody user */ - if ((ltpuser = getpwnam(nobody_uid)) == NULL) { - tst_brkm(TBROK, NULL, "'%s' user not present", nobody_uid); - } - if (seteuid(ltpuser->pw_uid) == -1) { - tst_resm(TWARN, "seteuid failed to to set the effective uid to %d", - ltpuser->pw_uid); - exit(1); - } - - /* - * Call sched_setparam(2) with pid = getppid() - */ - TEST(sched_setparam(getppid(), ¶m)); - - if ((TEST_RETURN == -1) && (TEST_ERRNO == EPERM)) { - exit(0); - } - - tst_resm(TWARN | TTERRNO, - "Test failed, sched_setparam()" - " returned : %ld", TEST_RETURN); - exit(1); - - default: - /* Parent */ - if ((waitpid(child_pid, &status, 0)) < 0) { - tst_resm(TFAIL, "wait() failed"); - continue; - } - if ((WIFEXITED(status)) && (WEXITSTATUS(status) == 0)) { - tst_resm(TPASS, "Test passed, Got EPERM"); - } else { - tst_resm(TFAIL, "Test Failed"); - } - } + exit(0); } - cleanup(); - tst_exit(); + tst_reap_children(); } -/* setup() - performs all ONE TIME setup for this test */ -void setup(void) -{ - - tst_require_root(); - - tst_sig(FORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; - -} - -/* - *cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ -} +static struct tst_test test = { + .needs_root = 1, + .forks_child = 1, + .test_all = run, +}; From patchwork Tue Jul 20 13:33:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=XU7REYzD; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfq9685Nz9sRK for ; Tue, 20 Jul 2021 23:35:33 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 311643C2B48 for ; Tue, 20 Jul 2021 15:35:31 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 1C9653C81AF for ; Tue, 20 Jul 2021 15:34:13 +0200 (CEST) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id B61CD1400DB3 for ; Tue, 20 Jul 2021 15:34:12 +0200 (CEST) Received: by mail-lj1-x22b.google.com with SMTP id d17so10983414ljq.12 for ; Tue, 20 Jul 2021 06:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5NthYpTcRT+hLGYLqBwN7n6Wn1VZFcSbaOqQ22RkvvQ=; b=XU7REYzDk37WI6AObv8Tpnqj/lAl8WrxqLRYo33FA5trnHe/CQduxN26YpKCubK/mg 4ENmbOBP9P4IJad0+8+7Bm8k954Y8HzgfJkgM4UMeI+RM9mXlAri+pSEKlctwob3pI/w hxyAYijyBMgvxlwzbFupqFwjEwy2wOehRM0yPMjQSjLPhocUQjdVqBGuq7yads6UDWGD aNJ2Wm5xAkzf/3MOEPs4+pi2VdSbbKc2A321vuUR+Ir7Rq1dDvCTEF74WfSUXBEA9307 UqIAsYlAznDLjPtXVVhwtEiG8u0U96KLpqMryjmubUgH0t57eu5Udlm+SvfnLUwue8PY b5ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5NthYpTcRT+hLGYLqBwN7n6Wn1VZFcSbaOqQ22RkvvQ=; b=t/CFeYBJIXeZAEX2ACDV0mobYsMYy8GNUUq5RVcvY6I7fSzBEttZqtRjbV+fnWt+a2 WQRD/tEhGl3q+CcqW83Yij9XjD0LqPpfStK5St4YzkJNQb9Y/1+452YPmCWZUv+mvvak jT3yIDSoNzBVSLu5kXndCaIVClW8w5AhmhexG80eAZJSNoF8V4E9Np7LcT9JPK3OQbin UbtzLpyhRq/ninFLvZIfV4rJSneWoQg1j4Ki9kdLRk239P6N5xfLDf7Z1MC92r5lwdQt JjKm2ThRKh18T+bHhHejuKSqTK1gufgIzg0Men1FGQ+QBnE1IVzx3TA38rQfxGDlNKQF iaYg== X-Gm-Message-State: AOAM530GHOGlThsaMlOjc+mPMr6gpHORNMmT1VTT0GUNOcFhqDPPa7a6 raLlnj4522qgf6azD2/RysMWz4Y1DHJB X-Google-Smtp-Source: ABdhPJwy/oo09VO26XGVCxzP5dmPoeEBga7EHyyYHTxKvTHb/Hvr0+AGLKzBv4u2X8jZhUOsJeZ5bw== X-Received: by 2002:a05:651c:1127:: with SMTP id e7mr23917414ljo.384.1626788052056; Tue, 20 Jul 2021 06:34:12 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:11 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:17 +0300 Message-Id: <20210720133324.21752-10-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 09/16] syscalls/sched_rr_get_interval01: use tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../syscalls/sched_rr_get_interval/sched_rr_get_interval01.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c index 5da5fe51d..cd6525414 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c @@ -11,9 +11,9 @@ * timeslice tuning knob in milliseconds"). */ -#include #include "time64_variants.h" #include "tst_timer.h" +#include "tst_sched.h" #define PROC_SCHED_RR_TIMESLICE_MS "/proc/sys/kernel/sched_rr_timeslice_ms" static int proc_flag; @@ -41,7 +41,7 @@ static void setup(void) tp.type = tv->ts_type; - if ((sched_setscheduler(0, SCHED_RR, &p)) == -1) + if ((tst_sched_setscheduler(0, SCHED_RR, &p)) == -1) tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); proc_flag = !access(PROC_SCHED_RR_TIMESLICE_MS, F_OK); From patchwork Tue Jul 20 13:33:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=PiIrsHdn; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfqX4rzyz9sX3 for ; Tue, 20 Jul 2021 23:35:52 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 23A8E3C81AC for ; Tue, 20 Jul 2021 15:35:50 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9D07C3C981A for ; Tue, 20 Jul 2021 15:34:13 +0200 (CEST) Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 4AF991A00CA3 for ; Tue, 20 Jul 2021 15:34:13 +0200 (CEST) Received: by mail-lf1-x12d.google.com with SMTP id f30so35868092lfj.1 for ; Tue, 20 Jul 2021 06:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NbjHO/xb9tiWsBFGDvnaccEEaWL3lIJ5USEhY8+GywY=; b=PiIrsHdnQ25vDP3O89F7gVC6vTDd+S/Hz3zjMK+AeCxg0UHY2Ev2BzZk3ttTMdWITR PVYCVJr8RZ6mJwammKQq+OsHLAUkvLeOjrXaLLTE7Pl+sf+HFS33GRjZoMZjVGJ4BqSD zF60ApC0qyDZydBOzrqsbp07SAuuBLHdhN0k05eXCkEEslMf8F1h8UOQgXxw/EjgPsPg wnz3eQUlwJ7Mbfd1PNsEDmBPILVmBPBWBTuca6H47vpSJGSkDTi++dkZZX01JtI7JULN u+NPQWj3lx6YrA5O44j0HgVSLfLMFoRHqiIDmq4G4uyKuBDns4utXtn9+Px2c6OHuQAw 8N5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NbjHO/xb9tiWsBFGDvnaccEEaWL3lIJ5USEhY8+GywY=; b=DnJntMqHZkxx7CO8SYpd3XaLstsCJYkiX1wcdZXrkkZGcvJU8h1oF1nmbv6ZmlE0EY gP+WSpFxxnxUqYlrUlNF8S9D7mX+qkmu2LmZUVnvI+zq3zdjO8KazHLIl6FXw5n33/Yu SVjBedqj8y+ssnbeN5oEvNRAscVadsg7H4nqjiEqGIALwreAcStXOSYd62lsJsGHpe7U PETwsc0gL1eiLmtQ4+2vFo3N8GodY7HTAJNeK4GTVeR0lQpFsrTnEQmzigoizqaRU4va 2XwCVLWczynZLzwfxiLxN0epgDnLdvoS1ybuemGoMawnRnbJ7PGDsvPUrUbwrv2vdNj5 4psw== X-Gm-Message-State: AOAM533Gd4VLVi0chhe9YUpkjHCzpvYeZtZouV0Gktwo5kZg7tuumlAp ShMmRpf5tnYMcFOxGIivw26Gc4TCNDHg X-Google-Smtp-Source: ABdhPJzFEdsTMqdhRQ7KNSmVU78Gbxf7QU82WzCeIV5Iq1Zf+c+/uDEnlmS4d000cq7OjZyWOD89uQ== X-Received: by 2002:a05:6512:34d0:: with SMTP id w16mr21500313lfr.293.1626788052596; Tue, 20 Jul 2021 06:34:12 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:12 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:18 +0300 Message-Id: <20210720133324.21752-11-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 10/16] syscalls/sched_rr_get_interval02: use tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../syscalls/sched_rr_get_interval/sched_rr_get_interval02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c index 9a0b8673d..f84a58216 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c @@ -8,9 +8,9 @@ * for tv_sec & tv_nsec. */ -#include #include "time64_variants.h" #include "tst_timer.h" +#include "tst_sched.h" static struct tst_ts tp; @@ -35,7 +35,7 @@ static void setup(void) tp.type = tv->ts_type; - if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1) + if ((tst_sched_setscheduler(0, SCHED_FIFO, &p)) == -1) tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); } From patchwork Tue Jul 20 13:33:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=JM00Nzz/; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfqm6Fdsz9sX3 for ; Tue, 20 Jul 2021 23:36:01 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 157493C984E for ; Tue, 20 Jul 2021 15:35:59 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [IPv6:2001:4b78:1:20::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 9C3D83C980D for ; Tue, 20 Jul 2021 15:34:14 +0200 (CEST) Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 2C4FE1A00606 for ; Tue, 20 Jul 2021 15:34:14 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id h4so29825742ljo.6 for ; Tue, 20 Jul 2021 06:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8wghSgokIgsoenDqmhIYJGlPM4bTxzdhLTQIdDu95U4=; b=JM00Nzz/+6gEe5aTOcpeVIwCgM1Y/RspxW5Ei2L24Tu2aMCoYMw3d5/6rB8TjVYL37 1qhLjH/0TtDiRHdvnZSJDEsplERkM5eILsoYmJKdh6X3aC9h2LgR1XrL1HZE4lmLeDRM GnZSgijvRhwnVrya3q4nxTRtGUEfpBROgKasdDLgpjUQxk0kqX9ZZfbQI9fAPbUeSnDS MdeZsxuNVEz90pNERa1gug0x4noM6NrxmUoGsNDdQGQFgEia7+Dd9Z/oDDqPLrTmcROc H5az4eIxSd8SNPA1Ft6UilioZghdgQd5yqAE2s7uFRjvPdXUpucj3SvtVtZ3RPRX47Z7 xzLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8wghSgokIgsoenDqmhIYJGlPM4bTxzdhLTQIdDu95U4=; b=cqTA0sMFm8pyyn3yuHWW+2aVspxK5fuVSixWBvaCAaxqYIFO/Yr0q7WGwTp7GQTQw4 dOqguAHCuChnxZQpqIghAgL15vHfBEP7U0MfmVps5TMIQZWN18swqyWjwLOiZTQXbgkw mdjrjtpHm1I/pxhrj3QnDAugnbiHEaAS7q67SsoUnaQMpyM1YvjEZUgzAmbcapyzayXF QAsZeMiAYbbCIpF0q1v6um/T8gdTJf47grlSVTIeh9IVDKnVxn/nP+gqkHT4hnWvwOWt L+XKiJz+XnPiPnB31rSmvCWLpukRR6h8iejhIdA/9CYoIBT/wlrpr8vS563ShtivYtWL 8tsQ== X-Gm-Message-State: AOAM530OK3YOJelUl041VAZJaPTA+53cZK8Nl5zpsXfTn4Vm04HAO1fh 0mJXDF+OcNOIEgzeiubwz+pws77MeUf0 X-Google-Smtp-Source: ABdhPJxbevhWzqUOlbc5KZW6iRWMINJR5wz2ObXUVHOkvIiE1RJPHSLBFlvrm2HtvCZwoirPRCSEGA== X-Received: by 2002:a05:651c:329:: with SMTP id b9mr27160317ljp.116.1626788053197; Tue, 20 Jul 2021 06:34:13 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:12 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:19 +0300 Message-Id: <20210720133324.21752-12-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 11/16] syscalls/sched_rr_get_interval03: use tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../syscalls/sched_rr_get_interval/sched_rr_get_interval03.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c index a61541b8a..0a486670b 100644 --- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c +++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c @@ -12,9 +12,9 @@ * address specified as &tp is invalid */ -#include #include "time64_variants.h" #include "tst_timer.h" +#include "tst_sched.h" static pid_t unused_pid; static pid_t inval_pid = -1; @@ -55,7 +55,7 @@ static void setup(void) bad_addr = tst_get_bad_addr(NULL); tp.type = tv->ts_type; - if ((sched_setscheduler(0, SCHED_RR, &p)) == -1) + if ((tst_sched_setscheduler(0, SCHED_RR, &p)) == -1) tst_res(TFAIL | TERRNO, "sched_setscheduler() failed"); unused_pid = tst_get_unused_pid(); From patchwork Tue Jul 20 13:33:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=GN/pzb5K; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfqw6VB0z9sf9 for ; Tue, 20 Jul 2021 23:36:12 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 33A0A3C81ED for ; Tue, 20 Jul 2021 15:36:10 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 7BC7C3C9822 for ; Tue, 20 Jul 2021 15:34:15 +0200 (CEST) Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id D2F151400DCF for ; Tue, 20 Jul 2021 15:34:14 +0200 (CEST) Received: by mail-lf1-x133.google.com with SMTP id i5so35835784lfe.2 for ; Tue, 20 Jul 2021 06:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4WKEgax0+5xOFxrjq6WFQPDlyaBMTRi8XFPxSveJsuc=; b=GN/pzb5KOU+pZ/Aa1qzbHV52zb2WY/kMirUhC0yAK+HQ3tK5ft4NTPKuGfHwPzZCNF 69IOgFvVweRJ2Z3QGG17eTi0+oMnAqg0VrRPb5Gy21DCPV28o8tTGs6vm0kLH/iChacr PfkHS4WdHixjTQjHHw0VlPLJZpQldngGTVR76oPWhQF9H4y4Lx5kMcEj8lJvcRhEBCRi aNBwP7x7PwI6JmF3m/5iDYW1vV4yyDybfI+BKUNd3/o3moHxe3djTW862dysKnvzJnIT PdGeWuEvRfcCAifHsXyri7UCdXURlpMDiaFPSr3qlrdoMrtS+uNPHtwsvDS34NqeqH5Z yzJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4WKEgax0+5xOFxrjq6WFQPDlyaBMTRi8XFPxSveJsuc=; b=ubB7AbbLgOMudZLMbM2fET/whZc/sqWAReTdQUMXpR1ldrQEkUDT/JZLkJ0wXuHyZP BbknkDodu1SU+8Dfv417OdCH2eqCkGqKmx7Rf50D2vNXwDbHo0I7qE8klWP3b2QJ4/Y0 xNH7fVWJ3TnJO6n88/S8rxMQmdOhUxHEZobLn1S98AfJma7PkjuQ777uST0JIy/tIMKS YE3sDcgEwE93FBxlCeh5azsplbAflFDVbbczS3MB/GhtaO09+XgZwJygoK8i211cD8pi 0iBMb9hlPVezBA+RIH4f/NxFhq77qX1Xkm2v0fQNflsAr9DQnCZk2h4TA/U34CFmnvcH RBUQ== X-Gm-Message-State: AOAM531wjLc30H43MjWJtEZZLtVL9jLGj5XsezsWXT7rouIuIxo7gYSL r4DgohzGHMC5VxholRIk1vngcNgL/RqU X-Google-Smtp-Source: ABdhPJxMNFXNVht0hs+iU3nY11gTbRPBgGwlfuCWKP+VHgDAGP9iV8LCt9U+otMl9WXAV7XiTAA/kg== X-Received: by 2002:ac2:5d69:: with SMTP id h9mr21059941lft.603.1626788054075; Tue, 20 Jul 2021 06:34:14 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:13 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:20 +0300 Message-Id: <20210720133324.21752-13-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 12/16] syscalls/sched_setscheduler01: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setscheduler/sched_setscheduler01.c | 171 +++++------------- 1 file changed, 42 insertions(+), 129 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c index 1cbce15d0..2feaa60d5 100644 --- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c +++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c @@ -1,160 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (c) 2021, BELLSOFT. All rights reserved. + * Copyright (c) International Business Machines Corp., 2001 */ -/* - * NAME - * sched_setscheduler01.c - * - * DESCRIPTION - * Testcase to test whether sched_setscheduler(2) sets the errnos - * correctly. +/*\ + * [Description] * - * ALGORITHM - * 1. Call sched_setscheduler with an invalid pid, and expect - * ESRCH to be returned. - * 2. Call sched_setscheduler with an invalid scheduling policy, - * and expect EINVAL to be returned. - * 3. Call sched_setscheduler with an invalid "param" address, - * which lies outside the address space of the process, and expect - * EFAULT to be returned. - * 4. Call sched_setscheduler with an invalid priority value - * in "param" and expect EINVAL to be returned + * Testcase to test whether sched_setscheduler(2) sets the errnos + * correctly. * - * USAGE: - * sched_setscheduler01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * [Algorithm] * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * None + * 1. Call sched_setscheduler with an invalid pid, and expect + * ESRCH to be returned. + * 2. Call sched_setscheduler with an invalid scheduling policy, + * and expect EINVAL to be returned. + * 3. Call sched_setscheduler with an invalid "param" address, + * which lies outside the address space of the process, and expect + * EFAULT to be returned. + * 4.Call sched_setscheduler with an invalid priority value + * in "param" and expect EINVAL to be returned */ + #include #include -#include #include -#include "test.h" -#define SCHED_INVALID 99 - -char *TCID = "sched_setscheduler01"; +#include "tst_test.h" +#include "tst_sched.h" -struct sched_param param; -struct sched_param param1 = { 1 }; - -void setup(void); -void cleanup(void); +#define SCHED_INVALID 99 +static struct sched_param p; +static struct sched_param p1 = { .sched_priority = 1 }; static pid_t unused_pid; static pid_t init_pid = 1; static pid_t zero_pid; -struct test_case_t { +struct test_cases_t { pid_t *pid; int policy; struct sched_param *p; int error; -} TC[] = { +} tcases[] = { /* The pid is invalid - ESRCH */ - { - &unused_pid, SCHED_OTHER, ¶m, ESRCH}, - /* The policy is invalid - EINVAL */ - { - &init_pid, SCHED_INVALID, ¶m, EINVAL}, -#ifndef UCLINUX - /* Skip since uClinux does not implement memory protection */ - /* The param address is invalid - EFAULT */ - { - &init_pid, SCHED_OTHER, (struct sched_param *)-1, EFAULT}, -#endif - /* The priority value in param invalid - EINVAL */ - { - &zero_pid, SCHED_OTHER, ¶m1, EINVAL} + {&unused_pid, SCHED_OTHER, &p, ESRCH}, + /* The policy is invalid - EINVAL */ + {&init_pid, SCHED_INVALID, &p, EINVAL}, + /* The param address is invalid - EFAULT */ + {&init_pid, SCHED_OTHER, (struct sched_param *)-1, EFAULT}, + /* The priority value in param invalid - EINVAL */ + {&zero_pid, SCHED_OTHER, &p1, EINVAL} }; -int TST_TOTAL = ARRAY_SIZE(TC); - -int main(int ac, char **av) +static void setup(void) { - int lc; - - int i; - - tst_parse_opts(ac, av, NULL, NULL); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset tst_count in case we are looping */ - tst_count = 0; - - setup(); - - /* loop through the test cases */ - for (i = 0; i < TST_TOTAL; i++) { - - TEST(sched_setscheduler(*(TC[i].pid), TC[i].policy, - TC[i].p)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "call succeeded unexpectedly"); - continue; - } - - if (TEST_ERRNO == TC[i].error) { - tst_resm(TPASS, "expected failure - " - "errno = %d : %s", TEST_ERRNO, - strerror(TEST_ERRNO)); - } else { - tst_resm(TFAIL, "unexpected error - %d : %s - " - "expected %d", TEST_ERRNO, - strerror(TEST_ERRNO), TC[i].error); - } - } - } - cleanup(); - - tst_exit(); - + unused_pid = tst_get_unused_pid(); } -/* - * setup() - performs all ONE TIME setup for this test. - */ -void setup(void) +static void run(unsigned int n) { - unused_pid = tst_get_unused_pid(cleanup); - - tst_sig(NOFORK, DEF_HANDLER, cleanup); + struct test_cases_t *tc = &tcases[n]; - TEST_PAUSE; + TST_EXP_FAIL(tst_sched_setscheduler(*tc->pid, tc->policy, tc->p), tc->error); } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .setup = setup, + .tcnt = ARRAY_SIZE(tcases), + .test = run, +}; From patchwork Tue Jul 20 13:33:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=n2bpDZNH; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfr84Fvyz9sWq for ; Tue, 20 Jul 2021 23:36:24 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id A646C3C81AD for ; Tue, 20 Jul 2021 15:36:21 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3770F3C81AA for ; Tue, 20 Jul 2021 15:34:16 +0200 (CEST) Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id B79681A0071E for ; Tue, 20 Jul 2021 15:34:15 +0200 (CEST) Received: by mail-lj1-x230.google.com with SMTP id h4so29825858ljo.6 for ; Tue, 20 Jul 2021 06:34:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ibeGvSrLn7XPYRiXN7+68fcFqG9+CcHOcdJZkI1WCQA=; b=n2bpDZNHQUgmpqTUUiHxuV5W958GatVCMlG5wVf9jJE9LtamgMUlc3EP7J5xF/oStQ GDUx/hLU2gmi0ANM0iSqdIwfXZkjNBi8N02uTOrJiX9HWL9oNPIao3aZ4gymnkeFIRS2 mlO6+qQGk0ulUKcTxEhFCMUy6v5Vda+jiCeUFiyW54SREVgfjb9u8obscm0Qx/F1lzXG YM6jjY/ygepHb/krKhucCMqD8cNbDPSxLKm4WbM59l5I6rsqow1A30RKzxGgSXXcOcZ5 gzd+gn7LTqy2oemns318+TFoT6jx7a0YnOz7Sbmwcu0Ig1r/Rv8cMsjk9gVv0ZECKLlB hQTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ibeGvSrLn7XPYRiXN7+68fcFqG9+CcHOcdJZkI1WCQA=; b=bA9xVci5AwDNhDBEMMdsXITh/l2y4yKqLpn9sQiBlKQ5Io1NGq2D+7IohEUg2Z9Te/ ER+8skNcy5eRzR8cVIyH6j/qetSV5bexKatWRSRtI7E4ASPyk78m1K00GWLo4rqGV2eh u9LHqFiShPcmASin5Nr2hCZmuHgQ5QokBcBK88WMToZwqdIUQ2tdGUB3bjP2QvafWYpT ROmtPMjtxA6dD4WiCjhqcuE5DH7AxgJoZM1iJ8TtsQRpzaMtNRFapknSmNOVr8QwJL4h s+lqw8Al/vGI1XVIFMIfJc//O/cCqwFtm3BrGLs3puVcQAWXzEiBCziihtK17S2QVs+q Qg0w== X-Gm-Message-State: AOAM531wKW/SdsSmwb52mOKfb59/57ZAANCnLu6MaSF+sppxTtW7FmJw zkBjLIVoF1lWMjXwq/WorYDx6L95jGfU X-Google-Smtp-Source: ABdhPJz8ndYwzSShXoOyDxAlP5xcgMh6qBH1NX23fV1qpeHIjmusVd4pKSkJRVpLB6Pkajcs4ASDKg== X-Received: by 2002:a2e:a809:: with SMTP id l9mr26032511ljq.302.1626788055006; Tue, 20 Jul 2021 06:34:15 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:14 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:21 +0300 Message-Id: <20210720133324.21752-14-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-3.smtp.seeweb.it Subject: [LTP] [PATCH 13/16] syscalls/sched_setscheduler02: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_setscheduler/sched_setscheduler02.c | 154 ++++-------------- 1 file changed, 33 insertions(+), 121 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c index 36952d9cb..68afb05c9 100644 --- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c +++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c @@ -1,148 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (c) 2021, BELLSOFT. All rights reserved. + * Copyright (c) International Business Machines Corp., 2001 */ -/* - * NAME - * sched_setscheduler01.c +/*\ + * [Description] * - * DESCRIPTION - * Testcase to test whether sched_setscheduler(2) sets the errnos - * correctly. + * Testcase to test whether sched_setscheduler(2) sets the errnos + * correctly. * - * ALGORITHM - * 1. Call sched_setscheduler as a non-root uid, and expect EPERM - * to be returned. + * [Algorithm] * - * USAGE: - * sched_setscheduler02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Call sched_setscheduler as a non-root uid, and expect EPERM + * to be returned. * - * HISTORY - * 07/2001 Ported by Wayne Boyer - * - * RESTRICTIONS - * Must run test as root. */ -#include + +#include #include -#include #include #include -#include -#include "test.h" -#include "safe_macros.h" +#include "tst_test.h" +#include "tst_sched.h" #define SCHED_INVALID 99 #define INVALID_PID 999999 -char *TCID = "sched_setscheduler02"; -int TST_TOTAL = 1; - -void setup(void); -void cleanup(void); - static uid_t nobody_uid; -int main(int ac, char **av) +static void setup(void) { - int lc; - pid_t pid; - struct sched_param param; - int status; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - /* reset tst_count in case we are looping */ - tst_count = 0; - - if ((pid = FORK_OR_VFORK()) == -1) { - tst_brkm(TBROK, cleanup, "fork failed"); - } - - if (pid == 0) { /* child */ - param.sched_priority = 1; - - SAFE_SETEUID(cleanup, nobody_uid); - - TEST(sched_setscheduler(pid, SCHED_FIFO, ¶m)); - - if (TEST_ERRNO) { - } - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "sched_setscheduler(2) passed " - "with non root priveledges"); - } else if (TEST_ERRNO != EPERM) { - tst_resm(TFAIL, "Expected EPERM, got %d", - TEST_ERRNO); - } else { - tst_resm(TPASS, "got EPERM"); - } - } else { /* parent */ - /* let the child carry on */ - wait(&status); - if (WIFEXITED(status) != 0) { /* Exit with errors */ - exit(WEXITSTATUS(status)); - } else { - exit(0); - } - } - - SAFE_SETEUID(cleanup, 0); - } - cleanup(); - tst_exit(); + struct passwd *pw = SAFE_GETPWNAM("nobody"); + nobody_uid = pw->pw_uid; } -/* - * setup() - performs all ONE TIME setup for this test. - */ -void setup(void) +static void run(void) { - struct passwd *pw; - - tst_require_root(); + pid_t pid = SAFE_FORK(); - pw = SAFE_GETPWNAM(NULL, "nobody"); - nobody_uid = pw->pw_uid; - - tst_sig(FORK, DEF_HANDLER, cleanup); + if (!pid) { + struct sched_param p = { .sched_priority = 1 }; - TEST_PAUSE; + SAFE_SETEUID(nobody_uid); + TST_EXP_FAIL(tst_sched_setscheduler(0, SCHED_FIFO, &p), EPERM); + SAFE_SETEUID(0); + exit(0); + } + tst_reap_children(); } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .forks_child = 1, + .needs_root = 1, + .setup = setup, + .test_all = run, +}; From patchwork Tue Jul 20 13:33:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=PVwL0cgB; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfrK1hq1z9sXS for ; Tue, 20 Jul 2021 23:36:32 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id DA94D3C9832 for ; Tue, 20 Jul 2021 15:36:30 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [217.194.8.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id BBA083C81AA for ; Tue, 20 Jul 2021 15:34:16 +0200 (CEST) Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 5E4F6140020B for ; Tue, 20 Jul 2021 15:34:16 +0200 (CEST) Received: by mail-lj1-x230.google.com with SMTP id l11so15841428ljq.4 for ; Tue, 20 Jul 2021 06:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ms1QEP9seOQvhjSVxrQ7wEnWeIvfsByg0QiXLlu2/4c=; b=PVwL0cgBY9KFddx39D+8HZi69h/WSq7oqEY7Et8PEswCxu+m9GbuZ1egBVL6LRTaxN Y5PoKYtWckChhK8xJoC35FIGy4RC2nB37kgobcI8dUad6eZMdXjvSzlpAJGmEGER5oPH hgPAzdiMnahun0dJP3qlmB/A2bchpQ4pOSB6scLtWvcMmIzSWLojjJuIIvFvO/UWHzeZ 2DLNSNdyWfW+haxVQMcRATk1LbRMSX+qI4S9wIA4XfaFTFnrJ0+mVEzTpo9w7tAuPV06 21FQdDAcn2A891BjGSkWtkL7/zywotjbrZyGKR95sMaQM7FWPjyXvbha6Ay2lKSV5h5u 5Dbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ms1QEP9seOQvhjSVxrQ7wEnWeIvfsByg0QiXLlu2/4c=; b=D4mW/KUzmUyif9ifqUTKXK1EMhnbbs7xYGzCPULNk78YwPQmsxOVSAsMb62Zn2y05P Kx73PQsn9JgrfwhT4+nFSmMlmAs9KThe0wLq3lTuPsNiDoTuwfEwTxw6XKllDuYospkt HMPV2eKFoaJegvDEpLPvOzrYceFzo0MIMtEcyvZQiv640Q7ewab2qomaVoiHezQVThyI tHMLgq/OyYwR/Winr49LF37thCpPag0sGJcWyuRHX2Bk+eExnr7Rw5e6OyjA6n4L6nCQ 00f3+g0jgRNQNwZEZ/jKkgrPfNUVXti1ZqECHMGBS6NFPsrvQyTmB1uJ29yxK54j3PD8 FS5g== X-Gm-Message-State: AOAM533XMU35MhgwPUxBBQykzKAxr+q34FSFTub8MFIzRo+h7pVUkrZK f/oPE/Hvn9pKKvL1prJXoxFdOHpoTNNv X-Google-Smtp-Source: ABdhPJzoqYrT2ghV9ibcSEegRO0u9zLqjgvbtjOUFZyzZ0vD6Nq2TdgmW3b5Zdy2JwP4fuQaGORWCw== X-Received: by 2002:a2e:bf20:: with SMTP id c32mr26480699ljr.311.1626788055692; Tue, 20 Jul 2021 06:34:15 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:15 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:22 +0300 Message-Id: <20210720133324.21752-15-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 14/16] syscalls/sched_setscheduler03: use tst_sched_*() X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../syscalls/sched_setscheduler/sched_setscheduler03.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c index 9045d0366..af4b29300 100644 --- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c +++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c @@ -17,13 +17,13 @@ #include #include #include -#include #include #include #include #include #include "tst_test.h" +#include "tst_sched.h" #define RLIMIT_NICE_NORMAL 20 @@ -96,8 +96,8 @@ static void verify_fn(unsigned int i) "Verifying case[%d]: policy = %d, priority = %d", i + 1, cases[i].policy, cases[i].sched_param->sched_priority); - TEST(sched_setscheduler(*cases[i].pid, cases[i].policy, - cases[i].sched_param)); + TEST(tst_sched_setscheduler(*cases[i].pid, cases[i].policy, + cases[i].sched_param)); if (TST_RET) tst_res(TFAIL | TTERRNO, "case[%d] expected: %d, got: ", i + 1, cases[i].error); @@ -129,11 +129,11 @@ static void setup(void) l_rlimit_setup(RLIMIT_NICE, &limit); tst_res(TINFO, "Setting init sched policy to SCHED_OTHER"); - if (sched_setscheduler(0, SCHED_OTHER, ¶m[0]) != 0) + if (tst_sched_setscheduler(0, SCHED_OTHER, ¶m[0]) != 0) tst_res(TFAIL | TERRNO, "ERROR sched_setscheduler: (0, SCHED_OTHER, param)"); - if (sched_getscheduler(0) != SCHED_OTHER) + if (tst_sched_getscheduler(0) != SCHED_OTHER) tst_res(TFAIL | TERRNO, "ERROR sched_setscheduler"); tst_res(TINFO, "Setting euid to nobody to drop privilege"); From patchwork Tue Jul 20 13:33:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=1Qwnqx85; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfrV2kd2z9sWq for ; Tue, 20 Jul 2021 23:36:42 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 995E33C81A5 for ; Tue, 20 Jul 2021 15:36:39 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id ADDCD3C9806 for ; Tue, 20 Jul 2021 15:34:17 +0200 (CEST) Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id 14F571400B6A for ; Tue, 20 Jul 2021 15:34:17 +0200 (CEST) Received: by mail-lf1-x135.google.com with SMTP id f30so29247484lfv.10 for ; Tue, 20 Jul 2021 06:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SnChm5UJVlNzR3XaxFa38l+3WZx/806uiMkKjiJJAUc=; b=1Qwnqx85fZhriNrjvFxv+RypCMbvThtYd32ugA0sD2nDGL5IN7dJbWer2/fJvB/m70 NY77JftLMbYEsvlWAFpaEA0BdVKDQqDLHds6pGhlG3+UBL7UdqCYdXzlM+lgwlZ6uFoI dWVDtGy3dcsQ1yv8N6I3e1R2MvnUQSev4ta4CkHtXdICcap+p2FXIIDpaQ93PGD+qXXP tbY07VuLUY45oyVDgJ6sq/bOyd60m05Go8WzejoCB/qHcXyjFfUDw79DMXC7JxSE+UVH elofMb7cii7kg6sG/yrnrL3S+MtTeE7RE77bztH4Tqw8mUIVHgjwmYxCltv3KzihBha0 qJhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SnChm5UJVlNzR3XaxFa38l+3WZx/806uiMkKjiJJAUc=; b=alLJ6DDNwLK4mmLbgYVKMMnxI2ER3WI3RVMmUXj77VIv9aq+nt0Ne6W+PmMEMP4XiE bIxjGkNmwAl10myML2+6aur2KXxmkxlNpTWgobJhT/DV4Jw/FnTVj3Mb0YRaA+PEBme9 r1MStIUkeFm1hkMFOlY37qEj+cv3udnxPYyHNi/z78uTHx/Zw0dEwztpjyb1dENUp2wd oOredMrz1pKx9SfJHHdGdsk27lZd5+gnIFsh7Yw1EKVg0OCF/0x+fbHBprJH3iYths/d da2gd37yuenfv6zVxCk797ruHGIPYgcMJTKbYRD20us9epAl1yex5Bqm8VI7yU03/3VA FeGQ== X-Gm-Message-State: AOAM532kWqoI3kUxNuGedKMJxd/C3kY2QAxxl9hjGfnXRg2o/KqZTX6x +jCzStc8/W4g4lN4nRoplZ16UTxTI3EZ X-Google-Smtp-Source: ABdhPJyMshvZHI3JqGZ70/uPmUOMDir0DHk56rmAdiFJ8j8u07gHMUXmdfqcQazY+BIcv+67/aG00Q== X-Received: by 2002:ac2:4f92:: with SMTP id z18mr21267563lfs.343.1626788056325; Tue, 20 Jul 2021 06:34:16 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:16 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:23 +0300 Message-Id: <20210720133324.21752-16-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-6.smtp.seeweb.it Subject: [LTP] [PATCH 15/16] syscalls/sched_getscheduler01: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_getscheduler/sched_getscheduler01.c | 141 +++++------------- 1 file changed, 37 insertions(+), 104 deletions(-) diff --git a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c index f6bdf1a1b..e0da0510d 100644 --- a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c +++ b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c @@ -1,129 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (c) 2021, BELLSOFT. All rights reserved. + * Copyright (c) International Business Machines Corp., 2001 */ -/* - * NAME - * sched_getscheduler01.C +/*\ + * [Description] * - * DESCRIPTION - * Testcase to check sched_getscheduler() returns correct return value + * Testcase to check sched_getscheduler() returns correct return value. * - * ALGORTIHM - * Call sched_setcheduler() to set the scheduling policy of the current - * process. Then call sched_getscheduler() to ensure that this is same - * as what set by the previous call to sched_setscheduler(). + * [Algorithm] * - * Use SCHED_RR, SCHED_FIFO, SCHED_OTHER as the scheduling policies for - * sched_setscheduler(). + * Call sched_setcheduler() to set the scheduling policy of the current + * process. Then call sched_getscheduler() to ensure that this is same + * as what set by the previous call to sched_setscheduler(). * - * USAGE: - * sched_getscheduler01 [-c n] [-f] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -f : Turn off functionality Testing. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. + * Use SCHED_RR, SCHED_FIFO, SCHED_OTHER as the scheduling policies for + * sched_setscheduler(). * - * RESTRICTION - * Must run test as root. */ #include -#include #include -#include "test.h" - -char *TCID = "sched_getscheduler01"; -int TST_TOTAL = 3; -void setup(void); -void cleanup(void); +#include "tst_test.h" +#include "tst_sched.h" -struct test_case_t { - int prio; +struct test_cases_t { + int priority; int policy; -} TC[] = { - /* set scheduling policy to SCHED_RR */ - { - 1, SCHED_RR}, - /* set scheduling policy to SCHED_OTHER */ - { - 0, SCHED_OTHER}, - /* set scheduling policy to SCHED_FIFO */ - { - 1, SCHED_FIFO} +} tcases[] = { + {1, SCHED_RR}, + {0, SCHED_OTHER}, + {1, SCHED_FIFO} }; -int main(int ac, char **av) +static void run(unsigned int n) { - int lc; - int i; - struct sched_param param; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - for (i = 0; i < TST_TOTAL; i++) { + struct test_cases_t *tc = &tcases[n]; + struct sched_param p = { .sched_priority = tc->priority }; - param.sched_priority = TC[i].prio; + TST_EXP_PASS_SILENT(tst_sched_setscheduler(0, tc->policy, &p)); - if (sched_setscheduler(0, TC[i].policy, ¶m) == -1) - tst_brkm(TBROK, cleanup, - "sched_setscheduler failed"); + TEST(tst_sched_getscheduler(0)); - TEST(sched_getscheduler(0)); - - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "call failed unexpectedly"); - continue; - } - - if (TEST_RETURN != TC[i].policy) - tst_resm(TFAIL, - "policy value returned is not " - "correct"); - else - tst_resm(TPASS, - "policy value returned is correct"); - } + if (TST_RET == -1) { + tst_res(TFAIL, "sched_getscheduler() failed unexpectedly"); + return; } - cleanup(); - tst_exit(); + if (TST_RET == tc->policy) + tst_res(TPASS, "got expected policy %d", tc->policy); + else + tst_res(TFAIL, "got policy %ld, expected %d", TST_RET, tc->policy); } -void setup(void) -{ - - tst_require_root(); - - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; -} - -void cleanup(void) -{ -} +static struct tst_test test = { + .needs_root = 1, + .tcnt = ARRAY_SIZE(tcases), + .test = run, +}; From patchwork Tue Jul 20 13:33:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kodanev X-Patchwork-Id: 1507560 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bell-sw-com.20150623.gappssmtp.com header.i=@bell-sw-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=F4iE2qC7; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GTfrj24N7z9sRN for ; Tue, 20 Jul 2021 23:36:52 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 59B143C81A9 for ; Tue, 20 Jul 2021 15:36:50 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id 3E2283C9812 for ; Tue, 20 Jul 2021 15:34:18 +0200 (CEST) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id B38A72000BE for ; Tue, 20 Jul 2021 15:34:17 +0200 (CEST) Received: by mail-lj1-x22b.google.com with SMTP id r16so31070805ljk.9 for ; Tue, 20 Jul 2021 06:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell-sw-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D62JpQL7vLNHLXx0s6dDkyJyBLCWOkvqAB60Nf19B9A=; b=F4iE2qC7BiQBPvJW+eu2APw1TEAJ+2vLhO+G3IUlEsZlK7PujObNWHvRF3wkt+oE2R ApQOiLtqt+zSPrEPwKsNXJTdcllmx529jL4Q0zZACvv33cU1zsvLm4Autn5rFEEzpz8C 7wklEWVaddbDIaoug1tkho7Hx+15fDGrYE3gI+V361fOk+3EDqnKx6JmRJGzKPHbCl3p 7w0lNRBqARDq4ZF+hma+Fwa3FoJLY4pyBSIEiZvsVx6tOpjnyOe4lGleQ9xVitvobVrw EmN66wFzdu0tKsZrZAY2HXectGmyu3ER0W2Bdfld7AxJOSsmkdAfqa075sRbbE8qaASr OAPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D62JpQL7vLNHLXx0s6dDkyJyBLCWOkvqAB60Nf19B9A=; b=dVkpGeQ1atd/n1Xp72Rtbg4WlzQpRH9h0pPHLXtfaj+fHnt+QnPGm520DCcf9NFrSM sJXNRBEYzRNFhCxH3FsEDL5C+yRJx+/nPhyZEUfuebbZ68VX7Q2Rs39Xw7kSh5dzjH3V ngutMpQ/vKKmCtJLrjpgNQr6MO3HEBBIAEA6ak72doqN7fHWxJ2MwBgZvQ5CXr+/rtmq 0gQsAg/UBzJIhykJrR/AkkP1uViGwG+iZ+aq0ygCAfM22GdC/8/Qslag45GX1+oRc272 JCo0vbJKiJ7/+XCtdmIgG7R1o9K2pHY1tsY2BcQNjtcFgWNci0lNbUy9Z/PTQFEed+yH gFMw== X-Gm-Message-State: AOAM53059LUZ3sMi+G3vrijBPL82jWfUPiXgRKe/tGJiPxYR676iZTUz 0yQwUS6qxvKjfpK1a+roOB3t/B1jMzUp X-Google-Smtp-Source: ABdhPJyh+9HOQoJLxfI55IBIA2DL8fLDOcAhE+FfUCL4pMgDI95hwFAxD5gV/Jev93umN3OaVQEYaA== X-Received: by 2002:a2e:321a:: with SMTP id y26mr26484860ljy.463.1626788057026; Tue, 20 Jul 2021 06:34:17 -0700 (PDT) Received: from localhost.localdomain ([178.68.161.34]) by smtp.gmail.com with ESMTPSA id x16sm1526828lfa.244.2021.07.20.06.34.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jul 2021 06:34:16 -0700 (PDT) From: Alexey Kodanev To: ltp@lists.linux.it Date: Tue, 20 Jul 2021 16:33:24 +0300 Message-Id: <20210720133324.21752-17-aleksei.kodanev@bell-sw.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> References: <20210720133324.21752-1-aleksei.kodanev@bell-sw.com> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH 16/16] syscalls/sched_getscheduler02: convert to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Alexey Kodanev --- .../sched_getscheduler/sched_getscheduler02.c | 104 +++--------------- 1 file changed, 16 insertions(+), 88 deletions(-) diff --git a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c index c43240108..73c5f58db 100644 --- a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c +++ b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c @@ -1,106 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* - * - * Copyright (c) International Business Machines Corp., 2001 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Copyright (c) 2021, BELLSOFT. All rights reserved. + * Copyright (c) International Business Machines Corp., 2001 */ -/* - * NAME - * sched_getscheduler02.C - * - * DESCRIPTION - * To check for the errno ESRCH - * - * ALGORITHM - * Pass an invalid pid to sched_getscheduler() and test for ESRCH. +/*\ + * [Description] * - * USAGE: - * sched_getscheduler02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] - * where, -c n : Run n copies concurrently. - * -e : Turn on errno logging. - * -i n : Execute test n times. - * -I x : Execute test for x seconds. - * -P x : Pause for x seconds between iterations. - * -t : Turn on syscall timing. - * - * RESTRICTION - * None + * Pass an invalid pid to sched_getscheduler() and test for ESRCH. */ #include -#include #include -#include "test.h" -char *TCID = "sched_getscheduler02"; -int TST_TOTAL = 1; +#include "tst_test.h" +#include "tst_sched.h" static pid_t unused_pid; -void setup(void); -void cleanup(void); - -int main(int ac, char **av) +static void setup(void) { - int lc; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - /* reset tst_count in case we are looping */ - tst_count = 0; - - TEST(sched_getscheduler(unused_pid)); - - if (TEST_RETURN != -1) { - tst_resm(TFAIL, "sched_getscheduler(2) passed " - "unexpectedly"); - continue; - } - - if (errno != ESRCH) { - tst_resm(TFAIL, "Expected ESRCH, got %d", errno); - } else { - tst_resm(TPASS, "call failed with ESRCH"); - } - } - cleanup(); - tst_exit(); - + unused_pid = tst_get_unused_pid(); } -/* - * setup() - performs all ONE TIME setup for this test. - */ -void setup(void) +static void run(void) { - unused_pid = tst_get_unused_pid(cleanup); - - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; + TST_EXP_FAIL(tst_sched_getscheduler(unused_pid), ESRCH); } -/* - * cleanup() - performs all ONE TIME cleanup for this test at - * completion or premature exit. - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .setup = setup, + .test_all = run, +};