qnx_cpu_check.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import subprocess, re, sys
00004 
00005 def check_pinfo(info, search_key, expected_str):
00006     global ret
00007     tag =  re.findall(search_key, info)
00008     if tag :
00009         tag = tag[-1]
00010     else:
00011         tag = "Could nof find " + search_key
00012 
00013     print "%s\t\t\t\t\t\t" % (tag),
00014     if tag == expected_str :
00015         print "Ok"
00016     else:
00017         print "False"
00018         ret = False
00019 
00020 def qnx_cpu_check() :
00021     global ret
00022 
00023     info = subprocess.Popen(["pidin", "info"], stdout=subprocess.PIPE).communicate()[0]
00024 
00025     # CPU:X86 Release:6.5.0  FreeMem:833Mb/1023Mb BootTime:Apr 27 22:29:28 UTC 2014
00026     # Processes: 37, Threads: 98
00027     # Processor1: 131758 Intel 686 F6M15S2 1969MHz FPU
00028 
00029     ret = True
00030     
00031     print "  Check CPU Type .. ",
00032     check_pinfo(info, 'CPU:\S+', "CPU:X86")
00033 
00034     print "  Check Memory Size .. ",
00035     check_pinfo(info, '(?<=Mb\/)\S+', "3318Mb")  # Positive-lookbehind assertion
00036 
00037     print "  Check OS Release .. ",
00038     check_pinfo(info, 'Release:\S+', "Release:6.5.0")
00039 
00040     print "  Check Number of CPU  .. ",
00041     check_pinfo(info, 'Processor\S+:', "Processor2:")
00042 
00043     print re.sub('(^|\n)', '\n  -', info)
00044 
00045     return ret
00046 
00047 
00048 


hironx_ros_bridge
Author(s): Kei Okada
autogenerated on Mon Oct 6 2014 07:19:42