From 53abc26569bfe39808f3687383a21d5db6bbd439 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 16 Mar 2021 06:11:15 +0100 Subject: [PATCH] tests: simplify docker rsync & support worktrees The previous, more complex mechanism failed to take into account that git worktrees only have a stub .git file & copying the worktree itself is not enough. Just extract a file list beforehand & don't bother with git inside the container. Signed-off-by: David Lamparter --- tests/topotests/docker/frr-topotests.sh | 1 + tests/topotests/docker/inner/compile_frr.sh | 12 ++++-------- tests/topotests/docker/inner/funcs.sh | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/topotests/docker/frr-topotests.sh b/tests/topotests/docker/frr-topotests.sh index d25856ea62..9ef59b3bbc 100755 --- a/tests/topotests/docker/frr-topotests.sh +++ b/tests/topotests/docker/frr-topotests.sh @@ -132,6 +132,7 @@ if [ -z "$TOPOTEST_FRR" ]; then echo "frr-topotests only works if you have your tree in git." >&2 exit 1 fi + git -C "$TOPOTEST_FRR" ls-files -z > "${TOPOTEST_LOGS}/git-ls-files" fi if [ -z "$TOPOTEST_BUILDCACHE" ]; then diff --git a/tests/topotests/docker/inner/compile_frr.sh b/tests/topotests/docker/inner/compile_frr.sh index dee0ec8118..495beaf3cc 100755 --- a/tests/topotests/docker/inner/compile_frr.sh +++ b/tests/topotests/docker/inner/compile_frr.sh @@ -34,19 +34,15 @@ CDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [ "${TOPOTEST_CLEAN}" != "0" ]; then log_info "Cleaning FRR builddir..." - rm -rf $FRR_SYNC_DIR $FRR_BUILD_DIR &> /dev/null + rm -rf $FRR_BUILD_DIR &> /dev/null fi log_info "Syncing FRR source with host..." -mkdir -p $FRR_SYNC_DIR +mkdir -p $FRR_BUILD_DIR rsync -a --info=progress2 \ - --exclude '*.o' \ - --exclude '*.lo'\ + --from0 --files-from=/tmp/git-ls-files \ --chown root:root \ - $FRR_HOST_DIR/. $FRR_SYNC_DIR/ -(cd $FRR_SYNC_DIR && git clean -xdf > /dev/null) -mkdir -p $FRR_BUILD_DIR -rsync -a --info=progress2 --chown root:root $FRR_SYNC_DIR/. $FRR_BUILD_DIR/ + $FRR_HOST_DIR/. $FRR_BUILD_DIR/ cd "$FRR_BUILD_DIR" || \ log_fatal "failed to find frr directory" diff --git a/tests/topotests/docker/inner/funcs.sh b/tests/topotests/docker/inner/funcs.sh index acb8b55e97..d78d5006bc 100755 --- a/tests/topotests/docker/inner/funcs.sh +++ b/tests/topotests/docker/inner/funcs.sh @@ -23,7 +23,6 @@ # SOFTWARE. FRR_HOST_DIR=/root/host-frr -FRR_SYNC_DIR=/root/persist/frr-sync FRR_BUILD_DIR=/root/persist/frr-build if [ ! -L "/root/frr" ]; then -- 2.39.5