home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff219.lzh
/
Mv
/
mvtest.sh
< prev
next >
Wrap
Text File
|
1989-06-04
|
6KB
|
299 lines
#
# Regression test script for mv/cp/rm
#
# Copyright 1989 Edwin Hoogerbeets
#
# This code may be freely redistributed as long as no charges other than
# reasonable copying fees are levied for it.
#
# This script is for the Dillon/Drew shell. To see what the utilities
# are doing, compile with -DDEBUG and then source this script for a
# verbose listing of what's happening.
#
# create the test environment
echo mkdir foo
mkdir foo
echo cp * foo
cp * foo
#
# test mv on same volume
#
# mv directory to a new name
# expected result: foo will be renamed to bar
echo mv foo bar
mv foo bar
# mv directory to existing directory
# expected result: bar will be renamed foo/bar
echo mkdir foo
mkdir foo
echo mv bar foo
mv bar foo
# mv file to directory
# expected result: rm will be renamed to foo
echo mv rm foo
mv rm foo
# mv multiple files to directory
# expected result: foo/rm and cp will be renamed to foobar/rm and foobar/cp
echo mv foo/rm cp foobar
mv foo/rm cp foobar
# test "" as current directory
# expected results: everything in the foobar directory will be renamed
# under the current directory
echo foobar/* \"\"
mv foobar/* \"\"
# mv multiple directories to directory
# expected result: foo and foobar will be renamed to barfoo/foo
# and barfoo/foobar
echo mkdir barfoo
mkdir barfoo
echo mv foo foobar barfoo
mv foo foobar barfoo
# mv file to file
# expected result: rm will be renamed to arm and back to rm
echo mv rm arm
mv rm arm
echo mv arm rm
mv arm rm
echo mv barfoo/foo \"\"
mv barfoo/foo \"\"
#
# test mv across volumes
#
echo mkdir ram:foo
mkdir ram:foo
# mv directory to existing directory
# expected result: foo will get recursively moved to ram:foo
echo mv foo ram:
mv foo ram:
# mv directory to a non-existant directory
# expected result: ram:foo will get recursively moved to rad:foo
echo mv ram:foo rad:foo
mv ram:foo rad:foo
# mv file to existing directory
# expected result: rm will get moved to ram:rm
echo mv rm ram:
mv rm ram:
# mv file to non-existant name
# expected result: ram:rm will be moved to arm and then to rm
echo mv ram:rm arm
mv ram:rm arm
echo mv arm rm
mv arm rm
#
# test cp
#
# create the test environment
echo mkdir foo
mkdir foo
echo cp * foo
cp * foo
echo cat "<nil: >bar"
cat <nil: >bar
# copy a zero length file
echo cp bar booboo
cp bar booboo
echo rm bar booboo
rm bar booboo
# copy directory to new directory
# expected result: foo/* will be copied to be asdf/*
echo cp -r foo asdf
cp -r foo asdf
# copy multiple directories to a directory
# expected result: foo/* and asdf/* will be copied to fooasdf/foo/*
# and to fooasdf/asdf/* respectively
echo cp -r foo asdf fooasdf
cp -r foo asdf fooasdf
# copy directory to existing directory
# expected result: barfoo/* will be copied to asdf/barfoo/*
echo cp -r barfoo asdf
cp -r barfoo asdf
# copy files to directory
# expected result: cp rm and mv will be copied to asdf/cp asdf/rm
# and asdf/mv
echo cp rm cp mv asdf
cp rm cp mv asdf
# test [lack of] -r option
# expected result: complain about directories not being copied
echo cp * asdf
cp * asdf
# cp across volumes (this test shouldn't matter)
# expected result: * will be copied to ram:asdf/*
echo cp * ram:asdf
cp * ram:asdf
#
# test rm
#
echo cd asdf
cd asdf
# test [lack of] -r option
# expected result: only files will be erased
echo rm *
rm *
# test -r option
# expected result: directories and all will be erased
echo rm -r *
rm -r *
echo cd /
cd /
#
# test -i option
#
# expected result: directory creation and clobbering files will be okayed
# before proceding
echo mv -i rad:foo ram:foo
mv -i rad:foo ram:foo
#
# test delete protection and -f option
#
# set up
echo rm -r foo
rm -r foo
echo cp rm foo
cp rm foo
echo protect foo rwe
protect foo rwe
# test copying to a delete protected file
# expected result: should ask for permission to overwrite foo
echo cp rm foo
cp rm foo
echo protect foo rwe
protect foo rwe
# test -f option on mv
# expected result: rm will be renamed to foo despite delete protect
echo mv -f rm foo
mv -f rm foo
echo protect foo rwe
protect foo rwe
# test -f option on rm
# expected result: foo will be deleted no problem
echo rm -f foo
rm -f foo
echo cp cp rm
cp cp rm
#
# test - option
#
# set up
echo mkdir -d
mkdir -d
# expected result: -d will be recursively removed
echo rm -r - -d
rm -r - -d
#
# test bad input
#
# move non-existant files
# expected result: complain about no access to non-existant files
echo mv FidgeMeJerk Kawanga BoongaBoonga Maximillian
mv FidgeMeJerk Kawanga BoongaBoonga Maximillian
# remove non-existant file
# expected result: complain about could not remove non-existant files
echo rm foobarandgrill
rm foobarandgrill
# copy or move to the same file
# expected result: mv works but cp should complain about not being
# able to copy a file to itself
echo mv cp Cp
mv cp Cp
echo cp mv mv
cp mv mv
# no args
# expected result: usage info displayed
echo cp
cp
# no files
# expected result: usage info displayed
echo cp -r
cp -r
# bad options
# expected result: complain about bad option and usage
echo cp -q
cp -q
# not enough args
# expected result: usage info displayed
echo mv foo
mv foo
# move directory onto a file
# expected result: complain and give usage
echo mv asdf rm
mv asdf rm
#
# Test wildcarding (needs to compiled with -DARP and linked with -la32)
#
# expected result: everything will get copied to the new directory asdf
echo cp "*" asdf
cp "*" asdf
# expected result: everything will get copied to the new directory asdf
echo cp "#?" asdf
cp "#?" asdf
# expected result: two letter file names will get copied to directory asdf
echo cp "??" asdf
cp "??" asdf
#
# cleanup
#
echo rm -fr asdf barfoo ram:asdf ram:foo foo fooasdf Maximillian rad:bar
rm -fr asdf barfoo ram:asdf ram:foo foo fooasdf Maximillian rad:bar