aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-02-07 05:29:42 +0000
committerErik Andersen <andersen@codepoet.org>2000-02-07 05:29:42 +0000
commitfac10d7c59f7db0facd5fb94de273310b9ec86e6 (patch)
treedccf8f905fc5807239883da9fca6597037d487fc /tests
parent50bc101b7d6e847a9a0621ca3eb28c7117d095e5 (diff)
downloadbusybox-fac10d7c59f7db0facd5fb94de273310b9ec86e6.tar.gz
A few minor updates. ;-)
Seriously though, read the Changelog for busybox 0.42, which this is about to become... -Erik
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile28
-rw-r--r--tests/cp_tests.mk270
-rw-r--r--tests/ln_tests.mk66
-rw-r--r--tests/mv_tests.mk137
4 files changed, 501 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 000000000..015634460
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,28 @@
+all test_all: message_header cp_tests mv_tests ln_tests
+
+clean: cp_clean mv_clean ln_clean
+
+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
+
+include cp_tests.mk
+include mv_tests.mk
+include ln_tests.mk
+
+BBL := $(shell pushd .. >/dev/null && \
+ ${MAKE} busybox.links >/dev/null && \
+ popd >/dev/null && \
+ cat ../busybox.links | \
+ sed -e 's,.*/\(.*\)$$,\1,')
+
+../busybox:
+ cd .. && ${MAKE} 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
new file mode 100644
index 000000000..e14262ac1
--- /dev/null
+++ b/tests/cp_tests.mk
@@ -0,0 +1,270 @@
+# This is a -*- makefile -*-
+
+# GNU `cp'
+GCP = /bin/cp
+# BusyBox `cp'
+BCP = $(shell pwd)/cp
+
+.PHONY: cp_clean
+cp_clean:
+ 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;
+ ${BCP} || true;
+
+ @echo;
+ mkdir cp_tests;
+
+ @echo;
+ cd cp_tests; \
+ echo A file > afile; \
+ ls -l afile > ../cp_afile_afilecopy.gnu; \
+ ${GCP} afile afilecopy; \
+ ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
+
+ @echo;
+ rm -f cp_tests/afile*;
+
+ @echo;
+ cd cp_tests; \
+ echo A file > afile; \
+ ls -l afile > ../cp_afile_afilecopy.bb; \
+ ${BCP} afile afilecopy; \
+ ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
+
+ @echo;
+ diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
+
+ @echo;
+ rm -f cp_tests/afile*;
+
+ @echo; echo;
+ cd cp_tests; \
+ mkdir there there1; \
+ cd there; \
+ 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;
+
+ @echo;
+ rm -f cp_tests/afile cp_tests/there1/afile;
+
+ @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;
+
+ @echo;
+ diff -u cp_symlink.gnu cp_symlink.bb;
+
+ @echo;
+ rm -f cp_tests/afile cp_tests/there1/afile;
+
+ @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;
+
+ @echo;
+ rm -f cp_tests/afile cp_tests/there1/afile;
+
+ @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;
+
+ @echo;
+ diff -u cp_a_symlink.gnu cp_a_symlink.bb;
+
+ @echo;
+ rm -f cp_tests/afile
+ rm -rf cp_tests/there{,1};
+
+ @echo; echo;
+ cd cp_tests; \
+ echo A file > there/afile; \
+ mkdir there/adir; \
+ touch there/adir/afileinadir; \
+ ln -s $(shell pwd) there/alink;
+
+ @echo;
+ cd cp_tests; \
+ ${GCP} -a there/ there1/; \
+ ls -lR there/ there1/ > ../cp_a_dir_dir.gnu;
+
+ @echo;
+ rm -rf cp_tests/there1;
+
+ @echo;
+ cd cp_tests; \
+ ${BCP} -a there/ there1/; \
+ ls -lR there/ there1/ > ../cp_a_dir_dir.bb;
+
+ @echo;
+ diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;
+
+ @echo;
+ rm -rf cp_tests/there1/;
+
+ @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/; \
+ ls -lR > ../cp_files_dir.gnu;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @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/; \
+ 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};
+
+ @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} -d afile1 afile2 symlink1 there1/; \
+ ls -lR > ../cp_d_files_dir.gnu;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @echo;
+ cd cp_tests; \
+ echo A file number one > afile1; \
+ echo A file number two, blah. > afile2; \
+ ln -s afile1 symlink1; \
+ mkdir there1; \
+ ${BCP} -d afile1 afile2 symlink1 there1/; \
+ ls -lR > ../cp_d_files_dir.bb;
+
+ @echo;
+ diff -u cp_d_files_dir.gnu cp_d_files_dir.bb;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @echo; echo;
+ cd cp_tests; \
+ echo A file number one > afile1; \
+ echo A file number two, blah. > afile2; \
+ touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
+ ln -s afile1 symlink1; \
+ mkdir there1; \
+ ${GCP} -p afile1 afile2 symlink1 there1/; \
+ ls -lR > ../cp_p_files_dir.gnu;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @echo;
+ cd cp_tests; \
+ echo A file number one > afile1; \
+ echo A file number two, blah. > afile2; \
+ touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
+ ln -s afile1 symlink1; \
+ mkdir there1; \
+ ${BCP} -p afile1 afile2 symlink1 there1/; \
+ ls -lR > ../cp_p_files_dir.bb;
+
+ @echo;
+ diff -u cp_p_files_dir.gnu cp_p_files_dir.bb;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @echo; echo;
+ cd cp_tests; \
+ echo A file number one > afile1; \
+ echo A file number two, blah. > afile2; \
+ touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
+ ln -s afile1 symlink1; \
+ mkdir there1; \
+ ${GCP} -p -d afile1 afile2 symlink1 there1/; \
+ ls -lR > ../cp_pd_files_dir.gnu;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @echo;
+ cd cp_tests; \
+ echo A file number one > afile1; \
+ echo A file number two, blah. > afile2; \
+ touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
+ ln -s afile1 symlink1; \
+ mkdir there1; \
+ ${BCP} -p -d afile1 afile2 symlink1 there1/; \
+ ls -lR > ../cp_pd_files_dir.bb;
+
+ @echo;
+ diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb;
+
+ @echo;
+ rm -rf cp_tests/{afile{1,2},symlink1,there1};
+
+ @echo; echo;
+ cd cp_tests; \
+ mkdir dir{a,b}; \
+ echo A file > dira/afile; \
+ echo A file in dirb > dirb/afileindirb; \
+ ln -s dira/afile dira/alinktoafile; \
+ mkdir dira/subdir1; \
+ echo Another file > dira/subdir1/anotherfile; \
+ ls -lR . > ../cp_a_dira_dirb.gnu; \
+ ${GCP} -a dira dirb; \
+ ls -lR . >> ../cp_a_dira_dirb.gnu;
+
+ # false;
+ @echo;
+ rm -rf cp_tests/dir{a,b};
+
+ @echo;
+ cd cp_tests; \
+ mkdir dir{a,b}; \
+ echo A file > dira/afile; \
+ echo A file in dirb > dirb/afileindirb; \
+ ln -s dira/afile dira/alinktoafile; \
+ mkdir dira/subdir1; \
+ echo Another file > dira/subdir1/anotherfile; \
+ ls -lR . > ../cp_a_dira_dirb.bb; \
+ ${BCP} -a dira dirb; \
+ ls -lR . >> ../cp_a_dira_dirb.bb;
+
+ @echo;
+ diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
+
+ # false;
+ @echo;
+ rm -rf cp_tests/dir{a,b};
diff --git a/tests/ln_tests.mk b/tests/ln_tests.mk
new file mode 100644
index 000000000..5925edd4f
--- /dev/null
+++ b/tests/ln_tests.mk
@@ -0,0 +1,66 @@
+
+# GNU `ln'
+GLN = /bin/ln
+# BusyBox `ln'
+BLN = $(shell pwd)/ln
+
+.PHONY: 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.";
+
+ @echo;
+ ${BLN} || true;
+
+ @echo;
+ mkdir ln_tests;
+
+ @echo;
+ cd ln_tests; \
+ echo A file > afile; \
+ ls -l afile > ../ln_afile_newname.gnu; \
+ ${GLN} afile newname; \
+ ls -l afile newname >> ../ln_afile_newname.gnu;
+
+ @echo;
+ rm -f ln_tests/{afile,newname};
+
+ @echo;
+ cd ln_tests; \
+ echo A file > afile; \
+ ls -l afile > ../ln_afile_newname.bb; \
+ ${BLN} afile newname; \
+ ls -l afile newname >> ../ln_afile_newname.bb;
+
+ @echo;
+ diff -u ln_afile_newname.gnu ln_afile_newname.bb
+
+ @echo;
+ rm -f ln_tests/{afile,newname};
+
+ @echo;
+ cd ln_tests; \
+ echo A file > afile; \
+ ls -l afile > ../ln_s_afile_newname.gnu; \
+ ${GLN} -s afile newname; \
+ ls -l afile newname >> ../ln_s_afile_newname.gnu;
+
+ @echo;
+ rm -f ln_tests/{afile,newname};
+
+ @echo;
+ cd ln_tests; \
+ echo A file > afile; \
+ ls -l afile > ../ln_s_afile_newname.bb; \
+ ${BLN} -s afile newname; \
+ ls -l afile newname >> ../ln_s_afile_newname.bb;
+
+ @echo;
+ diff -u ln_s_afile_newname.gnu ln_s_afile_newname.bb
+
+ @echo;
+ rm -f ln_tests/{afile,newname};
diff --git a/tests/mv_tests.mk b/tests/mv_tests.mk
new file mode 100644
index 000000000..3a9012538
--- /dev/null
+++ b/tests/mv_tests.mk
@@ -0,0 +1,137 @@
+
+# GNU `mv'
+GMV = /bin/mv
+# BusyBox `mv'
+BMV = $(shell pwd)/mv
+
+.PHONY: 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.";
+ @echo;
+ @echo "No such file or directory is good; it means the old file got removed.";
+ @echo;
+ ${BMV} || true;
+
+ @echo;
+ mkdir mv_tests;
+
+ @echo;
+ cd mv_tests; \
+ echo A file > afile; \
+ ls -l afile > ../mv_afile_newname.gnu; \
+ ${GMV} afile newname; \
+ ls -l newname >> ../mv_afile_newname.gnu;
+ -ls -l mv_tests/afile;
+
+ @echo;
+ rm -f mv_tests/{afile,newname};
+
+ @echo;
+ cd mv_tests; \
+ echo A file > afile; \
+ ls -l afile > ../mv_afile_newname.bb; \
+ ${BMV} afile newname; \
+ ls -l newname >> ../mv_afile_newname.bb;
+ -ls -l mv_tests/afile;
+
+ @echo;
+ diff -u mv_afile_newname.gnu mv_afile_newname.bb;
+
+ @echo;
+ rm -f mv_tests/{afile,newname};
+
+ @echo; echo;
+ cd mv_tests; \
+ echo A file > afile; \
+ ln -s afile symlink; \
+ ls -l afile symlink > ../mv_symlink_newname.gnu; \
+ ${GMV} symlink newname; \
+ ls -l afile newname >> ../mv_symlink_newname.gnu;
+ -ls -l mv_tests/symlink;
+
+ @echo;
+ rm -f mv_tests/{afile,newname};
+
+ @echo;
+ cd mv_tests; \
+ echo A file > afile; \
+ ln -s afile symlink; \
+ ls -l afile symlink > ../mv_symlink_newname.bb;\
+ ${BMV} symlink newname; \
+ ls -l afile newname >> ../mv_symlink_newname.bb;
+ -ls -l mv_tests/symlink;
+
+ @echo;
+ diff -u mv_symlink_newname.gnu mv_symlink_newname.bb;
+
+ @echo;
+ rm -rf mv_tests/*;
+
+ @echo; echo;
+ cd mv_tests; \
+ echo A file > afile; \
+ ln -s afile symlink; \
+ mkdir newdir; \
+ ls -lR > ../mv_file_symlink_dir.gnu; \
+ ${GMV} symlink afile newdir; \
+ ls -lR >> ../mv_file_symlink_dir.gnu;
+ -ls -l mv_tests/{symlink,afile};
+
+ @echo;
+ rm -rf mv_tests/*
+
+ @echo; echo;
+ cd mv_tests; \
+ echo A file > afile; \
+ ln -s afile symlink; \
+ mkdir newdir; \
+ ls -lR > ../mv_file_symlink_dir.bb; \
+ ${BMV} symlink afile newdir; \
+ ls -lR >> ../mv_file_symlink_dir.bb;
+ -ls -l mv_tests/{symlink,afile};
+
+ @echo;
+ diff -u mv_file_symlink_dir.gnu mv_file_symlink_dir.bb;
+
+ @echo;
+ rm -rf mv_tests/*;
+
+ @echo; echo;
+ cd mv_tests; \
+ mkdir dir{a,b}; \
+ echo A file > dira/afile; \
+ echo A file in dirb > dirb/afileindirb; \
+ ln -s dira/afile dira/alinktoafile; \
+ mkdir dira/subdir1; \
+ echo Another file > dira/subdir1/anotherfile; \
+ ls -lR . > ../mv_dira_dirb.gnu; \
+ ${GMV} dira dirb; \
+ ls -lR . >> ../mv_dira_dirb.gnu;
+
+ # false;
+ @echo;
+ rm -rf mv_tests/dir{a,b};
+
+ @echo;
+ cd mv_tests; \
+ mkdir dir{a,b}; \
+ echo A file > dira/afile; \
+ echo A file in dirb > dirb/afileindirb; \
+ ln -s dira/afile dira/alinktoafile; \
+ mkdir dira/subdir1; \
+ echo Another file > dira/subdir1/anotherfile; \
+ ls -lR . > ../mv_dira_dirb.bb; \
+ ${BMV} dira dirb; \
+ ls -lR . >> ../mv_dira_dirb.bb;
+
+ @echo;
+ diff -u mv_dira_dirb.gnu mv_dira_dirb.bb;
+
+ # false;
+ @echo;
+ rm -rf mv_tests/dir{a,b};