From patchwork Wed Aug 11 02:47:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sujiaxun X-Patchwork-Id: 1515550 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=) 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GkvQL5hzWz9sWl for ; Wed, 11 Aug 2021 12:48:25 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id D7E643C70CB for ; Wed, 11 Aug 2021 04:48:17 +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 73D233C70B7 for ; Wed, 11 Aug 2021 04:48:15 +0200 (CEST) Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 21C0120017A for ; Wed, 11 Aug 2021 04:48:13 +0200 (CEST) X-QQ-mid: bizesmtp36t1628650086ta5q8e59 Received: from localhost.localdomain (unknown [58.240.82.166]) by esmtp6.qq.com (ESMTP) with id ; Wed, 11 Aug 2021 10:48:01 +0800 (CST) X-QQ-SSF: 0140000000200020B000B00A0000000 X-QQ-FEAT: VGEHthcaPSRVwuZHFyO8RVdeeFDZ6tFmmVwietpmfsfrRQ6w0LHrHS9iOcBfm Rk2qAxZXYCF6JYJ3JZzHXsNYsaNW4JTId4gdkotSfoZqfw+L0nChiuRM+53HiDH6jYWmb77 5PSNqn65q6Zcimr6ilyHvUGbXmWvqJ25160g7NE3hDD3wOHa1APe6Jb1cxAeEgpz/1yYYHY YFFFdbZ9bGP3CQH93r+KbTfpxRy6A8lRgm+fbcUz40NFVoexpoXIYgJuu+UyP8JiMNBqHeb pLDta1b47zTi6MycsnpPbr8NoDrwyxd3387ThHRrxuy399taknqPM4VtaP10vPp2z7z1Jpx +rz4QYyrX6BOSEuaYK8gtAoRYlWSw== X-QQ-GoodBg: 2 From: sujiaxun To: ltp@lists.linux.it Date: Wed, 11 Aug 2021 10:47:59 +0800 Message-Id: <20210811024759.17858-1-sujiaxun@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign2 X-QQ-Bgrelay: 1 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,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] [v3, 1/6] syscalls/sysfs: Convert sysfs01 to the 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: , Cc: sujiaxun Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: sujiaxun --- testcases/kernel/syscalls/sysfs/sysfs01.c | 132 +++------------------- 1 file changed, 16 insertions(+), 116 deletions(-) -- 2.20.1 diff --git a/testcases/kernel/syscalls/sysfs/sysfs01.c b/testcases/kernel/syscalls/sysfs/sysfs01.c index 85052dc2b..a0c7e74f8 100644 --- a/testcases/kernel/syscalls/sysfs/sysfs01.c +++ b/testcases/kernel/syscalls/sysfs/sysfs01.c @@ -1,129 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * 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. - * */ -/************************************************************************** - * - * TEST IDENTIFIER : sysfs01 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sysfs(2) - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Aniruddha Marathe - * - * 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 sysfs(2) system call. - * This test is carried out for option 1 for sysfs(2). - * 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 - * - * USAGE: - * sysfs01 [-c n] [-e] [-i n] [-I x] [-p x] [-t] [-h] [-f] [-p] - * where: - * -c n : run n copies simultaneously. - * -e : Turn on errno logging. - * -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. - * - *RESTRICTIONS: - *There is no glibc or libc support - *Kernel should be compiled with proc filesystem support - ******************************************************************************/ + +/*\ + * [Description] + * This test is run for option 1 for sysfs(2). + * Translate the filesystem identifier string fsname into a filesystem type index. + */ #include #include #include -#include "test.h" +#include "tst_test.h" #include "lapi/syscalls.h" -static void setup(); -static void cleanup(); - -char *TCID = "sysfs01"; -int TST_TOTAL = 1; - -int main(int ac, char **av) +static void verify_sysfs01(void) { - int lc; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - /* option 1, buf holds fs name */ - TEST(ltp_syscall(__NR_sysfs, 1, "proc")); - - /* check return code */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "sysfs(2) Failed for " - "option 1 and set errno to %d", TEST_ERRNO); - } else { - tst_resm(TPASS, "sysfs(2) Passed for " "option 1"); - } - } /*End of TEST_LOOPING */ - - /*Clean up and exit */ - cleanup(); - tst_exit(); + /* option 1, buf holds fs name */ + TST_EXP_POSITIVE(tst_syscall(__NR_sysfs, 1, "proc"), "sysfs(1,'proc')"); + if (TST_PASS == 1) + tst_res(TPASS, "sysfs(2) Passed for option 1"); } -/* setup() - performs all ONE TIME setup for this test */ -void setup(void) -{ - - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; - -} - -/* - * cleanup() - Performs one time cleanup for this test at - * completion or premature exit - */ - -void cleanup(void) -{ - -} +static struct tst_test test = { + .test_all = verify_sysfs01, +}; From patchwork Wed Aug 11 02:48:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sujiaxun X-Patchwork-Id: 1515551 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=) 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 4GkvQV0Gwnz9s5R for ; Wed, 11 Aug 2021 12:48:33 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B2A663C70C9 for ; Wed, 11 Aug 2021 04:48:31 +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 66CFC3C70B7 for ; Wed, 11 Aug 2021 04:48:29 +0200 (CEST) Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 2ADBD1A0043E for ; Wed, 11 Aug 2021 04:48:27 +0200 (CEST) X-QQ-mid: bizesmtp47t1628650102trsqkrhe Received: from localhost.localdomain (unknown [58.240.82.166]) by esmtp6.qq.com (ESMTP) with id ; Wed, 11 Aug 2021 10:48:17 +0800 (CST) X-QQ-SSF: 0140000000200020B000B00A0000000 X-QQ-FEAT: K/9CJ3gdjnZq/ZZQX0q1jsl10ve+qFndOOxUgE1TKHDWLqFBl+9Y9Jq3gu2Q6 /MsujEEjAEguTOyUJTGxI6cAN0iABdTfl7BqWZHnCuNLp0q+2cCQJooh0AxUEHEcQvZvIOl 7wm5NV6xskFndyP6AE6WsyMtgR54weqPrFmEt8czAB8R/COHLslvQ68UlAABQj5p+qrHo7V 3WijKEhPBJI3kHte5dh9q/YCUgYKpyRU+HcSSgF/FXAHV5eM9JasEz7BOEKk0D2OpGjeSFb dWZXcETipZiHrBYLEHbl33wxZDsYga5B7FrpXgDEL654KBxSpzjO0JKf2r08ME58clGJFlo m+qKdUpw7yxSmrR0ZL6LLNDnHFrHw== X-QQ-GoodBg: 2 From: sujiaxun To: ltp@lists.linux.it Date: Wed, 11 Aug 2021 10:48:16 +0800 Message-Id: <20210811024816.18003-1-sujiaxun@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign5 X-QQ-Bgrelay: 1 X-Virus-Scanned: clamav-milter 0.102.4 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,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] [v3, 2/6] syscalls/sysfs: Convert sysfs02 to the 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: , Cc: sujiaxun Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: sujiaxun --- testcases/kernel/syscalls/sysfs/sysfs02.c | 130 +++------------------- 1 file changed, 17 insertions(+), 113 deletions(-) -- 2.20.1 diff --git a/testcases/kernel/syscalls/sysfs/sysfs02.c b/testcases/kernel/syscalls/sysfs/sysfs02.c index e9065dda7..53dc4186f 100644 --- a/testcases/kernel/syscalls/sysfs/sysfs02.c +++ b/testcases/kernel/syscalls/sysfs/sysfs02.c @@ -1,127 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * 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. - * */ -/************************************************************************** - * - * TEST IDENTIFIER : sysfs02 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sysfs(2) - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Aniruddha Marathe - * - * 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 sysfs(2) system call. - * It is intended to provide a limited exposure of the system call. - * This test is run for option 2 for sysfs(2) - * - * 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 - * - * USAGE: - * sysfs02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-t] [-p] [-f] - * where: - * -c n : run n copies simultaneously - * -e : Turn on errno logging. - * -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. - * - *RESTRICTIONS: - *There is no glibc or libc support - *****************************************************************************/ + +/*\ + * [Description] + * This test is run for option 2 for sysfs(2). + * Translate the filesystem type index fs_index into a null-terminated filesystem + * identifier string. This string will be written to the buffer pointed to by buf. + * Make sure that buf has enough space to accept the string. + */ #include #include #include -#include "test.h" +#include "tst_test.h" #include "lapi/syscalls.h" -static void setup(); -static void cleanup(); - -char *TCID = "sysfs02"; -int TST_TOTAL = 1; - -int main(int ac, char **av) +static void verify_sysfs02(void) { - int lc; - char buf[40]; /* 40 bytes suffice to store fs name */ - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); + char buf[40]; /* 40 bytes suffice to store fs name */ - for (lc = 0; TEST_LOOPING(lc); lc++) { + /*option 2 buf holds fs name */ + TST_EXP_PASS(tst_syscall(__NR_sysfs, 2, 0, buf), "sysfs(2,0,buf)"); - tst_count = 0; - - /*option 2 buf holds fs name */ - TEST(ltp_syscall(__NR_sysfs, 2, 0, buf)); - - /* check return code */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "sysfs(2) Failed for " - "option 2 and returned" - " %d as error number", TEST_ERRNO); - } else { - tst_resm(TPASS, "sysfs(2) Passed for option 2"); - } - } /*End of TEST_LOOPING */ - - /*Clean up and exit */ - cleanup(); - - tst_exit(); } -/* setup() - performs all ONE TIME setup for this test */ -void setup(void) -{ - - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; -} - -/* - * cleanup() - Performs one time cleanup for this test at - * completion or premature exit - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .test_all = verify_sysfs02, +}; From patchwork Wed Aug 11 02:48:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sujiaxun X-Patchwork-Id: 1515552 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=) 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 4GkvQr0JKJz9s5R for ; Wed, 11 Aug 2021 12:48:51 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id CB3033C70C8 for ; Wed, 11 Aug 2021 04:48:49 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) (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 9F1143C70B7 for ; Wed, 11 Aug 2021 04:48:45 +0200 (CEST) Received: from smtpbguseast2.qq.com (smtpbguseast2.qq.com [54.204.34.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id 54F5F601256 for ; Wed, 11 Aug 2021 04:48:43 +0200 (CEST) X-QQ-mid: bizesmtp42t1628650118tc6fqc2v Received: from localhost.localdomain (unknown [58.240.82.166]) by esmtp6.qq.com (ESMTP) with id ; Wed, 11 Aug 2021 10:48:33 +0800 (CST) X-QQ-SSF: 0140000000200020B000B00A0000000 X-QQ-FEAT: QGWlG8nlCFiyW1Bej8QgHhO0GrykkfFc0yxsf3rhZA82wDPL5Eb3ATTRf3epM zD2CPcFbw9afxgKb8XooWzgL7RPWU4jfEcifXODHOXjfrD0FgmHxiqPUC9TvcRV/nkEFbwP WvMzeRki4JOFLNBrZQhIbVN4qz3GnkMcuufym1yX0/HLFjI2KwtavxWLmJepbtBjd3XVRts KP5IN4g1mlCGKT1s8CY2pC2kCqm9ItzXRTfxOkKWqoh26Dbss7lTb8tFrHxWPwgGHL0OiN5 PmCpQsi37tNx3Lq26uwag53C04+Gz6XZqrE7cs4+CucYbPyYBZlt2xcSKUvs+e77rb1MbRs gMDpFHwJ5GeUTwU/zVrs8B7r9m9gw== X-QQ-GoodBg: 2 From: sujiaxun To: ltp@lists.linux.it Date: Wed, 11 Aug 2021 10:48:32 +0800 Message-Id: <20210811024832.18083-1-sujiaxun@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 X-Virus-Scanned: clamav-milter 0.102.4 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=-0.0 required=7.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH] [v3, 3/6] syscalls/sysfs: Convert sysfs03 to the 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: , Cc: sujiaxun Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: sujiaxun --- testcases/kernel/syscalls/sysfs/sysfs03.c | 125 +++------------------- 1 file changed, 15 insertions(+), 110 deletions(-) -- 2.20.1 diff --git a/testcases/kernel/syscalls/sysfs/sysfs03.c b/testcases/kernel/syscalls/sysfs/sysfs03.c index 98bd5c692..8e53e92d8 100644 --- a/testcases/kernel/syscalls/sysfs/sysfs03.c +++ b/testcases/kernel/syscalls/sysfs/sysfs03.c @@ -1,125 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * 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. - * */ -/************************************************************************** - * - * TEST IDENTIFIER : sysfs03 - * - * EXECUTED BY : anyone - * - * TEST TITLE : Basic test for sysfs(2) - * - * TEST CASE TOTAL : 1 - * - * AUTHOR : Aniruddha Marathe - * - * 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 sysfs(2) system call. - * It is intended to provide a limited exposure of the system call. - * This testcase tests sysfs(2) for option 3 - * - * 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 - * - * USAGE: - * sysfs03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-p] [-f] - * where: - * -c n : Run n copies simultaneously - * -e : Turn on errno logging. - * -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. - * - *RESTRICTIONS: - *There is no glibc or libc support - *****************************************************************************/ + +/*\ + * [Description] + * This test is run for option 3 for sysfs(2). + * Return the total number of filesystem types currently present in the kernel. + */ #include #include #include -#include "test.h" +#include "tst_test.h" #include "lapi/syscalls.h" -static void setup(); -static void cleanup(); - -char *TCID = "sysfs03"; -int TST_TOTAL = 1; - -int main(int ac, char **av) +static void verify_sysfs03(void) { - int lc; - - tst_parse_opts(ac, av, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) { - - tst_count = 0; - - TEST(ltp_syscall(__NR_sysfs, 3)); - - /* check return code */ - if (TEST_RETURN == -1) { - tst_resm(TFAIL, "sysfs(2) Failed for" - " option 3 and returned" - " %d as error number", TEST_ERRNO); - } else { - tst_resm(TPASS, "sysfs(2) Passed for option 3"); - } - } /*End of TEST_LOOPING */ - /*Clean up and exit */ - cleanup(); - tst_exit(); + TST_EXP_POSITIVE(tst_syscall(__NR_sysfs, 3), "sysfs(3)"); -} - -/* setup() - performs all ONE TIME setup for this test */ -void setup(void) -{ + if (TST_PASS == 1) + tst_res(TPASS, "sysfs(2) Passed for option 3"); - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; } -/* - * cleanup() - Performs one time cleanup for this test at - * completion or premature exit - */ -void cleanup(void) -{ - -} +static struct tst_test test = { + .test_all = verify_sysfs03, +};