This SDK allows to integrate a syncml stack in a C++ application on a variety of platforms. Current

源代码在线查看: gentests.py

软件大小: 1906 K
上传用户: IsabellaJ
关键词: application integrate platforms Current
下载地址: 免注册下载 普通下载 VIP

相关代码

				#

				# Usage: gentest.py  

				#

				# Finds all CPPUnit tests suites defined with

				# FUNAMBOL_TEST_SUITE_REGISTRATION/FUNAMBOL_TEST_SUITE

				# and generates a C source file which references all

				# of them. Compiling that C source file and adding

				# it to a test runner ensures that all tests are added

				# to the resulting executable.

				#

				

				import sys, os, re

				

				output = open(sys.argv[2], "w")

				

				

				#import subprocess

				#(dummy,input) = os.popen4("dumpbin " + sys.argv[1])

				#p = subprocess.Popen("dumpbin " + sys.argv[1],

				#                     shell=True,

				#                     stdout=subprocess.PIPE)

				# input = p.stdout

				

				os.system("dumpbin /symbols /out:%s.tmp %s" % (sys.argv[1], sys.argv[1]))

				input = open("%s.tmp" % sys.argv[1])

				

				tests = []

				pattern = re.compile(r'\| _(\S*funambolAutoRegisterRegistry\S*)')

				for line in input:

					# output.write("/* " + line + "*/\n")	

					m = pattern.search(line)

					if m:

						print "test: %s" % m.group(1)

						tests.append(m.group(1))

				

				output.write("/* automatically generated, do not edit */\n");

				if len(tests) > 0:

					output.write("extern int " + ", ".join(tests) + ";\n")

					output.write("int *alltests[] = { &" + \

					             ", &".join(tests) + \

					             " };\n")

				

				print "done"

							

相关资源