/
tc_workfd_insmod.py
59 lines (51 loc) · 1.57 KB
/
tc_workfd_insmod.py
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
# SPDX-License-Identifier: GPL-2.0
#
# Description:
# insmod module tb.config.tc_workfd_insmod_module with
# module path tb.config.tc_workfd_insmod_mpath and
# tb.config.tc_workfd_insmod_module_path
# check if the strings in list tb.config.tc_workfd_insmod_module_checks
# come back when inserting the module.
#
# used variables
#
# - tb.config.tc_workfd_insmod_module
#| module name without '.ko'
#| default: ''
#
# - tb.config.tc_workfd_insmod_mpath
#| path to modules
#| default: ''
#
# - tb.config.tc_workfd_insmod_module_path
#| path to module
#| default: ''
#
# - tb.config.tc_workfd_insmod_module_checks
#| list of strings which must be found when loading module
#| default: ''
#
# End:
from tbotlib import tbot
tb.define_variable('tc_workfd_insmod_module', '')
tb.define_variable('tc_workfd_insmod_mpath', '')
tb.define_variable('tc_workfd_insmod_module_path', '')
tb.define_variable('tc_workfd_insmod_module_checks', '')
# set board state for which the tc is valid
tb.set_board_state("linux")
c = tb.workfd
tmp = 'rmmod ' + tb.config.tc_workfd_insmod_module
tb.eof_write_cmd(c, tmp)
tmp = 'uname -r'
tb.eof_write(c, tmp)
ret = tb.tbot_expect_string(c, '\n')
if ret == 'prompt':
tb.end_tc(False)
ret = tb.tbot_expect_string(c, '\n')
if ret == 'prompt':
tb.end_tc(False)
vers = tb.buf.rstrip()
tb.tbot_expect_prompt(c)
tmp = 'insmod ' + tb.config.tc_workfd_insmod_mpath + '/' + vers + '/' + tb.config.tc_workfd_insmod_module_path + '/' + tb.config.tc_workfd_insmod_module + '.ko'
tb.eof_write(c, tmp)
tb.tbot_rup_check_all_strings(c, tb.config.tc_workfd_insmod_module_checks, endtc=True)