当前位置: 首页 > news >正文

【IC验证】perl脚本——分析前/后仿用例回归情况

目录

1 脚本名称

2 脚本使用说明

3 nocare_list文件示例

4 脚本执行方法

5 postsim_result.log文件示例

6 脚本代码


1 脚本名称

post_analysis

2 脚本使用说明

help:打印脚本说明信息

命令:post_analysis help

前/后仿结束后,首先填写好nocare_list(要过滤的log信息),然后在有log文件的上一层次路径下运行post_analysis脚本,执行脚本时若不带-all参数,则过滤掉nocare_list中的信息后只对后仿log进行分析,若带-all参数,则会过滤nocare_list中的信息后,对前/后仿的log信息进行分析,给出pass、timeout、bombed、violation等结果:

(1)不带-all参数:

  脚本会只分析名称带max或者min的后仿文件夹如(rfdig_m33_tc029_max、rfdig_m33_tc001_max_20230911),除去runsim.log文件中和nocare_list中的内容相关的violation,之后在各个用例文件夹下产生runsim_temp.log文件,随后分析runsim_temp.log文件out of reset之后的内容,若case PASS但存在violation,则输出结果 VOILATION以及$setuphold/$setup/$hold/$width违例的数量,并产生结果文件: postsim_result.log;若不仍存在violation,则输出结果PASS到postsim_result.log文件中;否则输出结果FAIL、TIMEOUT、RUNNING、BOMB到postsim_result.log文件中。

(2)带-all参数:

对前仿也进行上述分析。

3 nocare_list文件示例

在runsim.log中找到包含以下关键字的行,并将其删除:

4 脚本执行方法

post_analysis //只对文件夹名称中有max或者min的后仿文件夹进行分析
post_analysis -all //对前后仿的文件夹都进行分析

5 postsim_result.log文件示例

(1)PASS说明reset后无任何violation;

(2)VOILATION说明reset后仍存在violation,需查看对应的runsim_temp.log确认每一个violation;

(3)FAIL说明用例fail,需查看对应的runsim_temp.log,确认fail原因;

(4)TIMEOUT说明用例超时,需查看对应的runsim_temp.log,确认超时原因;

(5)RUNNING说明用例还在跑,确认相关原因;

(6)BOMB说明用例编译失败,需查看对应的vcs_compile.log确认编译失败原因;

6 脚本代码

