用词法分析器Flex过滤日志
每日构造中,我的项目中 Visual Studio 的 MakeFile 后会产生大量信息,如下
Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
========== Build: 0 succeeded, 0 failed, 23 up-to-date, 0 skipped ==========
Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
========== Build: 0 succeeded, 1 failed, 7 up-to-date, 0 skipped ==========
现在假如我想确定有多少个子工程 proj 失败了,可以用词法分析器 Flex 来解决,以下是我的 check.l 文件内容
%option noyywrap nodefault
%{
int err_count = 0;
%}
%%
.*" 0 failed".* { }
.*"failed".* { err_count++; }
\n { }
. { }
%%
int main(int argc, char **argv)
{
if (argc > 1)
{
if ( !(yyin = fopen(argv[1], "r")))
{
perror(argv[1]);
return 1;
}
}
yylex();
if (err_count > 0)
printf("%d error found.\n", err_count);
else
printf("Successfully.\n");
return 0;
}
然后就运行flex.exe check.l 产生lex.yy.c文件,并用Visual Studio生成一个工程check
之后在命令行下运行check.exe log.txt便可以简单地知道每日构造成功与否。
最新文章
- Unity iOS混合开发界面切换思路
- ruby中excel简单操作以及文件读取操作方法
- Lock的用法,为什么要用?
- CDN技术发展趋势
- [LoadRunner]性能测试实践_Hessian协议脚本编写2
- Poj(2349),最小生成树的变形
- C#获取程序所在目录路径
- 001-python基础
- .net中用到的一些方法
- 超级密码(bfs)
- Linux下的变化的主机名步骤
- .net中的emit
- TCP与UDP的区别(转)
- Python数据分析学习(一):Numpy与纯Python计算向量加法速度比较
- consul搭建
- npm install --save
- Mybatis ResultMap Collection 复合主键
- Ubuntu 关闭防火墙
- TestNG中DataProvider的用法
- Shell或notepad连接虚拟机操作