Add qcow cases
authorjianzhong.fang <jz.fang@samsung.com>
Tue, 13 Oct 2015 12:56:26 +0000 (20:56 +0800)
committerjianzhong.fang <jz.fang@samsung.com>
Tue, 13 Oct 2015 12:56:26 +0000 (20:56 +0800)
Change-Id: I1cf47b063a645935588fc98e523fa248e72911b7

cases/create/func_cases/mic_cr_qcow_check-pkgs_tmpfs_ia32.case [new file with mode: 0644]
cases/create/func_cases/mic_cr_qcow_config_runtime_ia32.case [new file with mode: 0644]
cases/create/func_cases/mic_cr_qcow_local-pkgs_record-pkgs.case [new file with mode: 0644]
cases/create/func_cases/mic_cr_qcow_logfile_conf_release_pkgmgr.case [new file with mode: 0644]
cases/create/opt_cases/mic_cr_qcow_logfile-current-file_ia32.case [new file with mode: 0644]

diff --git a/cases/create/func_cases/mic_cr_qcow_check-pkgs_tmpfs_ia32.case b/cases/create/func_cases/mic_cr_qcow_check-pkgs_tmpfs_ia32.case
new file mode 100644 (file)
index 0000000..4c79320
--- /dev/null
@@ -0,0 +1,54 @@
+<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>
diff --git a/cases/create/func_cases/mic_cr_qcow_config_runtime_ia32.case b/cases/create/func_cases/mic_cr_qcow_config_runtime_ia32.case
new file mode 100644 (file)
index 0000000..0ea2426
--- /dev/null
@@ -0,0 +1,62 @@
+<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>
diff --git a/cases/create/func_cases/mic_cr_qcow_local-pkgs_record-pkgs.case b/cases/create/func_cases/mic_cr_qcow_local-pkgs_record-pkgs.case
new file mode 100644 (file)
index 0000000..63f041b
--- /dev/null
@@ -0,0 +1,65 @@
+<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>
diff --git a/cases/create/func_cases/mic_cr_qcow_logfile_conf_release_pkgmgr.case b/cases/create/func_cases/mic_cr_qcow_logfile_conf_release_pkgmgr.case
new file mode 100644 (file)
index 0000000..77fb4b7
--- /dev/null
@@ -0,0 +1,69 @@
+<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>
diff --git a/cases/create/opt_cases/mic_cr_qcow_logfile-current-file_ia32.case b/cases/create/opt_cases/mic_cr_qcow_logfile-current-file_ia32.case
new file mode 100644 (file)
index 0000000..8eaee7d
--- /dev/null
@@ -0,0 +1,31 @@
+<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>