#!/bin/sh # # Try changing the format of a transfer remotely. # Allow all tests to be skipped, e.g. during a release build test "${SKIP_ALL_TESTS}" = "1" && exit 77 true "${testSubject:?not set - call this from 'make check'}" true "${workFile1:?not set - call this from 'make check'}" true "${workFile2:?not set - call this from 'make check'}" true "${workFile3:?not set - call this from 'make check'}" true "${workFile4:?not set - call this from 'make check'}" # Do nothing if it is not supported. if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then echo "Not supported on this platform" exit 77 fi # Generate an empty test file. dd if=/dev/zero of="${workFile1}" bs=1024 count=10240 2>/dev/null ( sleep 1 "${testSubject}" -R "$(cat "${workFile4}")" -a sleep 2 "${testSubject}" -R "$(cat "${workFile4}")" -L 10M ) & "${testSubject}" -L 2M -f -P "${workFile4}" "${workFile1}" > "${workFile2}" 2>"${workFile3}" # Make sure there is more than one length of line (excluding blank lines). line_lengths=$(tr '\r' '\n' < "${workFile3}" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l | tr -dc '0-9') if ! test "${line_lengths}" -gt 1; then echo "only one line length seen - format change failed" exit 1 fi exit 0