From patchwork Tue Mar 1 09:15:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1599265 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=Pc6IjiRo; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=nv8ciee3; dkim-atps=neutral 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7Fl446Ckz9sCq for ; Tue, 1 Mar 2022 22:44:00 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7E40D3CA2EA for ; Tue, 1 Mar 2022 10:15:24 +0100 (CET) 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 4166A3CA2BD for ; Tue, 1 Mar 2022 10:15:22 +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-7.smtp.seeweb.it (Postfix) with ESMTPS id 55E27200DB7 for ; Tue, 1 Mar 2022 10:15:21 +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 9ED611F37E; Tue, 1 Mar 2022 09:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646126120; 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: in-reply-to:in-reply-to:references:references; bh=7j8ECvHNoB9URk1t+aN4uUzd2dboTRH3xRvk7nop8cM=; b=Pc6IjiRoVxxtawHdWNuX1yPpuRyKg598Z//xguJBcSQiPvUibi9i+huOBEW9VyJqsO1pRA MT3PKDb+1k+2K08GIvGd3g8uR4j9UdyuSh51qN3xsL+79Ql5Nkbx28jMRLCPPSnzviXHXs lDsgy/D0XLw/6rdadIkXsg/GehZHZt0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646126120; 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: in-reply-to:in-reply-to:references:references; bh=7j8ECvHNoB9URk1t+aN4uUzd2dboTRH3xRvk7nop8cM=; b=nv8ciee3WKxOKQL1zhtV4V2yz76r1+BJJhGhwSVhfGLywxtU+jmYGSA9L2d3RAlVJlo2uS tOBZdvwzik99VmBQ== 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 65AB613B08; Tue, 1 Mar 2022 09:15:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6NInEyjkHWJ3VwAAMHmgww (envelope-from ); Tue, 01 Mar 2022 09:15:20 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 10:15:12 +0100 Message-Id: <20220301091517.11142-2-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220301091517.11142-1-andrea.cervesato@suse.de> References: <20220301091517.11142-1-andrea.cervesato@suse.de> 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, 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-7.smtp.seeweb.it Subject: [LTP] [PATCH v3 1/6] Rewrite mountns01 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" Signed-off-by: Andrea Cervesato --- testcases/kernel/containers/mountns/mountns.h | 50 +++++ .../kernel/containers/mountns/mountns01.c | 185 +++++++----------- 2 files changed, 125 insertions(+), 110 deletions(-) create mode 100644 testcases/kernel/containers/mountns/mountns.h diff --git a/testcases/kernel/containers/mountns/mountns.h b/testcases/kernel/containers/mountns/mountns.h new file mode 100644 index 000000000..ad8befa71 --- /dev/null +++ b/testcases/kernel/containers/mountns/mountns.h @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Red Hat, Inc. + * Copyright (C) 2021 SUSE LLC Andrea Cervesato + */ + +#ifndef COMMON_H +#define COMMON_H + +#include "tst_test.h" +#include "lapi/namespaces_constants.h" + +#define DIRA "A" +#define DIRB "B" + +static int dummy_child(void *v) +{ + (void)v; + return 0; +} + +static void check_newns(void) +{ + int pid, status; + + pid = ltp_clone_quick(CLONE_NEWNS | SIGCHLD, dummy_child, NULL); + if (pid < 0) + tst_brk(TCONF, "CLONE_NEWNS not supported"); + + SAFE_WAIT(&status); +} + +static void umount_folders(void) +{ + if (tst_is_mounted(DIRA)) + SAFE_UMOUNT(DIRA); + + if (tst_is_mounted(DIRB)) + SAFE_UMOUNT(DIRB); +} + +static void create_folders(void) +{ + SAFE_MKDIR(DIRA, 0777); + SAFE_MKDIR(DIRB, 0777); + SAFE_TOUCH(DIRA "/A", 0, NULL); + SAFE_TOUCH(DIRB "/B", 0, NULL); +} + +#endif diff --git a/testcases/kernel/containers/mountns/mountns01.c b/testcases/kernel/containers/mountns/mountns01.c index 0bd0c592c..f2d67d17a 100644 --- a/testcases/kernel/containers/mountns/mountns01.c +++ b/testcases/kernel/containers/mountns/mountns01.c @@ -1,149 +1,114 @@ -/* Copyright (c) 2014 Red Hat, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of version 2 the GNU General Public License as - * published by the Free Software Foundation. - * - * 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, see . - *********************************************************************** - * File: mountns01.c +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Red Hat, Inc. + * Copyright (C) 2021 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] * * Tests a shared mount: shared mount can be replicated to as many * mountpoints and all the replicas continue to be exactly same. - * Description: - * 1. Creates directories "A", "B" and files "A/A", "B/B" - * 2. Unshares mount namespace and makes it private (so mounts/umounts - * have no effect on a real system) - * 3. Bind mounts directory "A" to "A" - * 4. Makes directory "A" shared - * 5. Clones a new child process with CLONE_NEWNS flag - * 6. There are two test cases (where X is parent namespace and Y child - * namespace): - * 1) - * X: bind mounts "B" to "A" - * Y: must see "A/B" - * X: umounts "A" - * 2) - * Y: bind mounts "B" to "A" - * X: must see "A/B" - * Y: umounts "A" - ***********************************************************************/ - -#define _GNU_SOURCE + * + * [Algorithm] + * + * . Creates directories "A", "B" and files "A/A", "B/B" + * . Unshares mount namespace and makes it private (so mounts/umounts have no + * effect on a real system) + * . Bind mounts directory "A" to "A" + * . Makes directory "A" shared + * . Clones a new child process with CLONE_NEWNS flag + * . There are two test cases (where X is parent namespace and Y child namespace): + * .. First test case + * ... X: bind mounts "B" to "A" + * ... Y: must see "A/B" + * ... X: umounts "A" + * .. Second test case + * ... Y: bind mounts "B" to "A" + * ... X: must see "A/B" + * ... Y: umounts "A" + */ + #include #include -#include -#include -#include "mountns_helper.h" -#include "test.h" -#include "safe_macros.h" - -char *TCID = "mountns01"; -int TST_TOTAL = 2; +#include "mountns.h" +#include "tst_test.h" -#if defined(MS_SHARED) && defined(MS_PRIVATE) && defined(MS_REC) - -int child_func(void *arg LTP_ATTRIBUTE_UNUSED) +static int child_func(LTP_ATTRIBUTE_UNUSED void *arg) { - int ret = 0; + TST_CHECKPOINT_WAIT(0); - TST_SAFE_CHECKPOINT_WAIT(NULL, 0); + if (access(DIRA "/B", F_OK) == 0) + tst_res(TPASS, "shared mount in parent passed"); + else + tst_res(TFAIL, "shared mount in parent failed"); - if (access(DIRA"/B", F_OK) == -1) - ret = 2; + TST_CHECKPOINT_WAKE_AND_WAIT(0); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + /* bind mounts DIRB to DIRA making contents of DIRB visible in DIRA */ + SAFE_MOUNT(DIRB, DIRA, "none", MS_BIND, NULL); - /* bind mounts DIRB to DIRA making contents of DIRB visible - * in DIRA */ - if (mount(DIRB, DIRA, "none", MS_BIND, NULL) == -1) { - perror("mount"); - return 1; - } + TST_CHECKPOINT_WAKE_AND_WAIT(0); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + SAFE_UMOUNT(DIRA); - umount(DIRA); - return ret; + return 0; } -static void test(void) +static void run(void) { - int status; + int ret; /* unshares the mount ns */ - if (unshare(CLONE_NEWNS) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "unshare failed"); + SAFE_UNSHARE(CLONE_NEWNS); + /* makes sure parent mounts/umounts have no effect on a real system */ - SAFE_MOUNT(cleanup, "none", "/", "none", MS_REC|MS_PRIVATE, NULL); + SAFE_MOUNT("none", "/", "none", MS_REC | MS_PRIVATE, NULL); /* bind mounts DIRA to itself */ - SAFE_MOUNT(cleanup, DIRA, DIRA, "none", MS_BIND, NULL); + SAFE_MOUNT(DIRA, DIRA, "none", MS_BIND, NULL); /* makes mount DIRA shared */ - SAFE_MOUNT(cleanup, "none", DIRA, "none", MS_SHARED, NULL); + SAFE_MOUNT("none", DIRA, "none", MS_SHARED, NULL); - if (do_clone_tests(CLONE_NEWNS, child_func, NULL, NULL, NULL) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "clone failed"); + ret = ltp_clone_quick(CLONE_NEWNS | SIGCHLD, child_func, NULL); + if (ret < 0) + tst_brk(TBROK, "clone failed"); - /* bind mounts DIRB to DIRA making contents of DIRB visible - * in DIRA */ - SAFE_MOUNT(cleanup, DIRB, DIRA, "none", MS_BIND, NULL); + /* bind mounts DIRB to DIRA making contents of DIRB visible in DIRA */ + SAFE_MOUNT(DIRB, DIRA, "none", MS_BIND, NULL); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - if (access(DIRA"/B", F_OK) == 0) - tst_resm(TPASS, "shared mount in child passed"); + if (access(DIRA "/B", F_OK) == 0) + tst_res(TPASS, "shared mount in child passed"); else - tst_resm(TFAIL, "shared mount in child failed"); - - TST_SAFE_CHECKPOINT_WAKE(cleanup, 0); + tst_res(TFAIL, "shared mount in child failed"); + TST_CHECKPOINT_WAKE(0); - SAFE_WAIT(cleanup, &status); - if (WIFEXITED(status)) { - if ((WEXITSTATUS(status) == 0)) - tst_resm(TPASS, "shared mount in parent passed"); - else - tst_resm(TFAIL, "shared mount in parent failed"); - } - if (WIFSIGNALED(status)) { - tst_resm(TBROK, "child was killed with signal %s", - tst_strsig(WTERMSIG(status))); - return; - } - - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); } -int main(int argc, char *argv[]) +static void setup(void) { - int lc; - - tst_parse_opts(argc, argv, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) - test(); - - cleanup(); - tst_exit(); + check_newns(); + create_folders(); } -#else -int main(void) +static void cleanup(void) { - tst_brkm(TCONF, NULL, "needed mountflags are not defined"); + umount_folders(); } -#endif + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = run, + .needs_root = 1, + .needs_checkpoints = 1, +}; From patchwork Tue Mar 1 09:15:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1599268 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=VW+W8A32; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=HyAh5hI0; 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7Fl50kZgz9sDX for ; Tue, 1 Mar 2022 22:44:00 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 180363CA2DC for ; Tue, 1 Mar 2022 10:15:36 +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 743EB3CA2D4 for ; Tue, 1 Mar 2022 10:15:22 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 966DE14012C8 for ; Tue, 1 Mar 2022 10:15:21 +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-out1.suse.de (Postfix) with ESMTPS id 3F59C219A5; Tue, 1 Mar 2022 09:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646126121; 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: in-reply-to:in-reply-to:references:references; bh=d+0H4hyiSRod7yzwhFmXjRViDP5C5mpS2IwtTaP7hYw=; b=VW+W8A321lvERycedtMBXiRxrXOdUsR+VegMX6aTItTGWxZp/nCYnpXtFcvi4/WbW6uQh0 4RKVogdDFUWv8i7lREYiO2zHW2iYWlxmnH320wOPggL42sR2JrlPVGjRaoBZl/GXBM7k98 ueVaphxAp70llT/odYTqdjunIU+QA5o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646126121; 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: in-reply-to:in-reply-to:references:references; bh=d+0H4hyiSRod7yzwhFmXjRViDP5C5mpS2IwtTaP7hYw=; b=HyAh5hI04ks3yDlW+S8rRDxntGY1317ULH9PM49zDG5TWuQNg2poDLXnRmKHmMrFVfhQlE kbtOPVZvHa6ftVBw== 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 CACEC13B08; Tue, 1 Mar 2022 09:15:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cAV4KyjkHWJ3VwAAMHmgww (envelope-from ); Tue, 01 Mar 2022 09:15:20 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 10:15:13 +0100 Message-Id: <20220301091517.11142-3-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220301091517.11142-1-andrea.cervesato@suse.de> References: <20220301091517.11142-1-andrea.cervesato@suse.de> 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 v3 2/6] Rewrite mountns02 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" Signed-off-by: Andrea Cervesato --- .../kernel/containers/mountns/mountns02.c | 186 +++++++----------- 1 file changed, 76 insertions(+), 110 deletions(-) diff --git a/testcases/kernel/containers/mountns/mountns02.c b/testcases/kernel/containers/mountns/mountns02.c index 0e0e03e4d..c51999e35 100644 --- a/testcases/kernel/containers/mountns/mountns02.c +++ b/testcases/kernel/containers/mountns/mountns02.c @@ -1,149 +1,115 @@ -/* Copyright (c) 2014 Red Hat, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of version 2 the GNU General Public License as - * published by the Free Software Foundation. - * - * 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, see . - *********************************************************************** - * File: mountns02.c +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Red Hat, Inc. + * Copyright (C) 2021 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] * * Tests a private mount: private mount does not forward or receive * propagation. - * Description: - * 1. Creates directories "A", "B" and files "A/A", "B/B" - * 2. Unshares mount namespace and makes it private (so mounts/umounts - * have no effect on a real system) - * 3. Bind mounts directory "A" to "A" - * 4. Makes directory "A" private - * 5. Clones a new child process with CLONE_NEWNS flag - * 6. There are two test cases (where X is parent namespace and Y child - * namespace): - * 1) - * X: bind mounts "B" to "A" - * Y: must see "A/A" and must not see "A/B" - * X: umounts "A" - * 2) - * Y: bind mounts "B" to "A" - * X: must see "A/A" and must not see "A/B" - * Y: umounts A - ***********************************************************************/ - -#define _GNU_SOURCE + * + * [Algorithm] + * + * . Creates directories "A", "B" and files "A/A", "B/B" + * . Unshares mount namespace and makes it private (so mounts/umounts have no + * effect on a real system) + * . Bind mounts directory "A" to "A" + * . Makes directory "A" private + * . Clones a new child process with CLONE_NEWNS flag + * . There are two test cases (where X is parent namespace and Y child + * namespace): + * .. First test case + * ... X: bind mounts "B" to "A" + * ... Y: must see "A/A" and must not see "A/B" + * ... X: umounts "A" + * .. Second test case + * ... Y: bind mounts "B" to "A" + * ... X: must see "A/A" and must not see "A/B" + * ... Y: umounts A + */ + #include #include -#include -#include -#include "mountns_helper.h" -#include "test.h" -#include "safe_macros.h" - -char *TCID = "mountns02"; -int TST_TOTAL = 2; +#include "mountns.h" +#include "tst_test.h" -#if defined(MS_SHARED) && defined(MS_PRIVATE) && defined(MS_REC) - -int child_func(void *arg LTP_ATTRIBUTE_UNUSED) +static int child_func(LTP_ATTRIBUTE_UNUSED void *arg) { - int ret = 0; + TST_CHECKPOINT_WAIT(0); - TST_SAFE_CHECKPOINT_WAIT(NULL, 0); + if ((access(DIRA "/A", F_OK) != 0) || (access(DIRA "/B", F_OK) == 0)) + tst_res(TFAIL, "private mount in parent failed"); + else + tst_res(TPASS, "private mount in parent passed"); - if ((access(DIRA"/A", F_OK) != 0) || (access(DIRA"/B", F_OK) == 0)) - ret = 2; + TST_CHECKPOINT_WAKE_AND_WAIT(0); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + /* bind mounts DIRB to DIRA making contents of DIRB visible in DIRA */ + SAFE_MOUNT(DIRB, DIRA, "none", MS_BIND, NULL); - /* bind mounts DIRB to DIRA making contents of DIRB visible - * in DIRA */ - if (mount(DIRB, DIRA, "none", MS_BIND, NULL) == -1) { - perror("mount"); - return 1; - } + TST_CHECKPOINT_WAKE_AND_WAIT(0); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + SAFE_UMOUNT(DIRA); - umount(DIRA); - return ret; + return 0; } -static void test(void) +static void run(void) { - int status; + int ret; /* unshares the mount ns */ - if (unshare(CLONE_NEWNS) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "unshare failed"); + SAFE_UNSHARE(CLONE_NEWNS); + /* makes sure parent mounts/umounts have no effect on a real system */ - SAFE_MOUNT(cleanup, "none", "/", "none", MS_REC|MS_PRIVATE, NULL); + SAFE_MOUNT("none", "/", "none", MS_REC | MS_PRIVATE, NULL); /* bind mounts DIRA to itself */ - SAFE_MOUNT(cleanup, DIRA, DIRA, "none", MS_BIND, NULL); + SAFE_MOUNT(DIRA, DIRA, "none", MS_BIND, NULL); /* makes mount DIRA private */ - SAFE_MOUNT(cleanup, "none", DIRA, "none", MS_PRIVATE, NULL); + SAFE_MOUNT("none", DIRA, "none", MS_PRIVATE, NULL); - if (do_clone_tests(CLONE_NEWNS, child_func, NULL, NULL, NULL) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "clone failed"); + ret = ltp_clone_quick(CLONE_NEWNS | SIGCHLD, child_func, NULL); + if (ret < 0) + tst_brk(TBROK, "clone failed"); - /* bind mounts DIRB to DIRA making contents of DIRB visible - * in DIRA */ - SAFE_MOUNT(cleanup, DIRB, DIRA, "none", MS_BIND, NULL); + /* bind mounts DIRB to DIRA making contents of DIRB visible in DIRA */ + SAFE_MOUNT(DIRB, DIRA, "none", MS_BIND, NULL); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - if ((access(DIRA"/A", F_OK) != 0) || (access(DIRA"/B", F_OK) == 0)) - tst_resm(TFAIL, "private mount in child failed"); + if ((access(DIRA "/A", F_OK) != 0) || (access(DIRA "/B", F_OK) == 0)) + tst_res(TFAIL, "private mount in child failed"); else - tst_resm(TPASS, "private mount in child passed"); - - TST_SAFE_CHECKPOINT_WAKE(cleanup, 0); + tst_res(TPASS, "private mount in child passed"); + TST_CHECKPOINT_WAKE(0); - SAFE_WAIT(cleanup, &status); - if (WIFEXITED(status)) { - if ((WEXITSTATUS(status) == 0)) - tst_resm(TPASS, "private mount in parent passed"); - else - tst_resm(TFAIL, "private mount in parent failed"); - } - if (WIFSIGNALED(status)) { - tst_resm(TBROK, "child was killed with signal %s", - tst_strsig(WTERMSIG(status))); - return; - } - - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); } -int main(int argc, char *argv[]) +static void setup(void) { - int lc; - - tst_parse_opts(argc, argv, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) - test(); - - cleanup(); - tst_exit(); + check_newns(); + create_folders(); } -#else -int main(void) +static void cleanup(void) { - tst_brkm(TCONF, NULL, "needed mountflags are not defined"); + umount_folders(); } -#endif + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = run, + .needs_root = 1, + .needs_checkpoints = 1, +}; From patchwork Tue Mar 1 09:15:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1599270 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=oZG4EG9Z; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=1pPLxL+x; 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7Fl84xg8z9sBy for ; Tue, 1 Mar 2022 22:44:04 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8FA693CA2E5 for ; Tue, 1 Mar 2022 10:15:57 +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 14EA13CA2BD for ; Tue, 1 Mar 2022 10:15:23 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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 3C1FD14012AB for ; Tue, 1 Mar 2022 10:15:22 +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-out1.suse.de (Postfix) with ESMTPS id DCA0321637; Tue, 1 Mar 2022 09:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646126121; 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: in-reply-to:in-reply-to:references:references; bh=yyWs1iqWUardLVlBegAjI0l2uLcDreUHZW9mAfovYgw=; b=oZG4EG9ZKnB22qzd0x4pQIL0ss6F0DHKIeba0C7S8xtpTORxUqrdUYbkFCKDQh73Dpi4zx LKtAm7uehmLs05tQHhB0dILu+VCLS281t4YtQPPlh7mRKopO9cvQn/Gi2100CFJwnKhI9d QDYLMZrjsaJb01canz6Ng3N9AIi4Zik= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646126121; 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: in-reply-to:in-reply-to:references:references; bh=yyWs1iqWUardLVlBegAjI0l2uLcDreUHZW9mAfovYgw=; b=1pPLxL+xsAeZnB5YarDp5T5vaUV1gCNvm6YtxB82CPF7tOp9qKEAqofNnGFPcuncKR6dgd Z4SPSLrvjEI2efBg== 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 6C33613B08; Tue, 1 Mar 2022 09:15:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gDiDFCnkHWJ3VwAAMHmgww (envelope-from ); Tue, 01 Mar 2022 09:15:21 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 10:15:14 +0100 Message-Id: <20220301091517.11142-4-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220301091517.11142-1-andrea.cervesato@suse.de> References: <20220301091517.11142-1-andrea.cervesato@suse.de> 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 v3 3/6] Rewrite mountns03 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" Signed-off-by: Andrea Cervesato --- .../kernel/containers/mountns/mountns03.c | 206 +++++++----------- 1 file changed, 84 insertions(+), 122 deletions(-) diff --git a/testcases/kernel/containers/mountns/mountns03.c b/testcases/kernel/containers/mountns/mountns03.c index 196a36149..b8537d1a0 100644 --- a/testcases/kernel/containers/mountns/mountns03.c +++ b/testcases/kernel/containers/mountns/mountns03.c @@ -1,166 +1,128 @@ -/* Copyright (c) 2014 Red Hat, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of version 2 the GNU General Public License as - * published by the Free Software Foundation. - * - * 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, see . - *********************************************************************** - * File: mountns03.c +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Red Hat, Inc. + * Copyright (C) 2021 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] * * Tests a slave mount: slave mount is like a shared mount except that * mount and umount events only propagate towards it. * - * Description: - * 1. Creates directories "A", "B" and files "A/A", "B/B" - * 2. Unshares mount namespace and makes it private (so mounts/umounts - * have no effect on a real system) - * 3. Bind mounts directory "A" to itself - * 4. Makes directory "A" shared - * 5. Clones a new child process with CLONE_NEWNS flag and makes "A" - * a slave mount - * 6. There are two testcases (where X is parent namespace and Y child - * namespace): - * 1) - * X: bind mounts "B" to "A" - * Y: must see the file "A/B" - * X: umounts "A" - * 2) - * Y: bind mounts "B" to "A" - * X: must see only the "A/A" and must not see "A/B" (as slave - * mount does not forward propagation) - * Y: umounts "A" - ***********************************************************************/ - -#define _GNU_SOURCE + * [Algorithm] + * + * . Creates directories "A", "B" and files "A/A", "B/B" + * . Unshares mount namespace and makes it private (so mounts/umounts have no + * effect on a real system) + * . Bind mounts directory "A" to itself + * . Makes directory "A" shared + * . Clones a new child process with CLONE_NEWNS flag and makes "A" a slave + * mount + * . There are two testcases (where X is parent namespace and Y child + * namespace): + * .. First test case + * ... X: bind mounts "B" to "A" + * ... Y: must see the file "A/B" + * ... X: umounts "A" + * .. Second test case + * ... Y: bind mounts "B" to "A" + * ... X: must see only the "A/A" and must not see "A/B" (as slave mount does + * not forward propagation) + * ... Y: umounts "A" + */ + #include #include -#include -#include -#include -#include "mountns_helper.h" -#include "test.h" -#include "safe_macros.h" +#include "mountns.h" +#include "tst_test.h" -char *TCID = "mountns03"; -int TST_TOTAL = 2; - -#if defined(MS_SHARED) && defined(MS_PRIVATE) \ - && defined(MS_REC) && defined(MS_SLAVE) - -int child_func(void *arg LTP_ATTRIBUTE_UNUSED) +static int child_func(LTP_ATTRIBUTE_UNUSED void *arg) { - int ret = 0; + /* + * makes mount DIRA a slave of DIRA (all slave mounts have + * a master mount which is a shared mount) + */ + SAFE_MOUNT("none", DIRA, "none", MS_SLAVE, NULL); - /* makes mount DIRA a slave of DIRA (all slave mounts have - * a master mount which is a shared mount) */ - if (mount("none", DIRA, "none", MS_SLAVE, NULL) == -1) { - perror("mount"); - return 1; - } - - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); /* checks that shared mounts propagates to slave mount */ - if (access(DIRA"/B", F_OK) == -1) - ret = 2; + if (access(DIRA "/B", F_OK) == 0) + tst_res(TPASS, "propagation to slave mount passed"); + else + tst_res(TFAIL, "propagation to slave mount failed"); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - /* bind mounts DIRB to DIRA making contents of DIRB visible - * in DIRA */ - if (mount(DIRB, DIRA, "none", MS_BIND, NULL) == -1) { - perror("mount"); - return 1; - } + /* bind mounts DIRB to DIRA making contents of DIRB visible in DIRA */ + SAFE_MOUNT(DIRB, DIRA, "none", MS_BIND, NULL); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(NULL, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - umount(DIRA); - return ret; + SAFE_UMOUNT(DIRA); + + return 0; } -static void test(void) +static void run(void) { - int status; + int ret; /* unshares the mount ns */ - if (unshare(CLONE_NEWNS) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "unshare failed"); + SAFE_UNSHARE(CLONE_NEWNS); + /* makes sure parent mounts/umounts have no effect on a real system */ - SAFE_MOUNT(cleanup, "none", "/", "none", MS_REC|MS_PRIVATE, NULL); + SAFE_MOUNT("none", "/", "none", MS_REC | MS_PRIVATE, NULL); /* bind mounts DIRA to itself */ - SAFE_MOUNT(cleanup, DIRA, DIRA, "none", MS_BIND, NULL); + SAFE_MOUNT(DIRA, DIRA, "none", MS_BIND, NULL); /* makes mount DIRA shared */ - SAFE_MOUNT(cleanup, "none", DIRA, "none", MS_SHARED, NULL); + SAFE_MOUNT("none", DIRA, "none", MS_SHARED, NULL); - if (do_clone_tests(CLONE_NEWNS, child_func, NULL, NULL, NULL) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "clone failed"); + ret = ltp_clone_quick(CLONE_NEWNS | SIGCHLD, child_func, NULL); + if (ret < 0) + tst_brk(TBROK, "clone failed"); /* waits for child to make a slave mount */ - TST_SAFE_CHECKPOINT_WAIT(cleanup, 0); + TST_CHECKPOINT_WAIT(0); - /* bind mounts DIRB to DIRA making contents of DIRB visible - * in DIRA */ - SAFE_MOUNT(cleanup, DIRB, DIRA, "none", MS_BIND, NULL); + /* bind mounts DIRB to DIRA making contents of DIRB visible in DIRA */ + SAFE_MOUNT(DIRB, DIRA, "none", MS_BIND, NULL); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); - TST_SAFE_CHECKPOINT_WAKE_AND_WAIT(cleanup, 0); + TST_CHECKPOINT_WAKE_AND_WAIT(0); /* checks that slave mount doesn't propagate to shared mount */ - if ((access(DIRA"/A", F_OK) == 0) && (access(DIRA"/B", F_OK) == -1)) - tst_resm(TPASS, "propagation from slave mount passed"); + if ((access(DIRA "/A", F_OK) == 0) && (access(DIRA "/B", F_OK) == -1)) + tst_res(TPASS, "propagation from slave mount passed"); else - tst_resm(TFAIL, "propagation form slave mount failed"); - - TST_SAFE_CHECKPOINT_WAKE(cleanup, 0); + tst_res(TFAIL, "propagation form slave mount failed"); + TST_CHECKPOINT_WAKE(0); - SAFE_WAIT(cleanup, &status); - if (WIFEXITED(status)) { - if (WEXITSTATUS(status) == 0) - tst_resm(TPASS, "propagation to slave mount passed"); - else - tst_resm(TFAIL, "propagation to slave mount failed"); - } - if (WIFSIGNALED(status)) { - tst_resm(TBROK, "child was killed with signal %s", - tst_strsig(WTERMSIG(status))); - return; - } - - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); } -int main(int argc, char *argv[]) +static void setup(void) { - int lc; - - tst_parse_opts(argc, argv, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) - test(); - - cleanup(); - tst_exit(); + check_newns(); + create_folders(); } -#else -int main(void) +static void cleanup(void) { - tst_brkm(TCONF, NULL, "needed mountflags are not defined"); + umount_folders(); } -#endif + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = run, + .needs_root = 1, + .needs_checkpoints = 1, +}; From patchwork Tue Mar 1 09:15:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1599271 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=d356pG+D; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xp3DtBe6; dkim-atps=neutral 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7Fl918smz9sCq for ; Tue, 1 Mar 2022 22:44:04 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 2F0A13CA2E3 for ; Tue, 1 Mar 2022 10:16:10 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it [IPv6:2001:4b78:1:20::4]) (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 0E0F23CA2DC for ; Tue, 1 Mar 2022 10:15:23 +0100 (CET) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (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-4.smtp.seeweb.it (Postfix) with ESMTPS id F1781100118F for ; Tue, 1 Mar 2022 10:15:22 +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-out1.suse.de (Postfix) with ESMTPS id 91CE5219A5; Tue, 1 Mar 2022 09:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646126122; 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: in-reply-to:in-reply-to:references:references; bh=bDKky1q8pfQwgb5icCvUGJH9F8v0B062H3oIxiawh0M=; b=d356pG+DvZJuyJq766wlBb6wa9xyx3eshCQiK/UsApiio6K5Yo37WzkZoH3i7GWV1TZCg4 ua+4M0BmaPVr8m8yQy7TWeXHRJ7lvsl/uKCekgSoXhp0ncA+IOA8oovXdCoVG/6MlZ9R8d i03uv/UXkYXQUL8QAPAry75/RF1mYTE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646126122; 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: in-reply-to:in-reply-to:references:references; bh=bDKky1q8pfQwgb5icCvUGJH9F8v0B062H3oIxiawh0M=; b=xp3DtBe6WcK+UTQ0rDfUO7qUEafMho1toukKYEHYtdRH5RzYty3H/yXBkd6vqPOBF8WbrW h/DEwytwp47VijCQ== 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 0DFAF13B08; Tue, 1 Mar 2022 09:15:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eAUIOSnkHWJ3VwAAMHmgww (envelope-from ); Tue, 01 Mar 2022 09:15:21 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 10:15:15 +0100 Message-Id: <20220301091517.11142-5-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220301091517.11142-1-andrea.cervesato@suse.de> References: <20220301091517.11142-1-andrea.cervesato@suse.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-4.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-4.smtp.seeweb.it Subject: [LTP] [PATCH v3 4/6] Rewrite mountns04 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" Signed-off-by: Andrea Cervesato --- .../kernel/containers/mountns/mountns04.c | 109 ++++++++---------- 1 file changed, 46 insertions(+), 63 deletions(-) diff --git a/testcases/kernel/containers/mountns/mountns04.c b/testcases/kernel/containers/mountns/mountns04.c index 1f022a683..044c90aa7 100644 --- a/testcases/kernel/containers/mountns/mountns04.c +++ b/testcases/kernel/containers/mountns/mountns04.c @@ -1,89 +1,72 @@ -/* Copyright (c) 2014 Red Hat, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of version 2 the GNU General Public License as - * published by the Free Software Foundation. - * - * 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, see . - *********************************************************************** - * File: mountns04.c +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2014 Red Hat, Inc. + * Copyright (C) 2021 SUSE LLC Andrea Cervesato + */ + +/*\ + * [Description] * * Tests an unbindable mount: unbindable mount is an unbindable * private mount. - * Description: - * 1. Creates directories "A", "B" and files "A/A", "B/B" - * 2. Unshares mount namespace and makes it private (so mounts/umounts - * have no effect on a real system) - * 3. Bind mounts directory "A" to "A" - * 4. Makes directory directory "A" unbindable - * 5. Tries to bind mount unbindable "A" to "B": - * - if it fails, test passes - * - if it passes, test fails - ***********************************************************************/ + * + * [Algorithm] + * + * . Creates directories "A", "B" and files "A/A", "B/B" + * . Unshares mount namespace and makes it private (so mounts/umounts have no + * effect on a real system) + * . Bind mounts directory "A" to "A" + * . Makes directory "A" unbindable + * . Tries to bind mount unbindable "A" to "B": + * .. if it fails, test passes + * .. if it passes, test fails + */ -#define _GNU_SOURCE #include #include -#include -#include -#include "mountns_helper.h" -#include "test.h" -#include "safe_macros.h" - -char *TCID = "mountns04"; -int TST_TOTAL = 1; - -#if defined(MS_SHARED) && defined(MS_PRIVATE) \ - && defined(MS_REC) && defined(MS_UNBINDABLE) +#include "mountns.h" +#include "tst_test.h" -static void test(void) +static void run(void) { /* unshares the mount ns */ - if (unshare(CLONE_NEWNS) == -1) - tst_brkm(TBROK | TERRNO, cleanup, "unshare failed"); + SAFE_UNSHARE(CLONE_NEWNS); + /* makes sure mounts/umounts have no effect on a real system */ - SAFE_MOUNT(cleanup, "none", "/", "none", MS_REC|MS_PRIVATE, NULL); + SAFE_MOUNT("none", "/", "none", MS_REC | MS_PRIVATE, NULL); /* bind mounts DIRA to itself */ - SAFE_MOUNT(cleanup, DIRA, DIRA, "none", MS_BIND, NULL); + SAFE_MOUNT(DIRA, DIRA, "none", MS_BIND, NULL); + /* makes mount DIRA unbindable */ - SAFE_MOUNT(cleanup, "none", DIRA, "none", MS_UNBINDABLE, NULL); + SAFE_MOUNT("none", DIRA, "none", MS_UNBINDABLE, NULL); /* tries to bind mount unbindable DIRA to DIRB which should fail */ if (mount(DIRA, DIRB, "none", MS_BIND, NULL) == -1) { - tst_resm(TPASS, "unbindable mount passed"); + tst_res(TPASS, "unbindable mount passed"); } else { - SAFE_UMOUNT(cleanup, DIRB); - tst_resm(TFAIL, "unbindable mount faled"); + SAFE_UMOUNT(DIRB); + tst_res(TFAIL, "unbindable mount faled"); } - SAFE_UMOUNT(cleanup, DIRA); + SAFE_UMOUNT(DIRA); } -int main(int argc, char *argv[]) +static void setup(void) { - int lc; - - tst_parse_opts(argc, argv, NULL, NULL); - - setup(); - - for (lc = 0; TEST_LOOPING(lc); lc++) - test(); - - cleanup(); - tst_exit(); + check_newns(); + create_folders(); } -#else -int main(void) +static void cleanup(void) { - tst_brkm(TCONF, NULL, "needed mountflags are not defined"); + umount_folders(); } -#endif + +static struct tst_test test = { + .setup = setup, + .cleanup = cleanup, + .test_all = run, + .needs_root = 1, + .needs_checkpoints = 1, +}; From patchwork Tue Mar 1 09:15:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1599267 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=RRMMXB6X; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=x3OtYxNX; dkim-atps=neutral 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7Fl43wYsz9sBy for ; Tue, 1 Mar 2022 22:44:00 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1D7133CA305 for ; Tue, 1 Mar 2022 10:16:20 +0100 (CET) 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 4EBC53CA2EA for ; Tue, 1 Mar 2022 10:15:24 +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-3.smtp.seeweb.it (Postfix) with ESMTPS id A14EE1A010F9 for ; Tue, 1 Mar 2022 10:15:23 +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 19ECA1F37E; Tue, 1 Mar 2022 09:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646126123; 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: in-reply-to:in-reply-to:references:references; bh=WJdMA/s7Ef5RGYTzGIgsQnDZb7f+Q+FKJ5U8OJilMTg=; b=RRMMXB6XYHVZO8iSvjccdVmuhUMdYbcnW/y2vy3ZPYYK7bY44NJct+dvHyTur68tSP7uWp qs9h+iznJrIZBQ1hn26y/W5nkpNmvIU0/deXMoiGKpssbIWVJsBXEIH5ObQizXfDz4FuMA cb56Z/u3e2Ku7LgKB/nkkX78HrRkGdc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646126123; 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: in-reply-to:in-reply-to:references:references; bh=WJdMA/s7Ef5RGYTzGIgsQnDZb7f+Q+FKJ5U8OJilMTg=; b=x3OtYxNXNxYkjo69SdD8g0WFGpolVgfAsMXHuoJitLfnbAHR5xtb0vteS5jbBQZ/wWIDvF SgPDpgmQdhB/qnAg== 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 AC15613B08; Tue, 1 Mar 2022 09:15:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qJwVKCrkHWJ3VwAAMHmgww (envelope-from ); Tue, 01 Mar 2022 09:15:22 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 10:15:16 +0100 Message-Id: <20220301091517.11142-6-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220301091517.11142-1-andrea.cervesato@suse.de> References: <20220301091517.11142-1-andrea.cervesato@suse.de> 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, 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-3.smtp.seeweb.it Subject: [LTP] [PATCH v3 5/6] Removed obsolete mountns_helper.h 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: Andrea Cervesato --- .../containers/mountns/mountns_helper.h | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 testcases/kernel/containers/mountns/mountns_helper.h diff --git a/testcases/kernel/containers/mountns/mountns_helper.h b/testcases/kernel/containers/mountns/mountns_helper.h deleted file mode 100644 index 4b4538eb8..000000000 --- a/testcases/kernel/containers/mountns/mountns_helper.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) 2014 Red Hat, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of version 2 the GNU General Public License as - * published by the Free Software Foundation. - * - * 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, see . - */ - -#include "libclone.h" -#include "test.h" -#include "safe_macros.h" - -#define DIRA "A" -#define DIRB "B" - -static int dummy_child(void *v) -{ - (void) v; - return 0; -} - -static int check_newns(void) -{ - int pid, status; - - if (tst_kvercmp(2, 4, 19) < 0) - tst_brkm(TCONF, NULL, "CLONE_NEWNS not supported"); - - pid = do_clone_unshare_test(T_CLONE, CLONE_NEWNS, dummy_child, NULL); - if (pid == -1) - tst_brkm(TCONF | TERRNO, NULL, "CLONE_NEWNS not supported"); - SAFE_WAIT(NULL, &status); - - return 0; -} - -static void cleanup(void) -{ - umount(DIRA); - umount(DIRB); - tst_rmdir(); -} - -static void setup(void) -{ - tst_require_root(); - check_newns(); - tst_tmpdir(); - TST_CHECKPOINT_INIT(tst_rmdir); - SAFE_MKDIR(cleanup, DIRA, 0777); - SAFE_MKDIR(cleanup, DIRB, 0777); - SAFE_TOUCH(cleanup, DIRA"/A", 0, NULL); - SAFE_TOUCH(cleanup, DIRB"/B", 0, NULL); -} From patchwork Tue Mar 1 09:15:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Cervesato X-Patchwork-Id: 1599269 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=uXDlvqHY; dkim=fail reason="signature verification failed" header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=WTrMeXud; dkim-atps=neutral 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4K7Fl81pM7z9s8s for ; Tue, 1 Mar 2022 22:44:04 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id B70753CA2FF for ; Tue, 1 Mar 2022 10:16:29 +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 83F863CA2EC for ; Tue, 1 Mar 2022 10:15:24 +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 166DD1400BC9 for ; Tue, 1 Mar 2022 10:15:24 +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 B2F9F1F3A8; Tue, 1 Mar 2022 09:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1646126123; 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: in-reply-to:in-reply-to:references:references; bh=W2EVAAATpdwiOm9lBKLfQh8wLJPawPrc5VqApkuahc8=; b=uXDlvqHY9hksjFswBRThIWApiWyu3fO9BkciCc+9H9XZ04mjmmeDYBRqMrQ219jYNyfJ/Q P3J2yVjxlzywFXClI2ESPs+eFP/byeGsAOOEB3B4S4hSlGNwkNkCHYsEdezI69G3BgNH57 CZeflZXvYmLgljZcqNJqvFoPVQeTJLQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1646126123; 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: in-reply-to:in-reply-to:references:references; bh=W2EVAAATpdwiOm9lBKLfQh8wLJPawPrc5VqApkuahc8=; b=WTrMeXudfaGCZlaMW4HSTzbM1eyQBqW5Fnjn3LwWIA0Vn2bkzSLSX3PKR9yvh8tILscC0v PzcqhPFYx/M5JCAw== 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 4851413B08; Tue, 1 Mar 2022 09:15:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wBegCivkHWJ3VwAAMHmgww (envelope-from ); Tue, 01 Mar 2022 09:15:23 +0000 From: Andrea Cervesato To: ltp@lists.linux.it Date: Tue, 1 Mar 2022 10:15:17 +0100 Message-Id: <20220301091517.11142-7-andrea.cervesato@suse.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220301091517.11142-1-andrea.cervesato@suse.de> References: <20220301091517.11142-1-andrea.cervesato@suse.de> 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 v3 6/6] Removed libclone usage from mountns testing suite 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: Andrea Cervesato --- testcases/kernel/containers/mountns/Makefile | 21 +++----------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/testcases/kernel/containers/mountns/Makefile b/testcases/kernel/containers/mountns/Makefile index bd42bf41b..16284f4d5 100644 --- a/testcases/kernel/containers/mountns/Makefile +++ b/testcases/kernel/containers/mountns/Makefile @@ -1,23 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2014 Red Hat, Inc. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of version 2 the GNU General Public License as -# published by the Free Software Foundation. -# -# 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, see . -############################################################################## +# Copyright (C) 2021 SUSE LLC Andrea Cervesato -top_srcdir ?= ../../../.. +top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc - -LDLIBS := -lclone $(LDLIBS) - include $(top_srcdir)/include/mk/generic_leaf_target.mk