aboutsummaryrefslogtreecommitdiffstats
path: root/meta-ivi-test/recipes-yocto-ivi/test-fw/test-fw/test-fw.sh
blob: b2f4c3ec8dbd63a47fedb2094447073a96ed3d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
# create dbus-session
dbus_live_p() {
  dbus-send --bus=$1 \
      --dest=org.freedesktop.DBus --type=method_call --print-reply \
      /org/freedesktop/DBus org.freedesktop.DBus.ListNames > /tmp/dbus_check
}

if [ -f /tmp/dbus_test-fw ]; then
  _bus_str=`grep -r DBUS_SESSION_BUS_ADDRESS /tmp/dbus_test-fw`
  _bus_addr=`echo ${_bus_str} | awk -F_BUS_ADDRESS= '{print $2}'`
  dbus_live_p ${_bus_addr}
  _dbus_live_p=`grep "method return" /tmp/dbus_check`
  if [ "x${_dbus_live_p}" = "x" ]; then
    dbus-launch >& /tmp/dbus_test-fw
  fi
else
  dbus-launch >& /tmp/dbus_test-fw
fi
export `grep -r DBUS_SESSION_BUS_ADDRESS /tmp/dbus_test-fw`

test_list=`ls /opt/tests/*/*_t.inc | awk -F/ '{print $4}' | awk -F_t '{print $1}'`

_test_run() {
  n=$1
  echo "##########"
  get_title
  echo "##########"

  if [ "x${n}" = "x" ]; then
    get_list
    cnt=$?
    echo "[ number of tests:" $cnt "]"
    for k in `seq $cnt`; do
      echo -n "[" run_${k} "]"
      eval run_${k} "no_verbose_output"
    done
  else
      echo "[" run_${n} "]"
      eval run_${n}
  fi
}

if [ "x$1" = "xhelp" ]; then
   echo "$0"
   echo " - run all test"
   echo ""
   echo "$0 list"
   echo " - list all test program"
   echo ""
   echo "$0 <name>"
   echo " - run all sequence of test <name>"
   echo ""
   echo "$0 <name> <no>"
   echo " - run sequence <no> of test <name>"
   echo ""
   exit 0
fi

for i in $test_list; do
  j="/opt/tests/${i}/${i}_t.inc"
  . $j

  if [ "x$1" != "x" ]; then
    if [ "$1" = "list" ]; then
      get_list
      cnt=$?
      echo $i $cnt
    elif [ "${1}" = "${i}" ]; then
      _test_run $2
      break
    fi
    continue;
  fi
  _test_run
  sleep 2
done