Add case of testing when postscript fails
authoryuhuan.yang <yuhuan.yang@samsung.com>
Mon, 25 Dec 2017 07:05:21 +0000 (15:05 +0800)
committeryuhuan.yang <yuhuan.yang@samsung.com>
Fri, 26 Jan 2018 06:22:49 +0000 (14:22 +0800)
Change-Id: Iefca673d6abfad564131106b45c695740ae3ecee
(cherry picked from commit 4b20bfb69348d9ab9aafc66eab942c38c92ecc28)

cases/create/neg_cases/mic_cr_auto_loop_script_error.case [new file with mode: 0644]
fixtures/ks_files/handset_blackbay_script_error.ks [new file with mode: 0755]

diff --git a/cases/create/neg_cases/mic_cr_auto_loop_script_error.case b/cases/create/neg_cases/mic_cr_auto_loop_script_error.case
new file mode 100644 (file)
index 0000000..ac93a74
--- /dev/null
@@ -0,0 +1,23 @@
+<testcase>
+  <summary>test 'mic cr auto ks' for loop 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 loop --pack-to=@NAME@-rs.zip -*-mic2-options-*-
+  </summary>
+  <fixtures>
+    <copy src="ks_files/handset_blackbay_script_error.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 cr auto handset_blackbay_script_error.ks --logfile=log.file)
+grep "/usr/bin/error_command" log.file
+sudo $losetup_path -a
+sudo $losetup_path -a | wc -l | xargs test 0 -eq
+]]></steps>
+  <teardown><![CDATA[
+echo "cleaning..."
+test -d ./mic-output && sudo rm -rf mic-output
+]]></teardown>
+</testcase>
diff --git a/fixtures/ks_files/handset_blackbay_script_error.ks b/fixtures/ks_files/handset_blackbay_script_error.ks
new file mode 100755 (executable)
index 0000000..8d2954f
--- /dev/null
@@ -0,0 +1,46 @@
+# -*-mic2-options-*- -f loop --pack-to=@NAME@-rs.zip -*-mic2-options-*-
+
+lang en_US.UTF-8
+keyboard us
+timezone --utc America/Los_Angeles
+
+part / --size 848 --ondisk sda --fstype=ext3 --label platform
+
+rootpw tizen
+bootloader  --timeout=0  --append="rootdelay=5 security=none"
+
+desktop --autologinuser=tizen
+user --name tizen  --groups audio,video --password 'tizen'
+
+repo --name=Tizen-base --baseurl=http://10.113.136.109/repo/download.tizen.org/releases/2.2/tizen-2.2_20130719.3/repos/tizen-base/ia32/packages/  --save --gpgkey=0 --ssl_verify=no
+repo --name=Tizen-main --baseurl=http://10.113.136.109/repo/download.tizen.org/releases/2.2/tizen-2.2_20130719.3/repos/tizen-main/ia32/packages/  --save --gpgkey=0 --ssl_verify=no
+repo --name=Tizen-base-source --baseurl=http://10.113.136.109/repo/download.tizen.org/releases/2.2/tizen-2.2_20130719.3/repos/tizen-base/source/ --save --source --gpgkey=0 --ssl_verify=no
+repo --name=Tizen-main-source --baseurl=http://10.113.136.109/repo/download.tizen.org/releases/2.2/tizen-2.2_20130719.3/repos/tizen-main/source/ --save --source --gpgkey=0 --ssl_verify=no
+
+%packages
+coreutils
+bash
+kernel*
+rpm
+%end
+
+%attachment
+preos-runtime
+bootstub-bb
+/boot/cmdline
+/boot/vmlinuz-*
+%end
+
+%post
+set -e
+trap 'echo KS POST ERROR: command \"$BASH_COMMAND\" failed with error code $?' ERR
+/usr/bin/error_command
+# Set environment for launchpad daemon. Fix TDIST-264
+cat > /etc/sysconfig/launchpad <<EOF
+DISPLAY=:0
+EOF
+%end
+
+%post --nochroot
+
+%end