From patchwork Sat Jun 15 04:20:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Wang X-Patchwork-Id: 1116350 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Qkn81T0hz9s3Z for ; Sat, 15 Jun 2019 14:21:12 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 3B9E6294ACA for ; Sat, 15 Jun 2019 06:21:07 +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]) by picard.linux.it (Postfix) with ESMTP id C485B294AC0 for ; Sat, 15 Jun 2019 06:20:58 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id BE9F120100D for ; Sat, 15 Jun 2019 06:20:56 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 35BB985539 for ; Sat, 15 Jun 2019 04:20:55 +0000 (UTC) Received: from dhcp-12-157.nay.redhat.com (dhcp-12-157.nay.redhat.com [10.66.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 642045D9E2 for ; Sat, 15 Jun 2019 04:20:54 +0000 (UTC) From: Li Wang To: ltp@lists.linux.it Date: Sat, 15 Jun 2019 12:20:47 +0800 Message-Id: <20190615042048.29839-2-liwang@redhat.com> In-Reply-To: <20190615042048.29839-1-liwang@redhat.com> References: <20190615042048.29839-1-liwang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sat, 15 Jun 2019 04:20:55 +0000 (UTC) X-Virus-Scanned: clamav-milter 0.99.2 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.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH v2 2/3] testcase: taking use of .arch in tst_test X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 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" This is a demo for .arch usage: 1. ptrace07.c, cve-2017-17053.c, meltdown.c Signed-off-by: Li Wang Reviewed-by: Petr Vorel --- testcases/cve/cve-2017-17053.c | 1 + testcases/cve/meltdown.c | 9 +-------- testcases/kernel/syscalls/ptrace/ptrace07.c | 8 +++----- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/testcases/cve/cve-2017-17053.c b/testcases/cve/cve-2017-17053.c index e01db3d4f..62bbc5014 100644 --- a/testcases/cve/cve-2017-17053.c +++ b/testcases/cve/cve-2017-17053.c @@ -162,6 +162,7 @@ void run(void) } static struct tst_test test = { + .arch = "x86_64 i386", .forks_child = 1, .setup = setup, .cleanup = cleanup, diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c index a53ea9b8e..72c9ec907 100644 --- a/testcases/cve/meltdown.c +++ b/testcases/cve/meltdown.c @@ -20,8 +20,6 @@ #include "config.h" #include "tst_test.h" -#if defined(__x86_64__) || defined(__i386__) - #include #include #include @@ -382,15 +380,10 @@ static void cleanup(void) } static struct tst_test test = { + .arch = "x86_64 i386", .needs_root = 1, .setup = setup, .test_all = run, .cleanup = cleanup, .min_kver = "2.6.32" }; - -#else /* #if defined(__x86_64__) || defined(__i386__) */ - -TST_TEST_TCONF("not x86_64 or i386"); - -#endif /* #else #if defined(__x86_64__) || defined(__i386__) */ diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c index 9cbaefc3f..67e47ce16 100644 --- a/testcases/kernel/syscalls/ptrace/ptrace07.c +++ b/testcases/kernel/syscalls/ptrace/ptrace07.c @@ -60,13 +60,13 @@ # define NT_X86_XSTATE 0x202 #endif -#ifdef __x86_64__ static void check_regs_loop(uint32_t initval) { const unsigned long num_iters = 1000000000; uint32_t xmm0[4] = { initval, initval, initval, initval }; int status = 1; +#ifdef __x86_64__ asm volatile(" movdqu %0, %%xmm0\n" " mov %0, %%rbx\n" "1: dec %2\n" @@ -80,6 +80,7 @@ static void check_regs_loop(uint32_t initval) "3:\n" : "+m" (xmm0), "+r" (status) : "r" (num_iters) : "rax", "rbx", "xmm0"); +#endif if (status) { tst_res(TFAIL, @@ -188,10 +189,7 @@ static void do_test(void) static struct tst_test test = { .test_all = do_test, + .arch = "x86_64", .forks_child = 1, .needs_checkpoints = 1, }; - -#else /* !__x86_64__ */ - TST_TEST_TCONF("this test is only supported on x86_64"); -#endif /* __x86_64__ */