]> arthur.barton.de Git - bup.git/blobdiff - t/configure-sampledata
configure-sampledata: only create random paths if asked
[bup.git] / t / configure-sampledata
index 256d0bf438cd6304b7575caaf6b5d2be148f14de..111c7c3cc76f89f23b68bed1622fe7d8c5eae0bd 100755 (executable)
@@ -5,8 +5,7 @@ set -o pipefail
 # NOTE: any relevant changes to var/ must be accompanied by an
 # increment to the revision.
 
-revision=1
-readonly revision
+revision=3
 
 top="$(pwd)" || exit $?
 
@@ -19,17 +18,20 @@ if test "$#" -ne 1; then
     usage 1>&2; exit 1
 fi
 
+rm_symlinks()
+{
+    for p in "$@"; do
+        # test -e is false for dangling symlinks.
+        if test -h "$p" -o -e "$p"; then rm "$p" || exit $?; fi
+    done
+}
+
 clean()
 (
     cd t/sampledata || exit $?
     if test -e var; then rm -r var || exit $?; fi
     # Remove legacy content (before everything moved to var/).
-    # test -e is false for dangling symlinks.
-    if test -h b -o -e b; then rm b || exit $?; fi
-    if test -h c -o -e c; then rm c || exit $?; fi
-    if test -h abs-symlink -o -e abs-symlink; then
-        rm abs-symlink || exit $?
-    fi
+    rm_symlinks abs-symlink b c etc
 )
 
 case "$1" in
@@ -41,10 +43,15 @@ case "$1" in
             ln -sf a b || exit $?
             ln -sf b c || exit $?
             ln -sf "$(pwd)/abs-symlink-target" abs-symlink || exit $?
+            mkfifo fifo
             mkdir -p cmd doc lib/bup || exit $?
-            cp -a "$top"/cmd/*.py cmd/ || exit $?
-            cp -a "$top"/Documentation/*.md doc/ || exit $?
-            cp -a "$top"/lib/bup/*.py lib/bup || exit $?
+            cp -pP "$top"/cmd/*.py cmd/ || exit $?
+            cp -pP "$top"/Documentation/*.md doc/ || exit $?
+            cp -pP "$top"/lib/bup/*.py lib/bup || exit $?
+            mkdir path-zoo || exit $?
+            if test "$BUP_TEST_RANDOMIZED_SAMPLEDATA_PATHS"; then
+                "$top"/t/make-random-paths 3000 path-zoo || exit $?
+            fi
             # The "v" ensures that if "configure-sampledata
             # --revision" and/or the setup above fails somehow,
             # callers like make will be looking for a file that won't