|
1 | 1 | #!/bin/bash -ex |
2 | 2 | # SPDX-License-Identifier: LGPL-2.1+ |
3 | 3 |
|
4 | | -if [ -z "$1" ] ; then |
5 | | - DIGEST=sha512-256 |
6 | | -else |
7 | | - DIGEST="$1" |
8 | | -fi |
| 4 | +DIGEST=${1:-sha512-256} |
| 5 | +COMPRESSION=${2:-zstd} |
9 | 6 |
|
10 | | -if [ -z "$2" ] ; then |
11 | | - COMPRESSION=zstd |
12 | | -else |
13 | | - COMPRESSION="$2" |
| 7 | +PARAMS="-v --digest=$DIGEST --compression=$COMPRESSION" |
| 8 | +if [ $UID != 0 ]; then |
| 9 | + PARAMS="$PARAMS --without=privileged" |
14 | 10 | fi |
15 | 11 |
|
16 | | -if [ `id -u` == 0 ] ; then |
17 | | - PARAMS="-v --digest=$DIGEST --compression=$COMPRESSION" |
18 | | -else |
19 | | - PARAMS="-v --without=privileged --digest=$DIGEST --compression=$COMPRESSION" |
20 | | -fi |
21 | | - |
22 | | -CASYNC_PROTOCOL_PATH=@top_builddir@ |
23 | | -export CASYNC_PROTOCOL_PATH |
| 12 | +export CASYNC_PROTOCOL_PATH=@top_builddir@ |
24 | 13 |
|
25 | 14 | SCRATCH_DIR=${TMPDIR:-/var/tmp}/test-casync.$RANDOM |
26 | 15 | mkdir -p $SCRATCH_DIR/src |
27 | 16 |
|
28 | | -if [ `id -u` == 0 ] ; then |
| 17 | +if [ $UID = 0 ]; then |
29 | 18 | cp -aT @top_srcdir@ $SCRATCH_DIR/src/casync |
30 | 19 | else |
31 | 20 | # If we lack privileges we use rsync rather than cp to copy, as it will just skip over device nodes |
@@ -136,11 +125,8 @@ diff -q $SCRATCH_DIR/original-seek.mtree $SCRATCH_DIR/extract-seek-caidx.mtree |
136 | 125 |
|
137 | 126 | ### Test SSH Remoting |
138 | 127 |
|
139 | | -CASYNC_SSH_PATH=@top_srcdir@/test/pseudo-ssh |
140 | | -export CASYNC_SSH_PATH |
141 | | - |
142 | | -CASYNC_REMOTE_PATH=@top_builddir@/casync |
143 | | -export CASYNC_REMOTE_PATH |
| 128 | +export CASYNC_SSH_PATH=@top_srcdir@/test/pseudo-ssh |
| 129 | +export CASYNC_REMOTE_PATH=@top_builddir@/casync |
144 | 130 |
|
145 | 131 | @top_builddir@/casync $PARAMS list localhost:$SCRATCH_DIR/test.caidx > $SCRATCH_DIR/test-remote.caidx.list |
146 | 132 | @top_builddir@/casync $PARAMS mtree localhost:$SCRATCH_DIR/test.caidx > $SCRATCH_DIR/test-remote.caidx.mtree |
@@ -180,8 +166,7 @@ diff -q $SCRATCH_DIR/test.digest $SCRATCH_DIR/test2.catar.digest |
180 | 166 |
|
181 | 167 | HTTP_PORT=$((10000 + $$ % 10000)) |
182 | 168 |
|
183 | | -CASYNC_PROTOCOL_PATH=@top_builddir@ |
184 | | -export CASYNC_PROTOCOL_PATH |
| 169 | +export CASYNC_PROTOCOL_PATH=@top_builddir@ |
185 | 170 |
|
186 | 171 | HTTP_PID=`@top_builddir@/notify-wait @top_srcdir@/test/http-server.py $SCRATCH_DIR $HTTP_PORT` |
187 | 172 |
|
|
0 commit comments