Use special code for sigsetjmp only in cpu-exec.c
[qemu/ar7.git] / test-qcow2.sh
blob1b6a39bc2b1d1cac30a68387cbc1df4fc07704b4
1 #!/bin/bash
3 if [ $USER != "root" ]; then
4 echo "This command must be run by root in order to mount tmpfs."
5 exit 1
6 fi
8 QEMU_DIR=.
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."
14 exit 1;
17 if [ ! -e $QEMU_TEST ]; then
18 echo "$QEMU_TEST does not exist."
19 exit 1;
22 DATA_DIR=/var/ramdisk
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
29 if [ $? -ne 0 ]; then
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
36 parallel=100
37 round=100000
38 fail_prob=0
39 cancel_prob=0
40 instant_qemubh=true
41 seed=$RANDOM$RANDOM
42 count=0
44 function invoke() {
45 echo "$*" >> $CMD_LOG
47 if [ $? -ne 0 ]; then
48 echo "Exit with error code $?: $*"
52 /bin/rm -f $CMD_LOG
53 touch $CMD_LOG
55 while [ -t ]; do
56 for cluster_size in 65536 7680 512 1024 15872 65024 1048576 1048064; do
57 for io_size in 10485760 ; do
58 count=$[$count + 1]
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"
74 seed=$[$seed + 1]
75 done; done; done