summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorErik Andersen2000-03-04 21:19:32 +0000
committerErik Andersen2000-03-04 21:19:32 +0000
commit029011b9eeaf491d00fda1d072c4c6094df96c3a (patch)
tree7c49f1fc1547a2f9cee812472f422a5c1a5c448b /tests
parent7c4b2f3fe5cb6b9a5c6bd089c18279c5ce29dc21 (diff)
downloadbusybox-029011b9eeaf491d00fda1d072c4c6094df96c3a.zip
busybox-029011b9eeaf491d00fda1d072c4c6094df96c3a.tar.gz
A few updates (including the cp fix the Craig has been looking for)
-Erik
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile23
-rw-r--r--tests/cp_tests.mk170
-rw-r--r--tests/ln_tests.mk9
-rw-r--r--tests/mv_tests.mk41
4 files changed, 165 insertions, 78 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 0156344..c4fb0e9 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,16 +1,21 @@
-all test_all: message_header cp_tests mv_tests ln_tests
+# busybox/tests/Makefile - Run through all defined tests.
+# ------------------------
+# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
-clean: cp_clean mv_clean ln_clean
+all:: message_header
message_header:
@echo
- @echo If tests faile due to differences in timestamps in commands that are not set
- @echo to preserve timestamps, just run the tests again.
+ @echo BusyBox Test Suite.
@echo
-include cp_tests.mk
-include mv_tests.mk
-include ln_tests.mk
+clean::
+
+distclean: clean
+
+.PHONY: all clean distclean message_header
+
+include $(wildcard *_tests.mk)
BBL := $(shell pushd .. >/dev/null && \
${MAKE} busybox.links >/dev/null && \
@@ -21,8 +26,6 @@ BBL := $(shell pushd .. >/dev/null && \
../busybox:
cd .. && ${MAKE} busybox
-$(BBL): ../busybox
+${BBL}: ../busybox
rm -f $@
ln ../busybox $@
-
-.PHONY: all test_all message_header
diff --git a/tests/cp_tests.mk b/tests/cp_tests.mk
index e14262a..e79f2b3 100644
--- a/tests/cp_tests.mk
+++ b/tests/cp_tests.mk
@@ -1,18 +1,23 @@
-# This is a -*- makefile -*-
+# cp_tests.mk - Set of test cases for busybox cp
+# -------------
+# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
+#
# GNU `cp'
GCP = /bin/cp
# BusyBox `cp'
BCP = $(shell pwd)/cp
-.PHONY: cp_clean
+all:: cp_tests
+clean:: cp_clean
+
cp_clean:
- rm -rf cp_tests cp_*.{gnu,bb} cp
+ - rm -rf cp_tests cp_*.{gnu,bb} cp
-.PHONY: cp_tests
cp_tests: cp_clean cp
@echo;
@echo "No output from diff means busybox cp is functioning properly.";
+ @echo "Some tests might show timestamp differences that are Ok.";
@echo;
${BCP} || true;
@@ -20,7 +25,8 @@ cp_tests: cp_clean cp
@echo;
mkdir cp_tests;
- @echo;
+ # Copy a file to a copy of the file
+ @echo ------------------------------;
cd cp_tests; \
echo A file > afile; \
ls -l afile > ../cp_afile_afilecopy.gnu; \
@@ -28,7 +34,7 @@ cp_tests: cp_clean cp
ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
@echo;
- rm -f cp_tests/afile*;
+ rm -rf cp_tests/*;
@echo;
cd cp_tests; \
@@ -38,118 +44,135 @@ cp_tests: cp_clean cp
ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
@echo;
- diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
+ @echo Might show timestamp differences.
+ -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
@echo;
- rm -f cp_tests/afile*;
+ rm -rf cp_tests/*;
- @echo; echo;
+ # Copy a file pointed to by a symlink
+ @echo; echo ------------------------------;
cd cp_tests; \
- mkdir there there1; \
- cd there; \
- ln -s ../afile .;
+ mkdir here there; \
+ echo A file > afile; \
+ cd here; \
+ ln -s ../afile .; \
@echo;
cd cp_tests; \
- echo A file > afile; \
- ls -l afile > ../cp_symlink.gnu; \
- ${GCP} there/afile there1/; \
- ls -l afile there/afile there1/afile >> ../cp_symlink.gnu;
+ ls -lR . > ../cp_symlink.gnu; \
+ ${GCP} here/afile there; \
+ ls -lR . >> ../cp_symlink.gnu;
@echo;
- rm -f cp_tests/afile cp_tests/there1/afile;
+ rm -rf cp_tests/there/*;
+
+ sleep 1;
@echo;
cd cp_tests; \
- echo A file > afile; \
- ls -l afile > ../cp_symlink.bb; \
- ${BCP} there/afile there1/; \
- ls -l afile there/afile there1/afile >> ../cp_symlink.bb;
+ ls -lR . > ../cp_symlink.bb; \
+ ${BCP} here/afile there; \
+ ls -lR . >> ../cp_symlink.bb;
@echo;
- diff -u cp_symlink.gnu cp_symlink.bb;
+ @echo Will show timestamp difference.
+ -diff -u cp_symlink.gnu cp_symlink.bb;
@echo;
- rm -f cp_tests/afile cp_tests/there1/afile;
+ rm -rf cp_tests/*
- @echo; echo;
+ # Copy a symlink, useing the -a switch.
+ @echo; echo ------------------------------;
cd cp_tests; \
echo A file > afile; \
- ls -l afile > ../cp_a_symlink.gnu; \
- ${GCP} -a there/afile there1/; \
- ls -l afile there/afile there1/afile >> ../cp_a_symlink.gnu;
+ mkdir here there; \
+ cd here; \
+ ln -s ../afile .
+
+ cd cp_test; \
+ ls -lR . > ../cp_a_symlink.gnu; \
+ ${GCP} -a here/afile there; \
+ ls -lR . >> ../cp_a_symlink.gnu;
@echo;
- rm -f cp_tests/afile cp_tests/there1/afile;
+ rm -f cp_tests/there/*;
+
+ sleep 1;
@echo;
cd cp_tests; \
echo A file > afile; \
- ls -l afile > ../cp_a_symlink.bb; \
- ${BCP} -a there/afile there1/; \
- ls -l afile there/afile there1/afile >> ../cp_a_symlink.bb;
+ ls -lR . > ../cp_a_symlink.bb; \
+ ${BCP} -a here/afile there; \
+ ls -lR . >> ../cp_a_symlink.bb;
@echo;
diff -u cp_a_symlink.gnu cp_a_symlink.bb;
@echo;
- rm -f cp_tests/afile
- rm -rf cp_tests/there{,1};
+ rm -f cp_tests/*;
- @echo; echo;
+ # Copy a directory into another directory with the -a switch
+ @echo; echo ------------------------------;
cd cp_tests; \
- echo A file > there/afile; \
- mkdir there/adir; \
- touch there/adir/afileinadir; \
- ln -s $(shell pwd) there/alink;
+ mkdir here there; \
+ echo A file > here/afile; \
+ mkdir here/adir; \
+ touch here/adir/afileinadir; \
+ ln -s $$(pwd) here/alink;
@echo;
cd cp_tests; \
- ${GCP} -a there/ there1/; \
- ls -lR there/ there1/ > ../cp_a_dir_dir.gnu;
+ ls -lR . > ../cp_a_dir_dir.gnu; \
+ ${GCP} -a here/ there/; \
+ ls -lR . >> ../cp_a_dir_dir.gnu;
@echo;
- rm -rf cp_tests/there1;
+ rm -rf cp_tests/there/*;
+
+ sleep 1;
@echo;
cd cp_tests; \
- ${BCP} -a there/ there1/; \
- ls -lR there/ there1/ > ../cp_a_dir_dir.bb;
+ ls -lR . > ../cp_a_dir_dir.bb; \
+ ${BCP} -a here/ there/; \
+ ls -lR . >> ../cp_a_dir_dir.bb;
@echo;
diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;
@echo;
- rm -rf cp_tests/there1/;
+ rm -rf cp_tests/*;
- @echo; echo;
+ # Copy a set of files to a directory.
+ @echo; echo ------------------------------;
cd cp_tests; \
echo A file number one > afile1; \
echo A file number two, blah. > afile2; \
ln -s afile1 symlink1; \
- mkdir there1; \
- ${GCP} afile1 afile2 symlink1 there1/; \
+ mkdir there;
+
+ cd cp_tests; \
+ ${GCP} afile1 afile2 symlink1 there/; \
ls -lR > ../cp_files_dir.gnu;
@echo;
- rm -rf cp_tests/{afile{1,2},symlink1,there1};
+ rm -rf cp_tests/there/*;
@echo;
cd cp_tests; \
- echo A file number one > afile1; \
- echo A file number two, blah. > afile2; \
- ln -s afile1 symlink1; \
- mkdir there1; \
- ${BCP} afile1 afile2 symlink1 there1/; \
+ ${BCP} afile1 afile2 symlink1 there/; \
ls -lR > ../cp_files_dir.bb;
@echo;
diff -u cp_files_dir.gnu cp_files_dir.bb;
@echo;
- rm -rf cp_tests/{afile{1,2},symlink1,there1};
+ rm -rf cp_tests/*;
- @echo; echo;
+ # Copy a set of files to a directory with the -d switch.
+ @echo; echo ------------------------------;
cd cp_tests; \
echo A file number one > afile1; \
echo A file number two, blah. > afile2; \
@@ -176,7 +199,8 @@ cp_tests: cp_clean cp
@echo;
rm -rf cp_tests/{afile{1,2},symlink1,there1};
- @echo; echo;
+ # Copy a set of files to a directory with the -p switch.
+ @echo; echo ------------------------------;
cd cp_tests; \
echo A file number one > afile1; \
echo A file number two, blah. > afile2; \
@@ -205,7 +229,8 @@ cp_tests: cp_clean cp
@echo;
rm -rf cp_tests/{afile{1,2},symlink1,there1};
- @echo; echo;
+ # Copy a set of files to a directory with -p and -d switches.
+ @echo; echo ------------------------------;
cd cp_tests; \
echo A file number one > afile1; \
echo A file number two, blah. > afile2; \
@@ -234,7 +259,8 @@ cp_tests: cp_clean cp
@echo;
rm -rf cp_tests/{afile{1,2},symlink1,there1};
- @echo; echo;
+ # Copy a directory into another directory with the -a switch.
+ @echo; echo ------------------------------;
cd cp_tests; \
mkdir dir{a,b}; \
echo A file > dira/afile; \
@@ -246,7 +272,6 @@ cp_tests: cp_clean cp
${GCP} -a dira dirb; \
ls -lR . >> ../cp_a_dira_dirb.gnu;
- # false;
@echo;
rm -rf cp_tests/dir{a,b};
@@ -265,6 +290,31 @@ cp_tests: cp_clean cp
@echo;
diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
- # false;
@echo;
rm -rf cp_tests/dir{a,b};
+
+ # Copy a directory to another directory, without the -a switch.
+ @echo; echo ------------------------------;
+ @echo There should be an error message about cannot cp a dir to a subdir of itself.
+ cd cp_tests; \
+ touch a b c; \
+ mkdir adir; \
+ ls -lR . > ../cp_a_star_adir.gnu; \
+ ${GCP} -a * adir; \
+ ls -lR . >> ../cp_a_star_adir.gnu;
+
+ @echo
+ @echo There should be an error message about cannot cp a dir to a subdir of itself.
+ cd cp_tests; \
+ rm -rf adir; \
+ mkdir adir; \
+ ls -lR . > ../cp_a_star_adir.bb; \
+ ${BCP} -a * adir; \
+ ls -lR . >> ../cp_a_star_adir.bb;
+
+ @echo;
+ diff -u cp_a_star_adir.gnu cp_a_star_adir.bb;
+
+ @echo;
+ rm -rf cp_tests;
+ @echo; echo Done.
diff --git a/tests/ln_tests.mk b/tests/ln_tests.mk
index 5925edd..3110f81 100644
--- a/tests/ln_tests.mk
+++ b/tests/ln_tests.mk
@@ -1,14 +1,19 @@
+# ln_tests.mk - Set of tests for busybox ln
+# -------------
+# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
+#
# GNU `ln'
GLN = /bin/ln
# BusyBox `ln'
BLN = $(shell pwd)/ln
-.PHONY: ln_clean
+all:: ln_tests
+clean:: ln_clean
+
ln_clean:
rm -rf ln_tests ln_*.{gnu,bb} ln
-.PHONY: ln_tests
ln_tests: ln_clean ln
@echo;
@echo "No output from diff means busybox ln is functioning properly.";
diff --git a/tests/mv_tests.mk b/tests/mv_tests.mk
index 3a90125..81b8ffd 100644
--- a/tests/mv_tests.mk
+++ b/tests/mv_tests.mk
@@ -1,14 +1,19 @@
+# mv_tests.mk - Set of tests cases for busybox mv
+# -------------
+# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
+#
# GNU `mv'
GMV = /bin/mv
# BusyBox `mv'
BMV = $(shell pwd)/mv
-.PHONY: mv_clean
+all:: mv_tests
+clean:: mv_clean
+
mv_clean:
rm -rf mv_tests mv_*.{gnu,bb} mv
-.PHONY: mv_tests
mv_tests: mv_clean mv
@echo;
@echo "No output from diff means busybox mv is functioning properly.";
@@ -45,7 +50,7 @@ mv_tests: mv_clean mv
@echo;
rm -f mv_tests/{afile,newname};
- @echo; echo;
+ @echo; echo ------------------------------;
cd mv_tests; \
echo A file > afile; \
ln -s afile symlink; \
@@ -72,7 +77,7 @@ mv_tests: mv_clean mv
@echo;
rm -rf mv_tests/*;
- @echo; echo;
+ @echo; echo ------------------------------;
cd mv_tests; \
echo A file > afile; \
ln -s afile symlink; \
@@ -85,7 +90,7 @@ mv_tests: mv_clean mv
@echo;
rm -rf mv_tests/*
- @echo; echo;
+ @echo; echo ------------------------------;
cd mv_tests; \
echo A file > afile; \
ln -s afile symlink; \
@@ -101,7 +106,7 @@ mv_tests: mv_clean mv
@echo;
rm -rf mv_tests/*;
- @echo; echo;
+ @echo; echo ------------------------------;
cd mv_tests; \
mkdir dir{a,b}; \
echo A file > dira/afile; \
@@ -135,3 +140,27 @@ mv_tests: mv_clean mv
# false;
@echo;
rm -rf mv_tests/dir{a,b};
+
+ @echo; echo ------------------------------;
+ @echo There should be an error message about cannot mv a dir to a subdir of itself.
+ cd mv_tests; \
+ touch a b c; \
+ mkdir adir; \
+ ls -lR . > ../mv_a_star_adir.gnu; \
+ ${GMV} * adir; \
+ ls -lR . >> ../mv_a_star_adir.gnu;
+
+ @echo
+ @echo There should be an error message about cannot mv a dir to a subdir of itself.
+ cd mv_tests; \
+ rm -rf adir; \
+ mkdir adir; \
+ ls -lR . > ../mv_a_star_adir.bb; \
+ ${BMV} * adir; \
+ ls -lR . >> ../mv_a_star_adir.bb;
+
+ @echo;
+ diff -u mv_a_star_adir.gnu mv_a_star_adir.bb;
+
+ @echo;
+ rm -rf mv_test/*;