From 57a671d991f213c73c1382c26503ad474916db90 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Wed, 23 Aug 2023 02:52:32 +0000 Subject: [PATCH] LU-17038 tests: remove mlink utility The mlink utility is nearly identical to the link utility provided by coreutils. They only differ by some GNU boilerplate. All tests using mlink are replaced with link. Luckily, mlink is only used in a few places. Used the following command: `git grep -i mlink | grep -i -v symlink` to track down all uses of mlink. Test-Parameters: trivial testlist=recovery-small Signed-off-by: Timothy Day Change-Id: I197235572d2cb267ee68930c64058e4f5ffe5be1 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52051 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/tests/.gitignore | 1 - lustre/tests/Makefile.am | 2 +- lustre/tests/mlink.c | 56 ------------------------------------------ lustre/tests/recovery-small.sh | 4 +-- lustre/tests/sanity.sh | 51 +++++++++++++++++++------------------- 5 files changed, 28 insertions(+), 86 deletions(-) delete mode 100644 lustre/tests/mlink.c diff --git a/lustre/tests/.gitignore b/lustre/tests/.gitignore index 49ad395..15bc7b6 100644 --- a/lustre/tests/.gitignore +++ b/lustre/tests/.gitignore @@ -52,7 +52,6 @@ /mcreate /memhog /mirror_io -/mlink /mmap_cat /mmap_mknod_test /mmap_sanity diff --git a/lustre/tests/Makefile.am b/lustre/tests/Makefile.am index 5a62b92..cb67f4b 100644 --- a/lustre/tests/Makefile.am +++ b/lustre/tests/Makefile.am @@ -56,7 +56,7 @@ nobase_noinst_DATA += clientapi/simple_test.c EXTRA_DIST = $(noinst_SCRIPTS) $(noinst_DATA) \ $(nobase_noinst_SCRIPTS) $(nobase_noinst_DATA) -THETESTS = openunlink truncate directio writeme mlink utime +THETESTS = openunlink truncate directio writeme utime THETESTS += tchmod fsx test_brw sendfile THETESTS += createmany chownmany statmany multifstat createtest THETESTS += opendirunlink opendevunlink unlinkmany checkstat diff --git a/lustre/tests/mlink.c b/lustre/tests/mlink.c deleted file mode 100644 index 80aa672..0000000 --- a/lustre/tests/mlink.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * 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 version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.gnu.org/licenses/gpl-2.0.html - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2013, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - */ - -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char ** argv) -{ - int rc; - - if (argc < 3) { - fprintf(stderr, "usage: %s file link\n", argv[0]); - return 1; - } - - rc = link(argv[1], argv[2]); - if (rc) { - fprintf(stderr, "link(%s, %s) error: %s\n", - argv[1], argv[2], strerror(errno)); - return errno; - } - return 0; -} diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 775f9c0..7a4ec2b 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -90,8 +90,8 @@ test_6() { local LINK2=$DIR/$tfile.link2 do_facet_create_file client $T 10K || error_noexit "Create file $T" - drop_request "mlink $T $LINK1" || error_noexit "mlink request for $T" - drop_reint_reply "mlink $T $LINK2" || error_noexit "mlink reply for $T" + drop_request "link $T $LINK1" || error_noexit "link request for $T" + drop_reint_reply "link $T $LINK2" || error_noexit "link reply for $T" drop_request "unlink $LINK1" || error_noexit "unlink request for $T" drop_reint_reply "unlink $LINK2" || error_noexit "unlink reply for $T" do_facet client "rm $T" || error_noexit "Can't remove file $T" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 9370b9c..7009ab2 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3725,26 +3725,25 @@ test_31j() { test_mkdir -c1 -p $DIR/$tdir/dir1 ln $DIR/$tdir/dir1 $DIR/$tdir/dir2 && error "ln for dir" link $DIR/$tdir/dir1 $DIR/$tdir/dir3 && error "link for dir" - mlink $DIR/$tdir/dir1 $DIR/$tdir/dir4 && error "mlink for dir" - mlink $DIR/$tdir/dir1 $DIR/$tdir/dir1 && error "mlink to the same dir" + link $DIR/$tdir/dir1 $DIR/$tdir/dir1 && error "link to the same dir" return 0 } -run_test 31j "link for directory===============" +run_test 31j "link for directory" test_31k() { - test_mkdir -c1 -p $DIR/$tdir - touch $DIR/$tdir/s - touch $DIR/$tdir/exist - mlink $DIR/$tdir/s $DIR/$tdir/t || error "mlink" - mlink $DIR/$tdir/s $DIR/$tdir/exist && error "mlink to exist file" - mlink $DIR/$tdir/s $DIR/$tdir/s && error "mlink to the same file" - mlink $DIR/$tdir/s $DIR/$tdir && error "mlink to parent dir" - mlink $DIR/$tdir $DIR/$tdir/s && error "mlink parent dir to target" - mlink $DIR/$tdir/not-exist $DIR/$tdir/foo && error "mlink non-existing to new" - mlink $DIR/$tdir/not-exist $DIR/$tdir/s && error "mlink non-existing to exist" + test_mkdir -c1 -p $DIR/$tdir + touch $DIR/$tdir/s + touch $DIR/$tdir/exist + link $DIR/$tdir/s $DIR/$tdir/t || error "link" + link $DIR/$tdir/s $DIR/$tdir/exist && error "link to exist file" + link $DIR/$tdir/s $DIR/$tdir/s && error "link to the same file" + link $DIR/$tdir/s $DIR/$tdir && error "link to parent dir" + link $DIR/$tdir $DIR/$tdir/s && error "link parent dir to target" + link $DIR/$tdir/not-exist $DIR/$tdir/foo && error "link non-existing to new" + link $DIR/$tdir/not-exist $DIR/$tdir/s && error "link non-existing to exist" return 0 } -run_test 31k "link to file: the same, non-existing, dir===============" +run_test 31k "link to file: the same, non-existing, dir" test_31l() { local ln_ver=$(ln --version | awk '/coreutils/ { print $4 }') @@ -3760,19 +3759,19 @@ test_31l() { run_test 31l "link to file: target dir has trailing slash" test_31m() { - mkdir $DIR/d31m - touch $DIR/d31m/s - mkdir $DIR/d31m2 - touch $DIR/d31m2/exist - mlink $DIR/d31m/s $DIR/d31m2/t || error "mlink" - mlink $DIR/d31m/s $DIR/d31m2/exist && error "mlink to exist file" - mlink $DIR/d31m/s $DIR/d31m2 && error "mlink to parent dir" - mlink $DIR/d31m2 $DIR/d31m/s && error "mlink parent dir to target" - mlink $DIR/d31m/not-exist $DIR/d31m2/foo && error "mlink non-existing to new" - mlink $DIR/d31m/not-exist $DIR/d31m2/s && error "mlink non-existing to exist" + mkdir $DIR/d31m + touch $DIR/d31m/s + mkdir $DIR/d31m2 + touch $DIR/d31m2/exist + link $DIR/d31m/s $DIR/d31m2/t || error "link" + link $DIR/d31m/s $DIR/d31m2/exist && error "link to exist file" + link $DIR/d31m/s $DIR/d31m2 && error "link to parent dir" + link $DIR/d31m2 $DIR/d31m/s && error "link parent dir to target" + link $DIR/d31m/not-exist $DIR/d31m2/foo && error "link non-existing to new" + link $DIR/d31m/not-exist $DIR/d31m2/s && error "link non-existing to exist" return 0 } -run_test 31m "link to file: the same, non-existing, dir===============" +run_test 31m "link to file: the same, non-existing, dir" test_31n() { touch $DIR/$tfile || error "cannot create '$DIR/$tfile'" @@ -3794,7 +3793,7 @@ run_test 31n "check link count of unlinked file" link_one() { local tempfile=$(mktemp $1_XXXXXX) - mlink $tempfile $1 2> /dev/null && + link $tempfile $1 2> /dev/null && echo "$BASHPID: link $tempfile to $1 succeeded" unlink $tempfile } -- 1.8.3.1