From: jianzhong.fang Date: Sat, 14 May 2016 06:13:59 +0000 (+0800) Subject: Add cases to test raw image X-Git-Tag: submit/devel/20190730.074558~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f59e10d284fbac52ffaf1ec4a23a21a06e11312;p=tools%2Fitest-cases-mic.git Add cases to test raw image Change-Id: I522a548b8402433ce0feb3ed312aa7d2db4d21ba --- diff --git a/cases/create/func_cases/mic_cr_auto_raw.case b/cases/create/func_cases/mic_cr_auto_raw.case new file mode 100755 index 0000000..6eba292 --- /dev/null +++ b/cases/create/func_cases/mic_cr_auto_raw.case @@ -0,0 +1,99 @@ + + test 'mic cr auto ks' for raw type +if we run command with 'auto', mic will use the first line in ks file, +which called magic line, and magic line in this ks file is: + -*-mic2-options-*- -f raw --copy-kernel --compress-disk-image=bz2 --generate-bmap -*-mic2-options-*- + + + + +import sys +import json +img_file = sys.argv[1] +mic_version = sys.argv[2] +bmap_file = sys.argv[3] +manifest_file=open('mic-output/manifest.json') +manifest=json.load(manifest_file) +assert manifest['format'] == 'raw' +assert manifest['version'] == mic_version +assert manifest['raw']['compress'] == 'bz2' +assert img_file in manifest['raw']['image_files'] +assert 'sdb' in manifest['raw']['disks'] +assert manifest['raw']['sdb']['bmap'] == bmap_file +assert manifest['raw']['sdb']['image'] == img_file + + + &1 | awk -F ' ' '{print $2}') + python parse_manifest.py $bz2img $mic_version $bmap + exit 0 + else + sleep 2 + fi + done + fi + fi + sleep 3 +done +echo "can not get kpartx output: $kpartx_path -av $raw_image" +exit 1 +]]> + + diff --git a/cases/create/func_cases/mic_cr_auto_raw_gpt.case b/cases/create/func_cases/mic_cr_auto_raw_gpt.case new file mode 100755 index 0000000..cf2aec6 --- /dev/null +++ b/cases/create/func_cases/mic_cr_auto_raw_gpt.case @@ -0,0 +1,76 @@ + + create raw image with gpt table and --part-type for partition + + + + + + diff --git a/cases/create/func_cases/mic_cr_raw_generate-bmap_cp-knl_compress_runtime_local-pkgs_conf_armv7l.case b/cases/create/func_cases/mic_cr_raw_generate-bmap_cp-knl_compress_runtime_local-pkgs_conf_armv7l.case new file mode 100755 index 0000000..b7a9e71 --- /dev/null +++ b/cases/create/func_cases/mic_cr_raw_generate-bmap_cp-knl_compress_runtime_local-pkgs_conf_armv7l.case @@ -0,0 +1,48 @@ + + create raw image with "--generate-bmap --compress-disk-image=bz2 --copy-kernel --runtime=zypp --local-pkgs-path=rpm -c conf/mic.conf" + + + + + + + + diff --git a/cases/create/func_cases/mic_cr_raw_gpt-part-type.case b/cases/create/func_cases/mic_cr_raw_gpt-part-type.case new file mode 100755 index 0000000..5dcb9a5 --- /dev/null +++ b/cases/create/func_cases/mic_cr_raw_gpt-part-type.case @@ -0,0 +1,29 @@ + + create raw image with gpt table and --part-type for partition + + + + + + diff --git a/cases/create/func_cases/mic_cr_raw_release_logfile_local-pkg-pth_record-pkg_gen-bmap_ia32.case b/cases/create/func_cases/mic_cr_raw_release_logfile_local-pkg-pth_record-pkg_gen-bmap_ia32.case new file mode 100755 index 0000000..704a5b5 --- /dev/null +++ b/cases/create/func_cases/mic_cr_raw_release_logfile_local-pkg-pth_record-pkg_gen-bmap_ia32.case @@ -0,0 +1,46 @@ + + This test case is used to test the option "--logfile", + if a file name is given to it, images should be created successfully. + There is no need to give an existed file name, mic will create a new + file with the given name if the file does not exist at present. + + + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_createrepo_issue.case b/cases/create/mixed_cases/mic_cr_createrepo_issue.case new file mode 100644 index 0000000..9ee0eec --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_createrepo_issue.case @@ -0,0 +1,51 @@ + + Test whether repo created by 'createrepo' locally can be used by mic + + 2261 + + + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_active_partition.case b/cases/create/mixed_cases/mic_cr_raw_active_partition.case new file mode 100755 index 0000000..554e46e --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_active_partition.case @@ -0,0 +1,37 @@ + + This case is used to test if mic can work well with '--active' configed to partition in ks config file, the command is as bellow: + mic cr raw ./ks_files/ivi_with_active_partition.ks + + 639 + + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_broken_bootstrap.case b/cases/create/mixed_cases/mic_cr_raw_broken_bootstrap.case new file mode 100755 index 0000000..d2ca819 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_broken_bootstrap.case @@ -0,0 +1,21 @@ + + Testing broken mic-bootstrap + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_installerfw_extlinux.case b/cases/create/mixed_cases/mic_cr_raw_installerfw_extlinux.case new file mode 100755 index 0000000..01ee888 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_installerfw_extlinux.case @@ -0,0 +1,46 @@ + + This case is used to test if 'installerfw' command in ks + + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_invliad_mic-bootstrap.case b/cases/create/mixed_cases/mic_cr_raw_invliad_mic-bootstrap.case new file mode 100755 index 0000000..4da5cf8 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_invliad_mic-bootstrap.case @@ -0,0 +1,21 @@ + + Testing invalid mic-bootstrap + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_ivi_partition_size_compute_ia32.case b/cases/create/mixed_cases/mic_cr_raw_ivi_partition_size_compute_ia32.case new file mode 100755 index 0000000..3a46797 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_ivi_partition_size_compute_ia32.case @@ -0,0 +1,45 @@ + + + + 624 + + + + + > tmp1.log + VAL1=$(awk '{print $NF}' tmp1.log | grep -o [0-9]*) + parted ./mic-output/ivi*.raw print >> tmp2.log + sed -i '/^$/d' tmp2.log + tail -1 tmp2.log >> tmp3.log + VAL2=$(awk '{print $3}' tmp3.log | grep -o [0-9]*) + test "$VAL1" -eq "$VAL2" +else + fdisk_path=$(sudo which fdisk) + VAL1=`sudo $fdisk_path -l ./mic-output/ivi*.raw | sed '/^$/d' | sed -n '$p' | awk '{print $3}'` + sudo $fdisk_path -l ./mic-output/ivi*.raw | sed -n '/.*sectors$/p' >> tmp2.file + VAL2=`awk '{print $(NF-1)}' tmp2.file` + let VAL3=$VAL2-1 + test "$VAL1" -eq "$VAL3" +fi +]]> + + diff --git a/cases/create/mixed_cases/mic_cr_raw_locale.case b/cases/create/mixed_cases/mic_cr_raw_locale.case new file mode 100755 index 0000000..bbdf600 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_locale.case @@ -0,0 +1,61 @@ + + + test if '/etc/locale.conf' exists + + + + + + 1745 + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_multi_partition_gpt.case b/cases/create/mixed_cases/mic_cr_raw_multi_partition_gpt.case new file mode 100755 index 0000000..1e0f0f7 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_multi_partition_gpt.case @@ -0,0 +1,28 @@ + + This case is used to test if mic can work well with multi partitions for GPT partition table format, which are setted in ks config file, the command is : mic cr raw ./ks_files/ivi_four_partition_gpt.ks + + 741 + + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_multi_partition_mbr.case b/cases/create/mixed_cases/mic_cr_raw_multi_partition_mbr.case new file mode 100755 index 0000000..95368f9 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_multi_partition_mbr.case @@ -0,0 +1,28 @@ + + This case is used to test if mic can work well with multi partitions for 'msdos' partition table format which are setted in ks config file, the command is as bellow: mic cr raw ./ks_files/ivi_four_partition_mbr.ks + + 742 + + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_no_mountpoint.case b/cases/create/mixed_cases/mic_cr_raw_no_mountpoint.case new file mode 100755 index 0000000..40a96d6 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_no_mountpoint.case @@ -0,0 +1,22 @@ + + Test the condition that the ks file has no mountpoint. + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_no_partition.case b/cases/create/mixed_cases/mic_cr_raw_no_partition.case new file mode 100755 index 0000000..40e747d --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_no_partition.case @@ -0,0 +1,23 @@ + + This case is used to test if mic can work well with no partitions in ks config file, + the command is as bellow: mic cr raw ./ks_files/ivi_no_partition.ks + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_unicode.case b/cases/create/mixed_cases/mic_cr_raw_unicode.case new file mode 100755 index 0000000..53a2224 --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_unicode.case @@ -0,0 +1,23 @@ + + create raw image when LANG is zh_CN.UTF-8 + + + + + + diff --git a/cases/create/mixed_cases/mic_cr_raw_without_conf_bootstrap_ia32.case b/cases/create/mixed_cases/mic_cr_raw_without_conf_bootstrap_ia32.case new file mode 100755 index 0000000..9ff748e --- /dev/null +++ b/cases/create/mixed_cases/mic_cr_raw_without_conf_bootstrap_ia32.case @@ -0,0 +1,24 @@ + + Without /etc/mic/mic.conf, raw image cannot be created in bootstrap mode + + + + &1 | tee mic.log +grep -i "Failed to download/install bootstrap package" mic.log +sudo $losetup_path -a +sudo $losetup_path -a | wc -l | xargs test 0 -eq +]]> + + diff --git a/cases/create/opt_cases/mic_cr_raw_compress-image-bz2_ia32.case b/cases/create/opt_cases/mic_cr_raw_compress-image-bz2_ia32.case new file mode 100755 index 0000000..2c512b5 --- /dev/null +++ b/cases/create/opt_cases/mic_cr_raw_compress-image-bz2_ia32.case @@ -0,0 +1,43 @@ + + create raw image with ia32 arch and compress-image option with bz2 + + + + + cpmpress_volume)?"yes":"no"}'` +test $result = 'yes' +sudo bunzip2 $name2 +raw_name=`ls ivi*.raw` +test -f $raw_name +]]> + + diff --git a/cases/create/opt_cases/mic_cr_raw_compress-image-gz_ia32.case b/cases/create/opt_cases/mic_cr_raw_compress-image-gz_ia32.case new file mode 100755 index 0000000..f8eb73f --- /dev/null +++ b/cases/create/opt_cases/mic_cr_raw_compress-image-gz_ia32.case @@ -0,0 +1,39 @@ + + create raw image with ia32 arch and compress-image option with gz + + + + + cpmpress_volume)?"yes":"no"}'` +test $result = 'yes' +sudo gunzip $name2 +raw_name=`ls ivi*.raw` +test -f $name +]]> + + diff --git a/cases/create/opt_cases/mic_cr_raw_compress-image-invalid_ia32.case b/cases/create/opt_cases/mic_cr_raw_compress-image-invalid_ia32.case new file mode 100755 index 0000000..352809d --- /dev/null +++ b/cases/create/opt_cases/mic_cr_raw_compress-image-invalid_ia32.case @@ -0,0 +1,21 @@ + + create raw image with ia32 arch and compress-image option with invalid option, like zip + + + + &1 | tee mic2.log ) +grep "compress-image: invalid choice: 'zip'" mic2.log +sudo $losetup_path -a +sudo $losetup_path -a | wc -l | xargs test 0 -eq +]]> + + diff --git a/cases/create/opt_cases/mic_cr_raw_fstab-entry-name.case b/cases/create/opt_cases/mic_cr_raw_fstab-entry-name.case new file mode 100755 index 0000000..a754aef --- /dev/null +++ b/cases/create/opt_cases/mic_cr_raw_fstab-entry-name.case @@ -0,0 +1,59 @@ + + This test case is used to test the option "--fstab-entry=name", + + + + + + diff --git a/cases/create/opt_cases/mic_cr_raw_fstab-entry-uuid.case b/cases/create/opt_cases/mic_cr_raw_fstab-entry-uuid.case new file mode 100755 index 0000000..544c3da --- /dev/null +++ b/cases/create/opt_cases/mic_cr_raw_fstab-entry-uuid.case @@ -0,0 +1,60 @@ + + This test case is used to test the option "--fstab-entry=uuid", + + + + + + diff --git a/cases/create/opt_cases/mic_cr_raw_generate-bmap_ia32.case b/cases/create/opt_cases/mic_cr_raw_generate-bmap_ia32.case new file mode 100755 index 0000000..f36c721 --- /dev/null +++ b/cases/create/opt_cases/mic_cr_raw_generate-bmap_ia32.case @@ -0,0 +1,23 @@ + + create loop image with ia32 arch and shrink option + + + + + +