From: Tobias Brunner Date: Fri, 4 Apr 2025 09:07:21 +0000 (+0200) Subject: testing: Use tar instead of recursive scp X-Git-Tag: 6.0.2dr1~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=353d5c130ba4bcde0cac965e10c929a8c8efb98a;p=thirdparty%2Fstrongswan.git testing: Use tar instead of recursive scp It seems that scp is sometimes very slow (unclear what causes it as it's not always the same). Packing up the files with tar performs a lot better in these situations. And copying the files to multiple hosts in parallel additionally helps to reduce the time required for these steps. Using --overwrite and -h preserves existing symlinks (e.g. for the users file in /etc/freeradius/3.0) and overwrites the target file instead. The -m option ignores timestamps when extracting the files as some target files will be newer than the source. Using -h when packing up files in load-testconfig allows using symlinks in the test config dirs to files on the host running the tests. --- diff --git a/testing/do-tests b/testing/do-tests index e2a60aa630..28337c022f 100755 --- a/testing/do-tests +++ b/testing/do-tests @@ -580,11 +580,17 @@ else test ${#WAIT_FOR[@]} -gt 0 && wait ${WAIT_FOR[@]} + WAIT_FOR=() + for host in ${!COLLECT_OPTIONS[@]} do eval HOSTLOGIN=root@\$ipv4_${host} - scp $SSHCONF -q $HOSTLOGIN:${GUEST_OUTPUT_DIR}/* $TESTRESULTDIR/ + ssh $SSHCONF $HOSTLOGIN "tar -cf - -C ${GUEST_OUTPUT_DIR} ." | tar -xf - -C $TESTRESULTDIR/ & + WAIT_FOR+=($!) done + + test ${#WAIT_FOR[@]} -gt 0 && wait ${WAIT_FOR[@]} + chmod a+r $TESTRESULTDIR/* ########################################################################## diff --git a/testing/scripts/load-testconfig b/testing/scripts/load-testconfig index 3101467d6e..49fb2fbcad 100755 --- a/testing/scripts/load-testconfig +++ b/testing/scripts/load-testconfig @@ -135,16 +135,20 @@ done source $TESTDIR/test.conf ########################################################################## -# copy test specific configurations to uml hosts +# copy test specific configurations to hosts # +WAIT_FOR=() + if [ -d $TESTDIR/hosts ] then for host in `ls $TESTDIR/hosts` do eval HOSTLOGIN=root@\$ipv4_${host} - scp $SSHCONF -r $TESTDIR/hosts/$host/etc $HOSTLOGIN:/ > /dev/null 2>&1 + tar -chf - -C $TESTDIR/hosts/$host etc | ssh $SSHCONF $HOSTLOGIN 'tar --overwrite -xhmf - -C /' & + WAIT_FOR+=($!) done + wait ${WAIT_FOR[@]} fi diff --git a/testing/scripts/restore-defaults b/testing/scripts/restore-defaults index a88f3eb891..29ec1905e0 100755 --- a/testing/scripts/restore-defaults +++ b/testing/scripts/restore-defaults @@ -30,11 +30,16 @@ TESTSDIR=$BUILDDIR/tests . $TESTSDIR/$testname/test.conf +# load files in parallel +WAIT_FOR=() + if [ -d $TESTSDIR/${testname}/hosts ] then for host in `ls $TESTSDIR/${testname}/hosts` do eval HOSTLOGIN="root@`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`" - scp $SSHCONF -r $HOSTCONFIGDIR/default/etc $HOSTCONFIGDIR/${host}/etc $HOSTLOGIN:/ >/dev/null 2>&1 + tar -cf - -C $HOSTCONFIGDIR/default etc -C ../${host} etc | ssh $SSHCONF $HOSTLOGIN 'tar --overwrite -xhmf - -C /' & + WAIT_FOR+=($!) done + wait ${WAIT_FOR[@]} fi