--- /dev/null
+<testcase>
+ <summary>Based on testing 'mic cr auto ks' for fs type
+ ,add --run_script parameter after image created
+ </summary>
+ <fixtures>
+ <copy src="ks_files/handset_blackbay_fs.ks" />
+ <content target="parse_manifest.py">
+import sys
+import json
+img_file = sys.argv[1]
+mic_version = sys.argv[2]
+manifest_file=open('mic-output/manifest.json')
+manifest=json.load(manifest_file)
+assert manifest['format'] == 'fs'
+assert manifest['version'] == mic_version
+assert manifest['fs']['pack'] == '.tar.gz'
+assert img_file in manifest['fs']['image_files']
+ </content>
+ </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 auto handset_blackbay_fs.ks --logfile=log.file --run_script="cd ./mic-output; cp manifest.json run_script.json"
+grep "Finished" log.file
+test -f ./mic-output/run_script.json
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+fs_dir=$(ls mic-output/ | grep 'handset_blackbay_fs-.*-rs.tar.gz')
+mic_version=$(mic --version 2>&1 | awk -F ' ' '{print $2}')
+python parse_manifest.py $fs_dir $mic_version
+
+]]>
+ </steps>
+ <teardown><![CDATA[
+echo "cleaning..."
+test -d ./mic-output && sudo rm -rf mic-output
+]]>
+ </teardown>
+</testcase>
--- /dev/null
+<testcase>
+ <summary>Based on test 'mic cr auto ks', cp tpk files from dir to /usr/app/.preload-tpk.
+ </summary>
+ <fixtures>
+ <copy src="ks_files/handset_blackbay.ks" />
+ <copy src="tpk/a.tpk" />
+ <copy src="tpk/b.tpk" />
+ </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 auto handset_blackbay.ks --logfile=log.file --tpk_install="./")
+grep "Not all files in the path" log.file
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+]]></steps>
+ <teardown><![CDATA[
+echo "cleaning..."
+sudo test -e ./mic-output && sudo rm -rf ./mic-output
+]]></teardown>
+</testcase>
--- /dev/null
+<testcase>
+ <summary>Cp tpk to specific folder, and magic line in this ks file is:
+# -*-mic2-options-*- -f loop --pack-to=@NAME@-rs.zip -*-mic2-options-*-
+ </summary>
+ <fixtures>
+ <copy src="ks_files/handset_blackbay.ks" />
+ <copydir src="tpk" />
+ </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 auto handset_blackbay.ks --logfile=log.file --tpk_install="./tpk"
+grep "Finished" log.file
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+ls mic-output/ | grep 'handset_blackbay-.*-rs.zip'
+]]></steps>
+ <teardown><![CDATA[
+echo "cleaning..."
+test -d ./mic-output && sudo rm -rf mic-output
+]]></teardown>
+</testcase>