-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The test is similar to 2000-stretch.sh, but does not create a device loop. The disk on which the root system is mounted is used.
- Loading branch information
1 parent
144b2cd
commit 8da8136
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash -e | ||
# | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
|
||
if [ -z $1 ] | ||
then | ||
DIFF_STORAGE_DIR="/dev/shm" | ||
else | ||
DIFF_STORAGE_DIR=$1 | ||
fi | ||
DIFF_STORAGE="${DIFF_STORAGE_DIR}/diff_storage" | ||
|
||
. ./functions.sh | ||
. ./blksnap.sh | ||
|
||
echo "---" | ||
echo "Overflow snapshot test" | ||
|
||
# diff_storage_minimum=262144 - set 256 K sectors, it's 128MiB diff_storage portion size | ||
blksnap_load "diff_storage_minimum=262144" | ||
|
||
# check module is ready | ||
blksnap_version | ||
|
||
TESTDIR=/root/blksnap-test | ||
MPDIR=/mnt/blksnap-test | ||
|
||
mkdir -p ${TESTDIR} | ||
rm -rf ${TESTDIR}/* | ||
mkdir -p ${MPDIR} | ||
rm -rf ${MPDIR}*/ | ||
|
||
MPTESTDIR=$(stat -c %m ${TESTDIR}) | ||
DEVICE="/dev/block/"$(mountpoint -d ${MPTESTDIR}) | ||
|
||
generate_files_direct ${TESTDIR} "before" 5 | ||
drop_cache | ||
|
||
rm -f ${DIFF_STORAGE} | ||
fallocate --length 128MiB ${DIFF_STORAGE} | ||
blksnap_snapshot_create "${DEVICE}" "${DIFF_STORAGE}" "512M" | ||
|
||
generate_files_direct ${TESTDIR} "tracked" 5 | ||
drop_cache | ||
|
||
blksnap_snapshot_watcher | ||
#echo "Press for taking snapshot..." | ||
#read -n 1 | ||
|
||
blksnap_snapshot_take | ||
|
||
generate_block_MB ${TESTDIR} "after" 100 | ||
check_files ${TESTDIR} | ||
|
||
echo "Check snapshot before overflow." | ||
#echo "press..." | ||
#read -n 1 | ||
|
||
DEVICE_IMAGE=$(blksnap_get_image ${DEVICE}) | ||
IMAGE=${MPDIR}/image0 | ||
mkdir -p ${IMAGE} | ||
mount ${DEVICE_IMAGE} ${IMAGE} | ||
check_files ${IMAGE}/${TESTDIR} | ||
|
||
echo "Try to make snapshot overflow." | ||
#echo "press..." | ||
#read -n 1 | ||
generate_block_MB ${TESTDIR} "overflow" 768 | ||
|
||
echo "Umount images" | ||
umount ${IMAGE} | ||
|
||
echo "Destroy snapshot" | ||
#echo "press..." | ||
#read -n 1 | ||
|
||
blksnap_snapshot_destroy | ||
|
||
#echo "Check generated data" | ||
#check_files ${TESTDIR} | ||
|
||
blksnap_watcher_wait | ||
|
||
blksnap_detach ${DEVICE} | ||
|
||
blksnap_unload | ||
|
||
echo "Cleanup test directory" ${TESTDIR} | ||
rm -rf ${TESTDIR}/* | ||
|
||
echo "Overflow snapshot test finish" | ||
echo "---" |