-# $OpenBSD: Makefile,v 1.4 2023/07/16 06:36:18 anton Exp $
+# $OpenBSD: Makefile,v 1.5 2023/07/28 17:25:32 bluhm Exp $
# evaluate once in main make invocation, then get list of test from environment
.if ! (make(clean) || make(cleandir) || make(obj))
# some of these tests pass or fail unreliably
REGRESS_EXPECTED_FAILURES = run-openrsync-openrsync-test3_minusexclude \
- run-openrsync-openrsync-test6_perms \
run-openrsync-openrsync-test6b_perms \
run-openrsync-openrsync-test7_symlinks \
run-openrsync-openrsync-test10_perms \
- run-openrsync-openrsync-test13_perms \
+ run-openrsync-openrsync-test13b_perms \
run-openrsync-rsync-test3_minusexclude \
- run-openrsync-rsync-test6_perms \
run-openrsync-rsync-test6b_perms \
run-openrsync-rsync-test7_symlinks \
run-openrsync-rsync-test10_perms \
- run-openrsync-rsync-test13_perms
+ run-openrsync-rsync-test13b_perms
.if ! exists(${RSYNC_PORT})
.for t in ${RSYNC_TESTS}
.endfor
.endif
+# these test have to run as regular user
+USER_TESTS = test13b_perms
+
+ROOT_USER != id -g
+.for t in ${RSYNC_TESTS}
+.if ${ROOT_USER} != 0 || empty(USER_TESTS:M${t:T:R})
+SH_${t:T:R} = sh
+.else
+SH_${t:T:R} = su build
+.endif
+.endfor
+
.for l in ${RSYNC_OPEN} ${RSYNC_PORT}
.for r in ${RSYNC_OPEN} ${RSYNC_PORT}
.for t in ${RSYNC_TESTS}
REGRESS_TARGETS += run-${l:T}-${r:T}-${t:T:R}
-run-${l:T}-${r:T}-${t:T:R}:
- tstdir="${.CURDIR}" rsync="${RSYNC_$l_$l}" sh $t
+run-${l:T}-${r:T}-${t:T:R}: clean
+ tstdir="${.CURDIR}" rsync="${RSYNC_$l_$l}" ${SH_${t:T:R}} $t
.endfor
.endfor
--- /dev/null
+#! /bin/sh
+
+. ${tstdir-.}/lib.sh
+. ${tstdir-.}/conf.sh
+
+generate_tree() {
+ mkdirfile "${1}/one.txt"
+}
+
+rm -rf dir1 dir2 dir3
+# make the copy-from-here tree
+generate_tree dir1
+# make the tree we want to compare to
+generate_tree dir2
+
+# Also make the target tree and mess up some permissions in there.
+# We expect rsync to reset this to what dir1 has.
+generate_tree dir3
+# regular user cannot read his own file, rsync must fix permissions first
+chmod 070 dir3/one.txt
+touch -m -t 199901020405 dir3/one.txt
+
+$rsync -a dir1/ dir3
+compare_trees dir2 dir3