logo

utils-std

Collection of commonly available Unix tools
commit: bf456c133eebac0a5d6f30d952eb81f01752482c
parent 1c46b8aecfd0489eab59f53e157700c45323776d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed, 31 Jul 2024 13:37:12 +0200

test-cmd/mv.t: Skip if /dev/shm doesn't exists

Diffstat:

Atest-cmd/mv-devshm.t28++++++++++++++++++++++++++++
Mtest-cmd/mv.t15---------------
2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/test-cmd/mv-devshm.t b/test-cmd/mv-devshm.t @@ -0,0 +1,28 @@ +#!/usr/bin/env cram +# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> +# SPDX-License-Identifier: MPL-2.0 + + $ export PATH="$TESTDIR/../cmd:$PATH" + + $ test "$(command -v mv)" = "$TESTDIR/../cmd/mv" + +Skip if /dev/shm doesn't exists + $ test -d /dev/shm || exit 80 + +Successfully moves directory contents accross filesystems + $ mkdir non-empty-dir + $ touch non-empty-dir/foo + $ mkdir non-empty-dir/foo.d + $ touch non-empty-dir/foo.d/bar + $ test -f non-empty-dir/foo + $ test -f non-empty-dir/foo.d/bar + $ rm -f /dev/shm/mv-test-non-empty-dir + $ mv non-empty-dir /dev/shm/mv-test-non-empty-dir + $ test -f /dev/shm/mv-test-non-empty-dir/foo + $ test -f /dev/shm/mv-test-non-empty-dir/foo.d/bar + $ test ! -e non-empty-dir + $ rm -fr /dev/shm/mv-test-non-empty-dir + +No files should be left + $ find . + . diff --git a/test-cmd/mv.t b/test-cmd/mv.t @@ -135,21 +135,6 @@ Last component used for destination filename $ test -f dest_last/file $ rm -r src_last dest_last -Successfully moves directory contents accross filesystems -(Assuming /dev/shm is a separated fs, as it should be when present) - $ mkdir non-empty-dir - $ touch non-empty-dir/foo - $ mkdir non-empty-dir/foo.d - $ touch non-empty-dir/foo.d/bar - $ test -f non-empty-dir/foo - $ test -f non-empty-dir/foo.d/bar - $ rm -f /dev/shm/mv-test-non-empty-dir - $ mv non-empty-dir /dev/shm/mv-test-non-empty-dir - $ test -f /dev/shm/mv-test-non-empty-dir/foo - $ test -f /dev/shm/mv-test-non-empty-dir/foo.d/bar - $ test ! -e non-empty-dir - $ rm -fr /dev/shm/mv-test-non-empty-dir - No files should be left $ find . .