summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam>2007-07-12 18:27:54 +0000
committerjlam <jlam>2007-07-12 18:27:54 +0000
commitf4e53c79b7d6573427e2720aabe9d91f7d7c90fb (patch)
tree3ed5da3f1959cde091362b8c7f216f7948859cf0
parent8f1e61f215a39bd972ad6895cb1a7bb937391f30 (diff)
downloadpkgsrc-f4e53c79b7d6573427e2720aabe9d91f7d7c90fb.tar.gz
Add some regression tests for backing up existing files, e.g. "-b" and
"-B fmt".
-rw-r--r--regress/bootstrap-install-sh/Makefile39
1 files changed, 38 insertions, 1 deletions
diff --git a/regress/bootstrap-install-sh/Makefile b/regress/bootstrap-install-sh/Makefile
index 219dba91e38..350b5ff3db7 100644
--- a/regress/bootstrap-install-sh/Makefile
+++ b/regress/bootstrap-install-sh/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2007/07/04 19:18:12 jlam Exp $
+# $NetBSD: Makefile,v 1.5 2007/07/12 18:27:54 jlam Exp $
DISTNAME= bootstrap-install-sh-0.0
CATEGORIES= regress
@@ -110,6 +110,43 @@ test-c4:
${CMP} -s ${WRKSRC}/c4_file2 ${WRKSRC}/c4_dir/c4_file2 && \
${CMP} -s ${WRKSRC}/c4_file3 ${WRKSRC}/c4_dir/c4_file3 ) || exit 1
+# copy one existing file to existing file with backup
+regress: test-c5
+test-c5:
+ ${ECHO} "Test data 1" > ${WRKSRC}/c5_file1
+ ${ECHO} "Test data 2" > ${WRKSRC}/c5_file2
+ ${CP} ${WRKSRC}/c5_file2 ${WRKSRC}/c5_file2.backup
+ ${INSTALL_SH} -b -c ${WRKSRC}/c5_file1 ${WRKSRC}/c5_file2
+ ( ${CMP} ${WRKSRC}/c5_file1 ${WRKSRC}/c5_file2 && \
+ ${TEST} -f ${WRKSRC}/c5_file2.old && \
+ ${CMP} ${WRKSRC}/c5_file2.old ${WRKSRC}/c5_file2.backup ) || exit 1
+
+# copy one existing file to existing file with backup and custom suffix
+regress: test-c6
+test-c6:
+ ${ECHO} "Test data 1" > ${WRKSRC}/c6_file1
+ ${ECHO} "Test data 2" > ${WRKSRC}/c6_file2
+ ${CP} ${WRKSRC}/c6_file2 ${WRKSRC}/c6_file2.backup
+ ${INSTALL_SH} -B .OLD -c ${WRKSRC}/c6_file1 ${WRKSRC}/c6_file2
+ ( ${CMP} ${WRKSRC}/c6_file1 ${WRKSRC}/c6_file2 && \
+ ${TEST} -f ${WRKSRC}/c6_file2.OLD && \
+ ${CMP} ${WRKSRC}/c6_file2.OLD ${WRKSRC}/c6_file2.backup ) || exit 1
+
+# copy one existing file to existing file with numbered backup
+regress: test-c7
+test-c7:
+ ${ECHO} "Test data 1" > ${WRKSRC}/c7_file1
+ ${ECHO} "Test data 2" > ${WRKSRC}/c7_file2
+ ${ECHO} "Test data 3" > ${WRKSRC}/c7_file2.backup.0
+ ${ECHO} "Test data 4" > ${WRKSRC}/c7_file2.backup.1
+ ${ECHO} "Test data 5" > ${WRKSRC}/c7_file2.backup.2
+ ${CP} ${WRKSRC}/c7_file2 ${WRKSRC}/c7_file2.backup
+ ${INSTALL_SH} -B .backup.%i -c ${WRKSRC}/c7_file1 ${WRKSRC}/c7_file2
+ ( ${CMP} ${WRKSRC}/c7_file1 ${WRKSRC}/c7_file2 && \
+ ${TEST} -f ${WRKSRC}/c7_file2.backup.3 && \
+ ${CMP} ${WRKSRC}/c7_file2.backup.3 ${WRKSRC}/c7_file2.backup ) || \
+ exit 1
+
MODES= 0 1 2 3 4 5 6 7
MODE_0= ---
MODE_1= --x