ltp-ddt wdt_test
2024-09-02 14:46:06
# @name Watchdog Timer getsupport,settimeout,getstatus,keepalive ioctl and write test
# @desc Watchdog Timer getsupport,settimeout,getstatus,keepalive ioctl and write test
# @requires watchdog
# @desc Watchdog Timer getsupport,settimeout,getstatus,keepalive ioctl and write test
# @requires watchdog
WDT_S_FUNC_GETSUPORT
source 'common.sh'; do_cmd install_modules.sh 'wdt' ;
DEV_NODE=`get_devnode.sh "wdt"` || die "error getting devnode for wdt";
do_cmd wdt_tests -device $DEV_NODE -ioctl getsupport
wdt_tests -device /dev/watchdog -ioctl getsupport
wdt_tests是c代码
SOURCES := \
../utils/user/st_fileapi.c \
src/interface/common/st_wdt_common.c \
src/parser/st_wdt_parser.c \
src/testcases/st_wdt_ioctl.c \
src/testcases/st_wdt_open_close.c \
src/testcases/st_wdt_write.c
../utils/user/st_fileapi.c \
src/interface/common/st_wdt_common.c \
src/parser/st_wdt_parser.c \
src/testcases/st_wdt_ioctl.c \
src/testcases/st_wdt_open_close.c \
src/testcases/st_wdt_write.c
MAKE_TARGETS := wdt_tests
wdt_tests:
$(CC) $(CFLAGS) $(LDFLAGS) -o wdt_tests ${INCLUDES} ${SOURCES}
main函数位于:
st_wdt_parser.c
/****************************************************************************
* Function - Main function
* Functionality - This is where the execution begins
* Input Params - argc,argv
* Return Value - None
* Note - None
****************************************************************************/
int main(int argc, char *argv[])
{
* Function - Main function
* Functionality - This is where the execution begins
* Input Params - argc,argv
* Return Value - None
* Note - None
****************************************************************************/
int main(int argc, char *argv[])
{
int retval;
/* Initialize options with default vales */
st_init_wdt_test_params();
/* Invoke the parser function to process the command line options */
retval = st_process_wdt_test_options(argc, argv);
return retval;
}
1.
st_init_wdt_test_params(); //初始化 in st_wdt_common.c
void st_init_wdt_test_params(void)
{
strcpy(testoptions.device , DEFAULT_DEVICE);
testoptions.ioctl = DEFAULT_IOCTL;
testoptions.loop = DEFAULT_LOOP_COUNT;
testoptions.ioctl_arg = DEFAULT_IOCTL_ARG;
testoptions.iomode = DEFAULT_IOMODE;
}
{
strcpy(testoptions.device , DEFAULT_DEVICE);
testoptions.ioctl = DEFAULT_IOCTL;
testoptions.loop = DEFAULT_LOOP_COUNT;
testoptions.ioctl_arg = DEFAULT_IOCTL_ARG;
testoptions.iomode = DEFAULT_IOMODE;
}
#define DEFAULT_IOMODE ST_WDT_IOMODE_NONE
#define DEFAULT_DEVICE "/dev/watchdog"
#define DEFAULT_IOCTL ST_WDT_IOCTL_NONE
#define DEFAULT_LOOP_COUNT 1
#define DEFAULT_IOCTL_ARG 0
#define DEFAULT_DEVICE "/dev/watchdog"
#define DEFAULT_IOCTL ST_WDT_IOCTL_NONE
#define DEFAULT_LOOP_COUNT 1
#define DEFAULT_IOCTL_ARG 0
2.
retval = st_process_wdt_test_options(argc, argv); //in st_wdt_parser.c
int c = getopt_long_only(argc, argv, "vh", long_options,
&option_index); //获取参数
&option_index); //获取参数
TEST_PRINT_TST_START(testcaseid); //打印start
st_print_wdt_test_params(&testoptions, testcaseid); //打印参数
fileDesc = st_wdt_open(&testoptions); //open wdt
ret_val2 = st_wdt_ioctl_test(&testoptions, testcaseid, fileDesc); //
TEST_PRINT_TST_RESULT(result, testcaseid); //打印result
TEST_PRINT_TST_END(testcaseid); //打印end
TEST_PRINT_TST_END(testcaseid); //打印end
ioctl(fileDesc, WDIOC_GETTIMEOUT, &timeout); //取超时时间
一旦/dev/watchdog被打开,则watchdog激活,并且除非喂狗,否则将在一段时间之后重启。
最新文章
- 如何在Webstorm/Phpstorm中设置连接FTP,并快速进行文件比较,上传下载,同步等操作
- 被指定为此窗体的 MdiParent 的窗体不是 MdiContainer。 参数名: value
- 报错解决:No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
- 图片加载js类库
- 2_2数据类型与C#部分语法[wp8特色开发与编程技巧]
- Ehcache(06)——监听器
- CSS+DIV问题!DIV的最小高度问题!
- Random类(java.util)
- PHP操作FTP类 (上传下载移动创建等)
- 用JSP做后台管理系统
- UVA - 11346 Probability (概率)
- PHP学习笔记三十一【const】
- Java学习01
- 2.1 IDEA
- CI分页器pagination的原理及实现
- GOLang(第二篇 发起一个Http请求)
- 200行Java代码搞定计算器程序
- iframe兄弟间和iframe父子间的值传递问题
- Protobuf java版本安装步骤
- C# Unity的使用
热门文章
- 百度ueditor新增的将word内容导入到富文本编辑框的功能.
- ORACLE修改表字段顺序
- Hibernate入门学习笔记
- 牛客:t次询问,每次给你一个数n,求在[1,n]内约数个数最多的数的约数个数(数论+贪心)
- Cadence 学习
- statistics——数学统计函数
- mysql.connector.errors.ProgrammingError: 1698 (28000): Access denied for user 'root'@'localhost'
- java 虚方法。 后面new 那个类, 就调用哪个类的方法 ,而非定义类的方案。 关于父子 类的 呵呵
- uni-app 云打包证书生成笔记
- PHP 中 Error 和 Exception 两种异常的特性及日志记录或显示