From patchwork Thu Mar 3 08:33:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1600251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=hnZ7qXbm; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=u/NoGebW; dkim-atps=neutral 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4K8PR61yQxz9sFq for ; Thu, 3 Mar 2022 19:34:08 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 674203CA31F for ; Thu, 3 Mar 2022 09:34:05 +0100 (CET) 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 481673C978E for ; Thu, 3 Mar 2022 09:34:02 +0100 (CET) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (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 in-6.smtp.seeweb.it (Postfix) with ESMTPS id C23541401428 for ; Thu, 3 Mar 2022 09:33:59 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CD6391F3A3; Thu, 3 Mar 2022 08:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646296438; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=6zKIrLde98dtJgPzy3dqp1TUwXyaHIjW99BCt95Py74=; b=hnZ7qXbmhfvbcBy36d50dbRpjA+wWIXTjaEhBkOUNTlI2JCiJybo4Occ6cBDCyHMFT79GD egl+JJy2CpFTojwe47uiEAPtumtQHMRclo+OILR34TiZBX403E6FtQEfXZdJdyZlpUYDb2 gRZjdv8BYliRXCcFqQiZtBWME792cu0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646296438; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=6zKIrLde98dtJgPzy3dqp1TUwXyaHIjW99BCt95Py74=; b=u/NoGebWCVkfka7EQAmeDvyuFHgDef0FRY67/GEebZnf5p5HVt9M5nI+enRBoKEPbB9Mo9 0+xIY5t4KMhW0DBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A4694139BD; Thu, 3 Mar 2022 08:33:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id c+4hJnZ9IGI2TgAAMHmgww (envelope-from ); Thu, 03 Mar 2022 08:33:58 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Thu, 3 Mar 2022 09:33:57 +0100 Message-Id: <20220303083357.20675-1-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 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, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 v2] Rewrite getcontext01.c test using new LTP 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" Removed old LTP API from getcontext01.c test and check if getcontext is present in the current system. The check is useful in those systems where musl is used by default. Signed-off-by: Andrea Cervesato --- configure.ac | 1 + .../kernel/syscalls/getcontext/getcontext01.c | 93 ++++--------------- 2 files changed, 20 insertions(+), 74 deletions(-) diff --git a/configure.ac b/configure.ac index 49499704e..9b6d01f54 100644 --- a/configure.ac +++ b/configure.ac @@ -97,6 +97,7 @@ AC_CHECK_FUNCS_ONCE([ \ fspick \ fstatat \ getauxval \ + getcontext \ getdents \ getdents64 \ io_pgetevents \ diff --git a/testcases/kernel/syscalls/getcontext/getcontext01.c b/testcases/kernel/syscalls/getcontext/getcontext01.c index 48e78907f..7176a9035 100644 --- a/testcases/kernel/syscalls/getcontext/getcontext01.c +++ b/testcases/kernel/syscalls/getcontext/getcontext01.c @@ -1,89 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) Wipro Technologies Ltd, 2005. All Rights Reserved. - * Author: Prashant P Yendigeri - * - * 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: Prashant P Yendigeri + * Copyright (C) 2022 SUSE LLC Andrea Cervesato */ -#include - -#include -#include -#include -#include - -#include "test.h" - -char *TCID = "getcontext01"; +/*\ + * [Description] + * + * Test getting user context functionality. + */ -#if !defined(__UCLIBC__) +#include "config.h" +#include "tst_test.h" -static void setup(void); -static void cleanup(void); +#ifdef HAVE_GETCONTEXT -int TST_TOTAL = 1; +#include -static void test_getcontext(void) +static void run(void) { ucontext_t ptr; - TEST(getcontext(&ptr)); - - if (TEST_RETURN == -1) { - if (errno == ENOSYS) - tst_resm(TCONF, "getcontext not implemented in libc"); - else - tst_resm(TFAIL | TTERRNO, "getcontext failed"); - } else if (TEST_RETURN == 0) { - tst_resm(TPASS, "getcontext passed"); - } else { - tst_resm(TFAIL, "Unexpected return value %li", TEST_RETURN); - } -} - -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; - - test_getcontext(); - } - - cleanup(); - tst_exit(); -} - -static void setup(void) -{ - tst_sig(NOFORK, DEF_HANDLER, cleanup); - - TEST_PAUSE; + TST_EXP_PASS(getcontext(&ptr)); } -static void cleanup(void) -{ -} +static struct tst_test test = { + .test_all = run, +}; -#else /* systems that dont support obsolete getcontext */ -int main(void) -{ - tst_brkm(TCONF, NULL, "system doesn't have getcontext support"); -} +#else +TST_TEST_TCONF("system doesn't have getcontext support"); #endif