[openrtm-commit:01542] r2612 - trunk/OpenRTM-aist/src/lib/rtm/tests
openrtm @ openrtm.org
openrtm @ openrtm.org
2015年 6月 10日 (水) 09:27:06 JST
Author: irie
Date: 2015-06-10 09:27:06 +0900 (Wed, 10 Jun 2015)
New Revision: 2612
Added:
trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_coverage.sh
trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_tests_changeInfo.py
Log:
Add rtm_coverage.sh and rtm_tests_changeInfo.py by Irie
Added: trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_coverage.sh
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_coverage.sh (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_coverage.sh 2015-06-10 00:27:06 UTC (rev 2612)
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+compileOKDir_list="CORBA_IORUtil ConnectorListener CorbaConsumer NVUtil NumberingPolicy ObjectManager OutPortProvider PeriodicECSharedComposite RTCUtil RingBuffer SdoOrganization SdoService StateMachine"
+
+#compileOKDir_list="CORBA_IORUtil"
+
+Tests="Tests"
+
+#echo "--------cd src/lib/rtm/tests--------"
+#cd OpenRTM-aist/src/lib/rtm/tests
+
+COVERAGE_DIR=../Coverage
+
+if [ -e $COVERAGE_DIR ]; then
+ rm -rf $COVERAGE_DIR
+fi
+
+echo "--------mkdir ../Coverage--------"
+mkdir $COVERAGE_DIR
+
+makeOKDirCoverage2rtm () {
+ for dir in $*; do
+ cd $dir
+ pwd
+ runCmd=$dir$Tests
+ cat ./Coverage/$runCmd.info >> ../../Coverage/allcoverage.info
+ cd ../
+ pwd
+ done
+ cd ../Coverage
+ pwd
+ echo "--------genhtml -o . allcoverage.info--------"
+ genhtml -o . allcoverage.info
+}
+
+makeOKDirCoverage2rtm $compileOKDir_list
+
+
Added: trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_tests_changeInfo.py
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_tests_changeInfo.py (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/tests/rtm_tests_changeInfo.py 2015-06-10 00:27:06 UTC (rev 2612)
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+
+import sys, os, datetime, time
+import commands
+
+LINE_START_SF = "SF:"
+END_OF_RECORD = "end_of_record"
+
+class ChangeTestsInfo():
+ def __init__(self, parent=None):
+ print "__init__(self, parent=None):"
+
+ def checkIsDeleteRecord(self, line, use_line_src_lib_rtm):
+ rtmlength = len(use_line_src_lib_rtm)
+ linelength = len(line)
+ if linelength > rtmlength:
+ if line[0:rtmlength] == use_line_src_lib_rtm:
+ for var in range(rtmlength + 1, linelength):
+ if line[var] == '/':
+ return True
+ return False
+ return True
+
+# if line[0:7] == DEL_LINE_ROOTUSR:
+# return True
+# coillength = len(DEL_LINE_SRC_LIB_COIL)
+# if line[0:coillength] == DEL_LINE_SRC_LIB_COIL:
+# return True
+
+ def getSrcLibRtmPath(self):
+ nowdir = commands.getoutput('pwd')
+ nowdirpart = nowdir.split('/')
+ usepath = '/'
+ for idx in range(1, (len(nowdirpart) - 2)):
+ usepath = usepath + nowdirpart[idx] + '/'
+# print usepath
+ return usepath
+
+ def openTestsInfoFile(self, infofilename):
+ use_line_src_lib_rtm = LINE_START_SF + self.getSrcLibRtmPath()
+ print use_line_src_lib_rtm
+
+ infofilenameNew = infofilename + '.new'
+ infofilenameOrg = infofilename + '.org'
+ if os.path.exists(infofilenameOrg) == False:
+ os.rename(infofilename, infofilenameOrg)
+ fr = open(infofilenameOrg)
+ allDt = fr.read()
+ fr.close()
+
+# fw = open(infofilenameNew, "w")
+ fw = open(infofilename, "w")
+ writeFlag = True
+
+ allLine = allDt.split('\n')
+ for line in allLine:
+ if len(line) > 10:
+# if line[0:7] == DEL_LINE_ROOTUSR:
+ if line[0:3] == LINE_START_SF:
+ if self.checkIsDeleteRecord(line, use_line_src_lib_rtm) == True:
+ writeFlag = False
+ continue
+ if line == END_OF_RECORD:
+ if writeFlag == False:
+ writeFlag = True
+ continue
+ if writeFlag == True:
+ fw.write(line + '\n')
+ fw.close
+
+def main(argvs):
+ changetestsinfo = ChangeTestsInfo()
+ changetestsinfo.openTestsInfoFile(argvs[1])
+
+if __name__ == '__main__':
+ main(sys.argv)
More information about the openrtm-commit
mailing list