Adds basic script to launch universal-switch batch mode 52/166752/39
authorRadoslaw Cybulski <r.cybulski@partner.samsung.com>
Thu, 11 Jan 2018 16:07:54 +0000 (17:07 +0100)
committerRadoslaw Cybulski <r.cybulski@partner.samsung.com>
Wed, 24 Jan 2018 14:41:43 +0000 (15:41 +0100)
Implement your test in file batch_file put in src/batch directory.
Run run-batch.sh file, which will send files to the target device,
launch universal-switch in batch mode (must be turned off before
launching) and output to the terminal any output from the batch.

Change-Id: I5104fd75b551875f25e76c52b6b01f1640c73dab

src/batch/batch_exec.sh [new file with mode: 0755]
src/batch/run-batch.sh [new file with mode: 0755]

diff --git a/src/batch/batch_exec.sh b/src/batch/batch_exec.sh
new file mode 100755 (executable)
index 0000000..0eebcc0
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+PREFIX=qe9fh483fb4i3fb8we3_universal_switch
+DLOG=/tmp/${PREFIX}_dlog.txt
+TEST_FILE=/tmp/${PREFIX}_test_file
+OUTPUT=/tmp/${PREFIX}_output.txt
+
+PERMISSIONS=User::Pkg::org.tizen.universal-switch::RO
+
+dlogutil -c
+mkfifo -m 0666 $DLOG
+(
+       dlogutil '*' > $DLOG 2> /dev/null
+)&
+chsmack -a $PERMISSIONS $TEST_FILE
+chsmack -a $PERMISSIONS $DLOG
+JOBS=$(jobs -p)
+echo "JOB is $JOBS"
+
+rm -f $OUTPUT
+app_launcher -t org.tizen.universal-switch
+STATUS=$(app_launcher -s org.tizen.universal-switch TESTS_PATH $TEST_FILE TESTS_OUTPUT $OUTPUT)
+STATUS2=${STATUS#*successfully launched pid = }
+PID=${STATUS2% with debug*}
+tail --pid=$PID -f /dev/null
+kill -9 $JOBS
+
+rm -f $DLOG
+cat $OUTPUT
diff --git a/src/batch/run-batch.sh b/src/batch/run-batch.sh
new file mode 100755 (executable)
index 0000000..71a0a86
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+P=$(readlink -f "$1")
+SCRIPT=$(readlink -f "$0")
+cd $(dirname "$SCRIPT")
+cd ../..
+
+./project-tool -j
+sdb root on
+sdb push $P /tmp/qe9fh483fb4i3fb8we3_universal_switch_test_file
+sdb push src/batch/batch_exec.sh /tmp/qe9fh483fb4i3fb8we3_universal_switch_test_exec
+sdb shell chsmack -a _ /tmp/qe9fh483fb4i3fb8we3_universal_switch_test_exec
+sdb shell "cd /tmp; /bin/bash /tmp/qe9fh483fb4i3fb8we3_universal_switch_test_exec; echo done"
+