#! /usr/bin/perl -w#==========================================================
# PERL MODULE 
#==========================================================use Cwd;
use Getopt::Long;$Getopt::Long::ignorecase = 0;#==========================================================
# PERL FUNCTION GetOptions (get command parameters)
#==========================================================
GetOptions("all" => \$g_dir) or die ("Invalid arguments. \n");our $g_help = 0;
if (!GetOptions ("help" => \$g_help,)) {&print_message();exit 0;
}#==========================================================
# GENERATE postsim_result.log FILE
#==========================================================our $sim_log = "runsim.log";
our $new_sim_log = "runsim_temp.log";
our @dirs = <*>;our $reset_line_num;
our $tail_lines; 
our $casename;($sec,$min,$hour,$mday,$mon,$year) = localtime();if (open(NOCARE_ID,"nocare_list") or die "cannot open nocare_list, no such file!!!") {@nocarecontent = <NOCARE_ID>;my $cur_dir = getcwd; chdir($cur_dir) or die "cannot cd $cur_dir"; #cd simdir open(PS_ID,">postsim_result.log");print  PS_ID "====================================================";printf PS_ID "%02d/%02d/%02d %02d:%02d:%02d",$year+1900,$mon+1,$mday,"$hour","$min","$sec";print  PS_ID "====================================================\n";foreach $dir (@dirs) { chdir($cur_dir) or die "cannot cd $cur_dir"; #cd simdir if ($g_dir) {if ($dir =~ /(.+)tc(\d+)(.*)/) {$casename = $dir;print "dir_name = $casename \n" ;}else {next;}}else {if (($dir =~ /(.+)(\d+)(.*)max(.*)/) or ($dir =~ /(.+)(\d+)(.*)min(.*)/)) {$casename = $dir;print "dir_name = $casename \n" ;}else {next;}}chdir($dir) or die "cannot cd $dir"; #cd simdir/xxx_tc00X(every case dir)unlink $new_sim_log;open(NEW_ID,">runsim_temp.log");$nocarename=$sim_log; #simdir/xxx_tcXXX/runsim.logif (open(LOG_ID,"$nocarename")) {@logcontent = <LOG_ID>; #ever line in runsim.log$match=0;$write_en=0;foreach $log (@logcontent) {if ($match eq 1) {$match = 0;} else {foreach $nocare (@nocarecontent) {if ($log =~ /$nocare/) {$match = 1;$write_en = 0;last;} else {$write_en = 1;}}if ($write_en eq 1) {print NEW_ID $log;$write_en = 0;}}}close NEW_ID; #finish write run_sim_temp.logclose LOG_ID; #finish read run_sim.log} else {print "Can not find $nocarename file!!! \n";}####report###if(-e "runsim.log") {if (open NEW_ID,$new_sim_log) {@linecontent = <NEW_ID>;$reset_bgn = 0;$setuphold = 0;$width     = 0;$print_over= 0;foreach $line (@linecontent) {if ($reset_bgn eq 1) {if ($line =~ /.*\$setuphold.*/ or $line =~ /.*\$setup.*/ or $line =~ /.*\$hold.*/) {$setuphold = $setuphold+1;} elsif ($line =~ /.*\$width.*/) {$width = $width+1;} elsif ($line =~ /.*the test case finished with (\w+).*/) {if($1 eq "FAIL") {$print_over = 1;printf PS_ID "%-50s%-10s%-30s","$casename",">>>>","FAIL";print  PS_ID "\n"; } elsif ($1 eq "TIMEOUT") {$print_over = 1;printf PS_ID "%-50s%-10s%-30s","$casename",">>>>","TIMEOUT";print  PS_ID "\n";  } elsif ($1 eq "PASS") {$print_over = 1;if ($setuphold > 0 or $width > 0) {printf PS_ID "%-50s%-10s%-30s","$casename",">>>>","VOILATION";printf PS_ID "\$setuphold:%-5d \$width:%-5d",$setuphold,$width;print  PS_ID "\n";    } else {printf PS_ID "%-50s%-10s%-30s","$casename",">>>>","PASS";print  PS_ID "\n";   }} else {next;}} else {next;}} else {if ($line =~ /.*Out of reset!.*/) {$reset_bgn = 1;} else {next;}}}if ($print_over eq 0) {printf PS_ID "%-50s%-10s%-30s","$casename",">>>>","RUNNING";print  PS_ID "\n"; } else {next;}} else {next;}} else {printf PS_ID "%-50s%-10s%-30s","$casename",">>>>","BOMBED";print  PS_ID "\n";    }}printf PS_ID "%-58s","========================================================";printf PS_ID "%-7s",$ENV{'USER'};printf PS_ID "%58s","========================================================";close PS_ID;
}#==========================================================
# HELP INFORMATION PRINT
#==========================================================if ($g_help) {&print_message();exit 0;
}#==========================================================
# SUB PROGRAM (print help ingormation) 
#==========================================================sub print_message ()
{print "
NAMEpost_analysis - Check case sim result scriptMAXSCENDpost_analysis [-h]Options-h : help informationYou should run this script in the directory containing all the cases' working directories\n";
}

http://www.lryc.cn/news/258557.html

相关文章:

  • Ansible适合的场景是什么?
  • Flink 读写 HBase 总结
  • 记录一次chatGPT人机协同实战辅助科研——根据词库自动进行情感分析
  • Java_LinkedList链表详解
  • MacOS 12 开放指定端口 指定ip访问
  • LeedCode刷题---滑动窗口问题
  • leetcode24. 两两交换链表中的节点
  • TCP传输层详解(计算机网络复习)
  • 【LuatOS】简单案例网页点灯
  • 百度APP iOS端包体积50M优化实践(七)编译器优化
  • STM32-新建工程(标准库)
  • Android集成科大讯飞语音识别与语音唤醒简易封装
  • 【Linux】telnet命令使用
  • VCG 标记使用(BitFlags)
  • Pandas中的Series(第1讲)
  • 从手工测试进阶中高级测试?如何突破职业瓶颈...
  • 【链表Linked List】力扣-114 二叉树展开为链表
  • Go (一) 基础部分4 -- 文件处理
  • 集合03 Collection (List) - Java
  • 国产化软件突围!怿星科技eStation产品荣获2023铃轩奖“前瞻优秀奖”
  • 如何解决Redis热Key问题?
  • react Hooks之useId
  • 2023年全球软件开发大会(QCon广州站2023)-核心PPT资料下载
  • MicroSD 卡 使用读卡器 读取速度测试
  • Selenium+Unittest+HTMLTestRunner框架更改为Selenium+Pytest+Allure(一)
  • LoRA(Low-Rank Adaptation)
  • 【银行测试】第三方支付功能测试点+贷款常问面试题(详细)
  • 前端:HTML+CSS+JavaScript实现轮播图2
  • 使用条件格式突出显示单元格数据-sdk
  • java面试题-Dubbo和zookeeper运行原理