mirror of https://github.com/jimsalterjrs/sanoid
Merge pull request #321 from phreaker0/freebsd-tests
make tests work on FreeBSD
This commit is contained in:
commit
8da79ddd2b
|
|
@ -39,7 +39,7 @@ function cleanUp {
|
||||||
trap cleanUp EXIT
|
trap cleanUp EXIT
|
||||||
|
|
||||||
while [ $timestamp -le $END ]; do
|
while [ $timestamp -le $END ]; do
|
||||||
date --utc --set @$timestamp; date; "${SANOID}" --cron --verbose
|
setdate $timestamp; date; "${SANOID}" --cron --verbose
|
||||||
timestamp=$((timestamp+3600))
|
timestamp=$((timestamp+3600))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ function cleanUp {
|
||||||
trap cleanUp EXIT
|
trap cleanUp EXIT
|
||||||
|
|
||||||
while [ $timestamp -le $END ]; do
|
while [ $timestamp -le $END ]; do
|
||||||
date --utc --set @$timestamp; date; "${SANOID}" --cron --verbose
|
setdate $timestamp; date; "${SANOID}" --cron --verbose
|
||||||
timestamp=$((timestamp+900))
|
timestamp=$((timestamp+900))
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
unamestr="$(uname)"
|
||||||
|
|
||||||
function setup {
|
function setup {
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LANGUAGE=C
|
export LANGUAGE=C
|
||||||
|
|
@ -90,7 +92,7 @@ function verifySnapshotList {
|
||||||
message="${message}monthly snapshot count is wrong: ${monthly_count}\n"
|
message="${message}monthly snapshot count is wrong: ${monthly_count}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checksum=$(sha256sum "${RESULT}" | cut -d' ' -f1)
|
checksum=$(shasum -a 256 "${RESULT}" | cut -d' ' -f1)
|
||||||
if [ "${checksum}" != "${CHECKSUM}" ]; then
|
if [ "${checksum}" != "${CHECKSUM}" ]; then
|
||||||
failed=1
|
failed=1
|
||||||
message="${message}result checksum mismatch\n"
|
message="${message}result checksum mismatch\n"
|
||||||
|
|
@ -105,3 +107,13 @@ function verifySnapshotList {
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setdate {
|
||||||
|
TIMESTAMP="$1"
|
||||||
|
|
||||||
|
if [ "$unamestr" == 'FreeBSD' ]; then
|
||||||
|
date -u -f '%s' "${TIMESTAMP}"
|
||||||
|
else
|
||||||
|
date --utc --set "@${TIMESTAMP}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ for test in */; do
|
||||||
|
|
||||||
echo -n "Running test ${testName} ... "
|
echo -n "Running test ${testName} ... "
|
||||||
cd "${test}"
|
cd "${test}"
|
||||||
echo | bash run.sh > "${LOGFILE}" 2>&1
|
echo -n y | bash run.sh > "${LOGFILE}" 2>&1
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "[PASS]"
|
echo "[PASS]"
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ zfs snapshot "${POOL_NAME}"/src@snap5
|
||||||
../../../syncoid --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst || exit 1
|
../../../syncoid --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst || exit 1
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
output=$(zfs list -t snapshot -r "${POOL_NAME}" -H -o name)
|
output=$(zfs list -t snapshot -r -H -o name "${POOL_NAME}")
|
||||||
checksum=$(echo "${output}" | grep -v syncoid_ | sha256sum)
|
checksum=$(echo "${output}" | grep -v syncoid_ | shasum -a 256)
|
||||||
|
|
||||||
if [ "${checksum}" != "${TARGET_CHECKSUM}" ]; then
|
if [ "${checksum}" != "${TARGET_CHECKSUM}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ zfs snapshot "${POOL_NAME}"/src@snap5
|
||||||
../../../syncoid --no-stream --no-sync-snap --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst || exit 1
|
../../../syncoid --no-stream --no-sync-snap --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst || exit 1
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
output=$(zfs list -t snapshot -r "${POOL_NAME}" -H -o name)
|
output=$(zfs list -t snapshot -r -H -o name "${POOL_NAME}")
|
||||||
checksum=$(echo "${output}" | sha256sum)
|
checksum=$(echo "${output}" | shasum -a 256)
|
||||||
|
|
||||||
if [ "${checksum}" != "${TARGET_CHECKSUM}" ]; then
|
if [ "${checksum}" != "${TARGET_CHECKSUM}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ sleep 1
|
||||||
../../../syncoid -r --force-delete --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst || exit 1
|
../../../syncoid -r --force-delete --debug --compress=none "${POOL_NAME}"/src "${POOL_NAME}"/dst || exit 1
|
||||||
|
|
||||||
# verify
|
# verify
|
||||||
output=$(zfs list -t snapshot -r "${POOL_NAME}" -H -o name | sed 's/@syncoid_.*$'/@syncoid_/)
|
output=$(zfs list -t snapshot -r -H -o name "${POOL_NAME}" | sed 's/@syncoid_.*$'/@syncoid_/)
|
||||||
checksum=$(echo "${output}" | sha256sum)
|
checksum=$(echo "${output}" | shasum -a 256)
|
||||||
|
|
||||||
if [ "${checksum}" != "${TARGET_CHECKSUM}" ]; then
|
if [ "${checksum}" != "${TARGET_CHECKSUM}" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue