aboutsummaryrefslogtreecommitdiffstats
path: root/meta-ivi-test/recipes-extended/node-startup-controller/node-startup-controller/node-startup-controller_t.inc
blob: 43a92f70225969ac57cbac1954949ec1b9487c9e (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
78
79
80
81
82
83
84
#!/bin/sh
get_list() {
  return 1
}

get_title() {
  echo "Node Startup Controller"
}

_run_dir=/opt/tests/node-startup-controller
_luc_check() {
    while true; do
      ${_run_dir}/luc_check.sh > /tmp/t
      is_nsc=`grep LUC is not required`
      if [ "x${is_nsc}" != "x" ]; then
	  echo "restart node-startup-controller"
	  systemctl stop node-startup-controller
	  sleep 1
	  systemctl start node-startup-controller
      else
	  break
      fi
    done
}
_run_() {
  systemctl stop dbus
  if [ ! -d ${_run_dir}/bak ]; then
     mkdir ${_run_dir}/bak
     cp -f etc/dbus-1/system.d/org.genivi.NodeStartupController1.conf ${_run_dir}/bak
     cp -f etc/dbus-1/system.d/org.genivi.NodeStateManager.conf ${_run_dir}/bak
  fi
  cp -f ${_run_dir}/etc/dbus-1/system.d/org.*.conf /etc/dbus-1/system.d
  systemctl start dbus

  systemctl start dlt-receive
  systemctl start node-startup-controller
  systemctl start nsm-dummy

  _luc_check
  ${_run_dir}/${1}

  systemctl stop nsm-dummy
  systemctl stop node-startup-controller
  sleep 1
  systemctl stop nsm-dummy
  #systemctl stop dlt-receive

  systemctl stop dbus
  cp -f ${_run_dir}/bak/org.*.conf /etc/dbus-1/system.d
  systemctl start dbus
}

_check_luc_test_01() {
    cat /tmp/t | grep 'NSC-' | grep 'CTRL' > /tmp/t2
    _c1=`cat /tmp/t2 | grep "Updated LUC to:" | grep app1.unit`
    _c2=`cat /tmp/t2 | grep "\[Starting LUC group: 0\]"`
    _c3=`cat /tmp/t2 | grep "\[Starting LUC app: app1.unit\]"`
    _c4=`cat /tmp/t2 | grep "\[Finished starting LUC app: app1.unit\]"`
    _c5=`cat /tmp/t2 | grep "\[Finished starting LUC group: 0\]"`
    if [ "x${_c1}" != "x" -a "x${_c2}" != "x" -a "x${_c3}" != "x" -a \
	"x${_c4}" != "x" -a "x${_c5}" != "x" ]; then
	echo "[ PASSED ]"
    else
	echo "[ FAILED ]"
    fi
}

_run() {
  if [ "x${2}" != "x" ]; then
    _run_ ${1}.sh > /tmp/t 2> /tmp/t.err
    eval _check_${1}
  else
    _run_ ${1}.sh 2> /tmp/t.err
  fi
}

run_1() {
    _run luc_test_01 $*
    
}

run_2() {
    _run nhm-systemd-test $*
}