Whamcloud - gitweb
LU-17038 tests: remove munlink utility 77/51977/4
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 17 Aug 2023 22:06:36 +0000 (16:06 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 31 Aug 2023 06:40:30 +0000 (06:40 +0000)
The munlink utility is obsoleted by the unlink command added in
the coreutils package many moons ago, and can be removed.  All
tests using munlink are replaced with unlink.

Test-Parameters: trivial testlist=recovery-small,replay-dual,replay-single
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I984406525ed958814bd8af74a2d81c4920e320b0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51977
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
debian/lustre-tests.install
debian/rules
lustre.spec.in
lustre/tests/.gitignore
lustre/tests/Makefile.am
lustre/tests/munlink.c [deleted file]
lustre/tests/recovery-small.sh
lustre/tests/replay-dual.sh
lustre/tests/replay-single.sh
lustre/tests/sanity.sh

index 5972ff0..e90eafe 100644 (file)
@@ -1,5 +1,4 @@
 debian/tmp/usr/lib/lustre/tests/*      usr/lib/lustre/tests
 debian/tmp/usr/bin/mcreate             usr/bin
-debian/tmp/usr/bin/munlink             usr/bin
 debian/tmp/usr/bin/statx               usr/bin
 debian/tmp/usr/sbin/wire*              usr/sbin
index d0cd233..87edcda 100755 (executable)
@@ -262,7 +262,6 @@ binary-$(UTILS_PKG): build-stamp
        rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \
               debian/$(UTILS_PKG)/usr/bin/*-survey \
               debian/$(UTILS_PKG)/usr/bin/mcreate \
-              debian/$(UTILS_PKG)/usr/bin/munlink \
               debian/$(UTILS_PKG)/usr/bin/statx \
               debian/$(UTILS_PKG)/usr/sbin/wirecheck \
               debian/$(UTILS_PKG)/usr/sbin/wiretest
index a4d1121..f6e11d3 100644 (file)
@@ -748,7 +748,6 @@ echo '%dir %{_libdir}/lustre' >>lustre-tests.files
 echo '%dir %{_libdir}/lustre/tests' >>lustre-tests.files
 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
 echo '%{_bindir}/mcreate' >>lustre-tests.files
-echo '%{_bindir}/munlink' >>lustre-tests.files
 echo '%{_bindir}/statx' >>lustre-tests.files
 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
 echo '%{_sbindir}/wiretest' >>lustre-tests.files
index cc7d016..49ad395 100644 (file)
@@ -59,7 +59,6 @@
 /mrename
 /multifstat
 /multiop
-/munlink
 /newfile
 /o_directory
 /open_delay
index e99b9f2..5a62b92 100644 (file)
@@ -95,7 +95,7 @@ if BUILD_LUTF
 SUBDIRS += lutf
 endif # BUILD_LUTF
 
-bin_PROGRAMS = mcreate munlink statx
+bin_PROGRAMS = mcreate statx
 testdir = $(libdir)/lustre/tests
 test_SCRIPTS = $(noinst_SCRIPTS)
 test_PROGRAMS = $(THETESTS)
diff --git a/lustre/tests/munlink.c b/lustre/tests/munlink.c
deleted file mode 100644 (file)
index 0b8e253..0000000
+++ /dev/null
@@ -1,61 +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) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-int main(int argc, char **argv)
-{
-       int rc = 0, i;
-
-       if (argc < 2) {
-               printf("Usage %s filename {filename ...}\n", argv[0]);
-               return 1;
-       }
-
-       for (i = 1; i < argc; i++) {
-               rc = unlink(argv[i]);
-               if (rc) {
-                       printf("unlink(%s): %s ", argv[i], strerror(errno));
-                       rc = access(argv[i], F_OK);
-                       if (rc && errno == ENOENT)
-                               printf("(unlinked anyways)\n");
-                       else if (rc == 0)
-                               printf("(still exists)\n");
-                       else
-                               printf("(%s looking up)\n", strerror(errno));
-               }
-       }
-       return rc;
-}
index 81ff00c..775f9c0 100755 (executable)
@@ -89,23 +89,12 @@ test_6() {
        local LINK1=$DIR/$tfile.link1
        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 "munlink $LINK1" ||
-               error_noexit "munlink request for $T"
-
-       drop_reint_reply "munlink $LINK2" ||
-               error_noexit "munlink reply for $T"
-
-       do_facet client "rm $T" ||
-               error_noexit "Can't remove file $T"
+       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 "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"
 }
 run_test 6 "link, unlink: drop req, drop rep"
 
@@ -331,8 +320,8 @@ test_11(){
        drop_bl_callback_once $MULTIOP $DIR/$tfile Ow ||
                echo "evicted as expected"
 
-       do_facet client munlink $DIR/$tfile ||
-               { error "munlink failed: $?"; return 4; }
+       do_facet client unlink $DIR/$tfile ||
+               { error "unlink failed: $?"; return 4; }
        # allow recovery to complete
        client_up || client_up || sleep $TIMEOUT
 }
@@ -350,8 +339,8 @@ test_12(){
        kill -USR1 $PID
        echo "waiting for multiop $PID"
        wait $PID || { error "wait for multiop faile: $?"; return 2; }
-       do_facet client munlink $DIR/$tfile ||
-               { error "client munlink failed: $?"; return 3; }
+       do_facet client unlink $DIR/$tfile ||
+               { error "client unlink failed: $?"; return 3; }
        # allow recovery to complete
        client_up || client_up || sleep $TIMEOUT
 }
@@ -692,7 +681,7 @@ test_19b() {
                error "failed to ldlm_cancel: $?"
 
        umount_client $DIR2 || error "failed to unmount $DIR2: $?"
-       do_facet client munlink $DIR/$tfile ||
+       do_facet client unlink $DIR/$tfile ||
                error "failed to unlink $DIR/$tfile: $?"
 
        # let the client reconnect
index 9043d62..693a299 100755 (executable)
@@ -233,7 +233,7 @@ run_test 9 "resending a replayed create"
 test_10() {
        mcreate $MOUNT1/$tfile-1
        replay_barrier $SINGLEMDS
-       munlink $MOUNT1/$tfile-1
+       unlink $MOUNT1/$tfile-1
        mcreate $MOUNT2/$tfile-2
        # drop first reint reply
        do_facet $SINGLEMDS lctl set_param fail_loc=0x80000119
index 69a478b..57013f1 100755 (executable)
@@ -398,12 +398,12 @@ run_test 15 "open(O_CREAT), unlink |X|  touch new, close"
 test_16() {
        replay_barrier $SINGLEMDS
        mcreate $DIR/$tfile
-       munlink $DIR/$tfile
+       unlink $DIR/$tfile
        mcreate $DIR/$tfile-2
        fail $SINGLEMDS
        [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
        [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
-       munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
+       unlink $DIR/$tfile-2 || error "unlink $DIR/$tfile-2 failed"
 }
 run_test 16 "|X| open(O_CREAT), unlink, touch new,  unlink new"
 
@@ -437,8 +437,8 @@ test_18() {
        [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
        # this touch frequently fails
        touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
-       munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
-       munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
+       unlink $DIR/$tfile-2 || error "unlink $DIR/$tfile-2 failed"
+       unlink $DIR/$tfile-3 || error "unlink $DIR/$tfile-3 failed"
        return 0
 }
 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
index 8892d80..9370b9c 100755 (executable)
@@ -19,7 +19,6 @@ LVERIFY=${LVERIFY:-ll_dirstripe_verify}
 OPENFILE=${OPENFILE:-openfile}
 OPENUNLINK=${OPENUNLINK:-openunlink}
 READS=${READS:-"reads"}
-MUNLINK=${MUNLINK:-munlink}
 SOCKETSERVER=${SOCKETSERVER:-socketserver}
 SOCKETCLIENT=${SOCKETCLIENT:-socketclient}
 MEMHOG=${MEMHOG:-memhog}
@@ -3797,7 +3796,7 @@ link_one() {
        local tempfile=$(mktemp $1_XXXXXX)
        mlink $tempfile $1 2> /dev/null &&
                echo "$BASHPID: link $tempfile to $1 succeeded"
-       munlink $tempfile
+       unlink $tempfile
 }
 
 test_31o() { # LU-2901
@@ -5441,7 +5440,7 @@ test_42b() {
        sync
        dd if=/dev/zero of=$DIR/f42b bs=1024 count=100
        BEFOREWRITES=$(count_ost_writes)
-       $MUNLINK $DIR/f42b || error "$MUNLINK $DIR/f42b: $?"
+       unlink $DIR/f42b || error "unlink $DIR/f42b: $?"
        AFTERWRITES=$(count_ost_writes)
        if [[ $BEFOREWRITES -lt $AFTERWRITES ]]; then
                error "$BEFOREWRITES < $AFTERWRITES on unlink"
@@ -6256,7 +6255,7 @@ test_54a() {
                error "$SOCKETSERVER $DIR/socket failed: $?"
        LANG=C $SOCKETCLIENT $DIR/socket ||
                error "$SOCKETCLIENT $DIR/socket failed: $?"
-       $MUNLINK $DIR/socket || error "$MUNLINK $DIR/socket failed: $?"
+       unlink $DIR/socket || error "unlink $DIR/socket failed: $?"
 }
 run_test 54a "unix domain socket test =========================="