趋势科技实习录--coredump问题(2015/03/03)

Penny Jin (QA-CN)Hi
To catch possible crash occurring during the progress of functional test. It is suggested to enable core dump file 
in functional testing environment.

To enable core dump file generating
$  sudo ulimit -c unlimited
Core dump files will be automatically generated in /cores folder, with file name look like core.39426

我们的iDCE 测试框架里要enable下core dump, 这样的话如果有crash 就会知道了


9:31Xuan Qi (RD-CN-INTRN)嗯


9:31Penny Jin (QA-CN)你的任务是在执行的脚本前运行下这条命令,然后想办法判断/cores 目录下有没有dump文件生成
如果有生成就说明发生了crash


9:32Xuan Qi (RD-CN-INTRN)好的


9:34Penny Jin (QA-CN)如果发现有dump文件生成,现在有2个解决办法,一个是立即让case停止,或者是在某个地方记个标记,说明曾经发生了crash
你现在按照记个标记的方法做吧
另外,还可以关注下/Library/Logs/DiagnosticReports 和 ~/ Library/Logs/DiagnosticReports, 程序crash后会生成report log在这两个folder下面 ,
命令是TestiDCE的就需要记录下来,因为说明是TestiDCE发生了crash
之前让你做的那个脚本可以先放放,没事情的时候再想想怎么弄


9:38Xuan Qi (RD-CN-INTRN)你刚才说我在执行的脚本前运行这个命令,我需要执行那个脚本?


9:38Penny Jin (QA-CN)你可以先下我们trigger mac上regression的脚本
主要都是放在start_testidce.sh里的
如果要改的话,你copy一份啊,别在原文件上修改哦


9:39Xuan Qi (RD-CN-INTRN)嗯


9:39Penny Jin (QA-CN)copy start_testidce.sh

脚本改好了之后,你可以先在10.9.4那台机器上按照start_testidce.sh的步骤执行下在enable core dump的情况跑所有case,看会不会有dump生成
记得copy build,\\10.204.16.28\home\DCE\build 1.0.1025\bin
目前最新的build 1025
TestiDCE \\10.204.16.28\home\DCE\Steven_Du\TestiDCE_1.0.1011


15:02Xuan Qi (RD-CN-INTRN)我看在start_testidce.sh里有copy build的步骤啊


15:02Penny Jin (QA-CN)如果执行32bit build ,就在deploy后再加--x86, 不加的话默认就是跑64bit build
copy build的步骤的前提是/users/mac/下有build 目录了
这个过程是在start_testidce.sh之前就做好了的


15:03Xuan Qi (RD-CN-INTRN)嗯
我主要是在start_testidce.sh里做修改吧


15:04Penny Jin (QA-CN)对,可以另外再写个脚本,执行完case后check 有没有dump


15:05Xuan Qi (RD-CN-INTRN)嗯,我明白

修改了一个.sh文件

echo '111111' | sudo -S ulimit -c unlimited

echo '>>>Start do Test on Mac'
rm -f -d -R /Users/mac/TestIDCE
sleep 1s
svn co http://10.204.157.78/svn/qa/DCE/RobotFramework/TestIDCE /Users/mac/TestIDCE

echo '>>>start copy build'
cp -R /Users/mac/Build /Users/mac/TestIDCE

chmod a+x /Users/mac/TestIDCE/Build/32/TestiDCE
chmod a+x /Users/mac/TestIDCE/Build/64/TestiDCE
chmod a+x /Users/mac/TestIDCE/Build/iLogDecryptor

echo 'set current tac version for check_tsc_version'
python /Users/mac/TestIDCE/tools/SetTSCVersion.py $1 $2 $3

tt=`sw_vers -productVersion`
if [ $tt == '10.8.5' ]
then  
    echo $DYLD_LIBRARY_PATH
    unset DYLD_LIBRARY_PATH
    sleep 2s
    echo $DYLD_LIBRARY_PATH
fi

sudo rm -rf /cores/*
sudo rm -rf /Library/Logs/DiagnosticReports/*
sudo rm -rf ~/Library/Logs/DiagnosticReports/*

cd /Users/mac/TestIDCE
echo '>>>start Run test cases'
python starttest.py --deploy --x86
python starttest.py --all

cd /Users/mac
python /Users/mac/CountTestResult.py $3
python /Users/mac/CheckResult.py 

自己写了一个脚本CheckResult.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import glob, os

#Windows
filesRead1 = r"/cores/TestiDCE*.crash"
filesRead2 = r"/Library/Logs/DiagnosticReports/TestiDCE*.crash"
filesRead3 = r"~/Library/Logs/DiagnosticReports/TestiDCE*.crash"
fileWrite = r"/Users/mac/Desktop/count.txt"


if __name__ == '__main__':
    list1 = glob.glob(filesRead1)
    list2 = glob.glob(filesRead2)
    list3 = glob.glob(filesRead3)
    #print list2
    
    out=open(fileWrite,'w')
    out.write('All Core files:')
    out.write('\n')
    
    for i in list1:
        basename = os.path.basename(i)
        #print basename
        
        out.write('filename:' + basename )
        out.write('\n')

    for i in list2:
        basename = os.path.basename(i)
        #print basename
        
        out.write('filename:' + basename )
        out.write('\n')

    for i in list3:
        basename = os.path.basename(i)
        #print basename
        
        out.write('filename:' + basename )
        out.write('\n')

       
    out.close()
    

你可能感兴趣的:(实习项目记录)