Add test/tct_sdmux.bats 91/79691/18
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 12 Jul 2016 08:44:40 +0000 (10:44 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Tue, 6 Dec 2016 15:37:13 +0000 (16:37 +0100)
Exactly one sdmux device should be connected during these tests.

Change-Id: I48c098cc02416e52067fe5b2bfe23da5e9c78463
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
test/tct_sdmux.bats [new file with mode: 0755]

diff --git a/test/tct_sdmux.bats b/test/tct_sdmux.bats
new file mode 100755 (executable)
index 0000000..d0cdcef
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/env bats
+
+. ./tct/flash/flash.sh
+
+@test "is_connected" {
+    RET=`sd-mux-ctrl -l | head -n 1 | grep -o "[0-9]*"`
+    [ $RET -eq 1 ]
+}
+
+setup() {
+    SDMUX=`sd-mux-ctrl -l | awk '/Serial/ {sub(",$", "", $6); print $6}'`
+}
+
+@test "sdmux_init" {
+    sdmux_init "$SDMUX"
+}
+
+@test "switch2testserver" {
+    switch2testserver "$SDMUX"
+}
+
+@test "switch2device" {
+    switch2device "$SDMUX"
+}
+
+@test "restart_device" {
+    restart_device "$SDMUX"
+}
+
+@test "change_id" {
+    NEW_ID1="foo_bar"
+    change_id "$SDMUX" "$NEW_ID1"
+    NEW_ID2=`sd-mux-ctrl -l | awk '/Serial/ {sub(",$", "", $6); print $6}'`
+    [ "${NEW_ID1}" = "${NEW_ID2}" ]
+    change_id "$NEW_ID1" "$SDMUX"
+}