aboutsummaryrefslogtreecommitdiff
path: root/testsuite/cp
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/cp')
-rw-r--r--testsuite/cp/cp-RHL-does_not_preserve-links6
-rw-r--r--testsuite/cp/cp-a-files-to-dir15
-rw-r--r--testsuite/cp/cp-a-preserves-links5
-rw-r--r--testsuite/cp/cp-copies-empty-file3
-rw-r--r--testsuite/cp/cp-copies-large-file3
-rw-r--r--testsuite/cp/cp-copies-small-file3
-rw-r--r--testsuite/cp/cp-d-files-to-dir11
-rw-r--r--testsuite/cp/cp-dev-file2
-rw-r--r--testsuite/cp/cp-dir-create-dir4
-rw-r--r--testsuite/cp/cp-dir-existing-dir5
-rw-r--r--testsuite/cp/cp-does-not-copy-unreadable-file11
-rw-r--r--testsuite/cp/cp-files-to-dir11
-rw-r--r--testsuite/cp/cp-follows-links4
-rw-r--r--testsuite/cp/cp-preserves-hard-links6
-rw-r--r--testsuite/cp/cp-preserves-links5
-rw-r--r--testsuite/cp/cp-preserves-source-file3
16 files changed, 97 insertions, 0 deletions
diff --git a/testsuite/cp/cp-RHL-does_not_preserve-links b/testsuite/cp/cp-RHL-does_not_preserve-links
new file mode 100644
index 0000000..eed6c3e
--- /dev/null
+++ b/testsuite/cp/cp-RHL-does_not_preserve-links
@@ -0,0 +1,6 @@
+mkdir a
+>a/file
+ln -s file a/link
+busybox cp -RHL a b
+test ! -L b/link
+#sh </dev/tty >/dev/tty 2>&1
diff --git a/testsuite/cp/cp-a-files-to-dir b/testsuite/cp/cp-a-files-to-dir
new file mode 100644
index 0000000..abdbdf7
--- /dev/null
+++ b/testsuite/cp/cp-a-files-to-dir
@@ -0,0 +1,15 @@
+echo file number one > file1
+echo file number two > file2
+ln -s file2 link1
+mkdir dir1
+# why???
+#touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3
+mkdir there
+busybox cp -a file1 file2 link1 dir1 there
+test -f there/file1
+test -f there/file2
+test ! -s there/dir1/file3
+test -L there/link1
+test xfile2 = x`readlink there/link1`
+test ! dir1/file3 -ot there/dir1/file3
+test ! dir1/file3 -nt there/dir1/file3
diff --git a/testsuite/cp/cp-a-preserves-links b/testsuite/cp/cp-a-preserves-links
new file mode 100644
index 0000000..0c0cd96
--- /dev/null
+++ b/testsuite/cp/cp-a-preserves-links
@@ -0,0 +1,5 @@
+touch foo
+ln -s foo bar
+busybox cp -a bar baz
+test -L baz
+test xfoo = x`readlink baz`
diff --git a/testsuite/cp/cp-copies-empty-file b/testsuite/cp/cp-copies-empty-file
new file mode 100644
index 0000000..ad25aa1
--- /dev/null
+++ b/testsuite/cp/cp-copies-empty-file
@@ -0,0 +1,3 @@
+touch foo
+busybox cp foo bar
+cmp foo bar
diff --git a/testsuite/cp/cp-copies-large-file b/testsuite/cp/cp-copies-large-file
new file mode 100644
index 0000000..c2225c6
--- /dev/null
+++ b/testsuite/cp/cp-copies-large-file
@@ -0,0 +1,3 @@
+dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null
+busybox cp foo bar
+cmp foo bar
diff --git a/testsuite/cp/cp-copies-small-file b/testsuite/cp/cp-copies-small-file
new file mode 100644
index 0000000..d52a887
--- /dev/null
+++ b/testsuite/cp/cp-copies-small-file
@@ -0,0 +1,3 @@
+echo I WANT > foo
+busybox cp foo bar
+cmp foo bar
diff --git a/testsuite/cp/cp-d-files-to-dir b/testsuite/cp/cp-d-files-to-dir
new file mode 100644
index 0000000..9571a56
--- /dev/null
+++ b/testsuite/cp/cp-d-files-to-dir
@@ -0,0 +1,11 @@
+echo file number one > file1
+echo file number two > file2
+touch file3
+ln -s file2 link1
+mkdir there
+busybox cp -d file1 file2 file3 link1 there
+test -f there/file1
+test -f there/file2
+test ! -s there/file3
+test -L there/link1
+test xfile2 = x`readlink there/link1`
diff --git a/testsuite/cp/cp-dev-file b/testsuite/cp/cp-dev-file
new file mode 100644
index 0000000..055f0d9
--- /dev/null
+++ b/testsuite/cp/cp-dev-file
@@ -0,0 +1,2 @@
+busybox cp /dev/null foo
+test -f foo
diff --git a/testsuite/cp/cp-dir-create-dir b/testsuite/cp/cp-dir-create-dir
new file mode 100644
index 0000000..a8d7b50
--- /dev/null
+++ b/testsuite/cp/cp-dir-create-dir
@@ -0,0 +1,4 @@
+mkdir bar
+touch bar/baz
+busybox cp -R bar foo
+test -f foo/baz
diff --git a/testsuite/cp/cp-dir-existing-dir b/testsuite/cp/cp-dir-existing-dir
new file mode 100644
index 0000000..4c788ba
--- /dev/null
+++ b/testsuite/cp/cp-dir-existing-dir
@@ -0,0 +1,5 @@
+mkdir bar
+touch bar/baz
+mkdir foo
+busybox cp -R bar foo
+test -f foo/bar/baz
diff --git a/testsuite/cp/cp-does-not-copy-unreadable-file b/testsuite/cp/cp-does-not-copy-unreadable-file
new file mode 100644
index 0000000..e17e8e6
--- /dev/null
+++ b/testsuite/cp/cp-does-not-copy-unreadable-file
@@ -0,0 +1,11 @@
+touch foo
+chmod a-r foo
+set +e
+if test `id -u` = 0; then
+ # run as user with nonzero uid
+ setuidgid 1 busybox cp foo bar
+else
+ busybox cp foo bar
+fi
+set -e
+test ! -f bar
diff --git a/testsuite/cp/cp-files-to-dir b/testsuite/cp/cp-files-to-dir
new file mode 100644
index 0000000..fdb8191
--- /dev/null
+++ b/testsuite/cp/cp-files-to-dir
@@ -0,0 +1,11 @@
+echo file number one > file1
+echo file number two > file2
+touch file3
+ln -s file2 link1
+mkdir there
+busybox cp file1 file2 file3 link1 there
+test -f there/file1
+test -f there/file2
+test ! -s there/file3
+test -f there/link1
+cmp there/file2 there/link1
diff --git a/testsuite/cp/cp-follows-links b/testsuite/cp/cp-follows-links
new file mode 100644
index 0000000..2d9f05e
--- /dev/null
+++ b/testsuite/cp/cp-follows-links
@@ -0,0 +1,4 @@
+touch foo
+ln -s foo bar
+busybox cp bar baz
+test -f baz
diff --git a/testsuite/cp/cp-preserves-hard-links b/testsuite/cp/cp-preserves-hard-links
new file mode 100644
index 0000000..4de7b85
--- /dev/null
+++ b/testsuite/cp/cp-preserves-hard-links
@@ -0,0 +1,6 @@
+# FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS
+touch foo
+ln foo bar
+mkdir baz
+busybox cp -d foo bar baz
+test baz/foo -ef baz/bar
diff --git a/testsuite/cp/cp-preserves-links b/testsuite/cp/cp-preserves-links
new file mode 100644
index 0000000..301dc5f
--- /dev/null
+++ b/testsuite/cp/cp-preserves-links
@@ -0,0 +1,5 @@
+touch foo
+ln -s foo bar
+busybox cp -d bar baz
+test -L baz
+test xfoo = x`readlink baz`
diff --git a/testsuite/cp/cp-preserves-source-file b/testsuite/cp/cp-preserves-source-file
new file mode 100644
index 0000000..f0f5065
--- /dev/null
+++ b/testsuite/cp/cp-preserves-source-file
@@ -0,0 +1,3 @@
+touch foo
+busybox cp foo bar
+test -f foo