--- /dev/null
+<testcase>
+ <summary>Test option "check-pkgs".</summary>
+ <fixtures>
+ <copy src="ks_files/qcow_image.ks" />
+ </fixtures>
+ <steps><![CDATA[
+
+losetup_path=$(sudo which losetup)
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+sudo mic -d -v cr qcow qcow_image.ks --tmpfs --check-pkgs=bash,rpm --logfile=qcow1.log -k /home/build/mic-tmp-cache
+
+# use '-k /home/build/mic-tmp-cache', because directory '/home/build/' has larger space, if
+# use default cache dir, mic will throw error 'Failed to umount /var/***/install_root' on
+# Ubuntu_12.04_64bit qemu-kvm
+
+test -f qcow1.log
+
+grep 'Finished' qcow1.log
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+test -f ./mic-output/emulimg-3.0.img
+
+file ./mic-output/emulimg-3.0.img | grep -i "QCOW"
+
+sudo mic -d -v cr qcow qcow_image.ks --check-pkgs=bashrr --logfile=qcow2.log -k /home/build/mic-tmp-cache 2>&1 | tee qcow2.log || true
+
+grep "Packages absent in image: bashrr" qcow2.log
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+]]></steps>
+ <teardown><![CDATA[
+
+echo "cleaning..."
+
+sudo rm -rf ./mic-output
+
+sudo rm -f qcow1.log qcow2.log
+
+test -d /home/build/mic-tmp-cache && sudo rm -rf /home/build/mic-tmp-cache
+
+echo "finish cleaning..."
+
+]]></teardown>
+</testcase>
--- /dev/null
+<testcase>
+ <summary>This test case is used to test the option
+ "--config, --runtime"
+ </summary>
+ <fixtures>
+ <copy src="ks_files/qcow_image.ks" />
+ <copy src="conf/mic.conf" />
+ </fixtures>
+ <steps><![CDATA[
+
+losetup_path=$(sudo which losetup)
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+# set tmpdir and roordir to /home/build to avoid space lacking during build
+sed -i 's!^\(tmpdir=\).*!\1 /home/build/mic/tmp!g' mic.conf
+sed -i 's!^\(rootdir=\).*!\1 /home/build/mic-bootstrap!g' mic.conf
+
+sudo mic -d -v cr qcow qcow_image.ks \
+ --config=mic.conf \
+ --runtime=bootstrap \
+ --logfile=mic.log \
+ -k /home/build/mic-tmp-cache
+
+# use '-k /home/build/mic-tmp-cache', because directory '/home/build/' has larger space, if
+# use default cache dir, mic will throw error 'Failed to umount /var/***/install_root' on
+# Ubuntu_12.04_64bit qemu-kvm
+
+grep -i "Finished" mic.log
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+grep 'Start mic in bootstrap' mic.log
+
+sudo rm mic.log
+
+sudo test -f ./my_mic-output/emulimg-3.0.img
+
+file ./my_mic-output/emulimg-3.0.img | grep -i "QCOW"
+
+]]></steps>
+ <teardown><![CDATA[
+
+echo "cleaning...."
+
+sudo rm -rf ./my_mic-output/
+
+sed -i 's!^\(tmpdir=\).*!\1 /var/tmp/mic!g' mic.conf
+sed -i 's!^\(rootdir=\).*!\1 /var/tmp/mic-bootstrap!g' mic.conf
+
+test -d /home/build/mic-tmp-cache && sudo rm -rf /home/build/mic-tmp-cache
+
+echo "finish clean space...."
+
+echo "finish cleaning...."
+
+]]></teardown>
+</testcase>
--- /dev/null
+<testcase>
+ <summary>create qcow image with armv7l arch, and options is
+ "--local-pkgs-path=./rpm --record-pkgs=name,content,license --taring-to=@NAME@"</summary>
+ <fixtures>
+ <copy src="ks_files/qcow_image.ks" />
+ <copydir src="rpm/" />
+ </fixtures>
+ <steps><![CDATA[
+
+losetup_path=$(sudo which losetup)
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+enforce_path=$(sudo which setenforce || true)
+
+if [ ! -z $enforce_path ];then
+ sudo $enforce_path 0 || true
+fi
+
+sudo mic -d -v cr qcow qcow_image.ks \
+ --local-pkgs-path=./rpm \
+ --record-pkgs=name,content,license,vcs \
+ --taring-to=@NAME@ \
+ --logfile=log.file \
+ -k /home/build/mic-tmp-cache
+
+# use '-k /home/build/mic-tmp-cache', because directory '/home/build/' has larger space, if
+# use default cache dir, mic will throw error 'Failed to umount /var/***/install_root' on
+# Ubuntu_12.04_64bit qemu-kvm
+
+grep "Finished" log.file
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+grep 'Marking .*.rpm to be installed' log.file
+
+sudo test -f ./mic-output/emulimg-3.0.img
+
+file ./mic-output/emulimg-3.0.img | grep -i "QCOW"
+
+sudo ls ./mic-output | grep 'qcow_image.*.packages'
+
+sudo ls ./mic-output | grep 'qcow_image.*.license'
+
+sudo ls ./mic-output | grep 'qcow_image.*.files'
+
+]]></steps>
+ <teardown><![CDATA[
+
+echo "cleaning...."
+
+sudo rm log.file
+
+sudo rm -rf ./mic-output
+
+test -d /home/build/mic-tmp-cache && sudo rm -rf /home/build/mic-tmp-cache
+
+echo "finish cleaning...."
+
+]]></teardown>
+</testcase>
--- /dev/null
+<testcase>
+ <summary>create qcow image with option
+"--logfile=/custome/arm.log -c conf/mic.conf --release=tizen-2.2_20130719.3 --pkgmgr=zypp"</summary>
+ <fixtures>
+ <copy src="ks_files/qcow_image.ks" />
+ <copy src="conf/mic.conf" />
+ </fixtures>
+ <steps><![CDATA[
+
+losetup_path=$(sudo which losetup)
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+# on some platforms, the command "setenforce 0" is needed to be executed,
+# on some other platforms, it's not needed to execute this command or
+# no related package is installed, so we added "||"
+
+enforce_path=$(sudo which setenforce || true)
+
+if [ ! -z $enforce_path ];then
+ sudo $enforce_path 0 || true
+fi
+
+# set tmpdir and roordir to /home/build to avoid space lacking during build
+sed -i 's!^\(tmpdir=\).*!\1 /home/build/mic/tmp!g' mic.conf
+sed -i 's!^\(rootdir=\).*!\1 /home/build/mic-bootstrap!g' mic.conf
+
+sudo mic -d -v cr qcow qcow_image.ks --logfile=/custome/arm.log -c mic.conf --release=tizen-2.2_20130719.3 --pkgmgr=zypp -k /home/build/mic-tmp-cache
+
+# use '-k /home/build/mic-tmp-cache', because directory '/home/build/' has larger space, if
+# use default cache dir, mic will throw error 'Failed to umount /var/***/install_root' on
+# Ubuntu_12.04_64bit qemu-kvm
+
+sudo test -f /custome/arm.log
+
+grep "Finished" /custome/arm.log
+
+sudo $losetup_path -a
+
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+
+test -f my_mic-output/tizen-2.2_20130719.3/images/qcow_image/emulimg-3.0.img
+
+file my_mic-output/tizen-2.2_20130719.3/images/qcow_image/emulimg-3.0.img | grep -i "QCOW"
+
+test -f my_mic-output/tizen-2.2_20130719.3/images/qcow_image/tizen-2.2_20130719.3_qcow_image.ks
+
+test -f my_mic-output/tizen-2.2_20130719.3/images/qcow_image/tizen-2.2_20130719.3_qcow_image.packages
+
+]]></steps>
+ <teardown><![CDATA[
+
+echo "cleaning...."
+
+sudo rm /custome/arm.log
+
+sudo rm -rf my_mic-output
+
+sed -i 's!^\(tmpdir=\).*!\1 /var/tmp/mic!g' mic.conf
+sed -i 's!^\(rootdir=\).*!\1 /var/tmp/mic-bootstrap!g' mic.conf
+
+test -d /home/build/mic-tmp-cache && sudo rm -rf /home/build/mic-tmp-cache
+
+echo "finish cleaning...."
+
+]]></teardown>
+</testcase>
--- /dev/null
+<testcase>
+ <summary>Test '--logfile' option of 'qcow' format image</summary>
+ <fixtures>
+ <copy src="ks_files/qcow_image.ks" />
+ </fixtures>
+ <steps><![CDATA[
+losetup_path=$(sudo which losetup)
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+hostname=$(hostname)
+sudo mic -d -v cr qcow qcow_image.ks --logfile=./log/qcow.log -k /home/build/mic-tmp-cache
+# use '-k /home/build/mic-tmp-cache', because directory '/home/build/' has larger space, if
+# use default cache dir, mic will throw error 'Failed to umount /var/***/install_root' on
+# Ubuntu_12.04_64bit qemu-kvm
+test -f ./log/qcow.log
+test -e ./mic-output/emulimg-3.0.img
+file ./mic-output/emulimg-3.0.img | grep -i 'QCOW'
+grep 'Finished' ./log/qcow.log
+grep "$hostname" ./log/qcow.log
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+egrep 'mic [0-9]{1,2}\.[0-9]+' ./log/qcow.log
+]]></steps>
+ <teardown><![CDATA[
+echo "cleaning..."
+sudo rm -rf ./mic-output
+sudo rm ./log/qcow.log
+test -d /home/build/mic-tmp-cache && sudo rm -rf /home/build/mic-tmp-cache
+echo "finish cleaning..."
+]]></teardown>
+</testcase>