3 if [ $USER != "root" ]; then
4 echo "This command must be run by root in order to mount tmpfs."
9 QEMU_IMG
=$QEMU_DIR/qemu-img
10 QEMU_TEST
=$QEMU_DIR/qemu-test
12 if [ ! -e $QEMU_IMG ]; then
13 echo "$QEMU_IMG does not exist."
17 if [ ! -e $QEMU_TEST ]; then
18 echo "$QEMU_TEST does not exist."
23 TRUTH_IMG
=$DATA_DIR/truth.raw
24 TEST_IMG
=$DATA_DIR/test.qcow2
25 TEST_BASE
=$DATA_DIR/zero-500M.raw
26 CMD_LOG
=/tmp
/test-qcow2.log
28 mount |
grep $DATA_DIR > /dev
/null
30 echo "Create tmpfs at $DATA_DIR to store testing images."
31 if [ ! -e $DATA_DIR ]; then mkdir
-p $DATA_DIR ; fi
32 mount
-t tmpfs none
$DATA_DIR -o size
=4G
33 if [ $?
-ne 0 ]; then exit 1; fi
48 echo "Exit with error code $?: $*"
56 for cluster_size
in 65536 7680 512 1024 15872 65024 1048576 1048064; do
57 for io_size
in 10485760 ; do
59 echo "Round $count" >> $CMD_LOG
61 # QCOW2 image is about 1G
62 img_size
=$
[(1073741824 + ($RANDOM$RANDOM$RANDOM % 104857600)) / 512 * 512]
64 # base image is about 500MB
65 base_size
=$
[(536870912 + ($RANDOM$RANDOM$RANDOM % 104857600)) / 512 * 512]
67 invoke
"/bin/rm -rf $TRUTH_IMG $TEST_IMG $TEST_BASE"
68 invoke
"dd if=/dev/zero of=$TRUTH_IMG count=0 bs=1 seek=$img_size"
69 invoke
"dd if=/dev/zero of=$TEST_BASE count=0 bs=1 seek=$base_size"
70 invoke
"$QEMU_IMG create -f qcow2 -ocluster_size=$cluster_size -b $TEST_BASE $TEST_IMG $img_size"
72 invoke
"$QEMU_TEST --seed=$seed --truth=$TRUTH_IMG --format=qcow2 --test="blksim
:$TEST_IMG" --verify_write=true --compare_before=false --compare_after=true --round=$round --parallel=$parallel --io_size=$io_size --fail_prob=$fail_prob --cancel_prob=$cancel_prob --instant_qemubh=$instant_qemubh"