Changeset 3122
- Timestamp:
- Mar 27, 2010 2:35:06 AM (15 years ago)
- Location:
- pjproject/trunk/tests
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/tests/automated
-
Property
svn:ignore
set to
tmp
*.xml
-
Property
svn:ignore
set to
-
pjproject/trunk/tests/automated/configure.py
r3120 r3122 9 9 10 10 PROG = "r" + "$Rev: 17 $".strip("$ ").replace("Rev: ", "") 11 PYTHON = os.path.basename(sys.executable) 12 build_type = "" 13 vs_target = "" 11 14 12 15 # … … 27 30 return "gcc-" + ver 28 31 32 # 33 # Get Visual Studio version 34 # 35 class VSVersion: 36 def __init__(self): 37 self.version = "8" 38 self.release = "2005" 39 40 proc = subprocess.Popen("cl", stdout=subprocess.PIPE, 41 stderr=subprocess.STDOUT) 42 while True: 43 s = proc.stdout.readline() 44 if s=="": 45 break 46 pos = s.find("Version") 47 if pos > 0: 48 proc.wait() 49 s = s[pos+8:] 50 ver = s.split(None, 1)[0] 51 major = ver[0:2] 52 if major=="12": 53 self.version = "6" 54 self.release = "98" 55 break 56 elif major=="13": 57 self.version = "7" 58 self.release = "2003" 59 break 60 elif major=="14": 61 self.version = "8" 62 self.release = "2005" 63 break 64 elif major=="15": 65 self.version = "9" 66 self.release = "2008" 67 break 68 else: 69 self.version = "10" 70 self.release = "2010" 71 break 72 proc.wait() 73 self.vs_version = "vs" + self.version 74 self.vs_release = "vs" + self.release 75 76 29 77 def replace_vars(text): 78 global vs_target, build_type 79 suffix = "" 80 os_info = platform.system() + platform.release() + "-" + platform.machine() 81 82 # osinfo 83 if platform.system().lower() == "windows" or platform.system().lower() == "microsoft": 84 if platform.system().lower() == "microsoft": 85 os_info = platform.release() + "-" + platform.version() + "-" + platform.win32_ver()[2] 86 elif platform.system().lower() == "linux": 87 os_info = + "-" + "-".join(platform.linux_distribution()[0:2]) 88 89 # Build vs_target 90 if not vs_target and text.find("$(VSTARGET)") >= 0: 91 if build_type != "vs": 92 sys.stderr.write("Error: $(VSTARGET) only valid for Visual Studio\n") 93 sys.exit(1) 94 else: 95 print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ", 96 vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 97 if not vs_target: 98 vs_target = "Release" 99 100 # Suffix 101 if build_type == "vs": 102 suffix = "i386-Win32-vc8-" + vs_target 103 elif build_type == "gnu": 104 proc = subprocess.Popen("sh config.guess", cwd="../..", 105 shell=True, stdout=subprocess.PIPE) 106 suffix = proc.stdout.readline().rstrip(" \r\n") 107 else: 108 sys.stderr.write("Error: unsupported built type " + build_type + "\n") 109 sys.exit(1) 110 30 111 while True: 31 112 if text.find("$(PJSUA-TESTS)") >= 0: 32 proc = subprocess.Popen("python runall.py --list-xml", cwd="../pjsua", 113 # Determine pjsua exe to use 114 exe = "../../pjsip-apps/bin/pjsua-" + suffix 115 proc = subprocess.Popen(PYTHON + " runall.py --list-xml -e " + exe, 116 cwd="../pjsua", 33 117 shell=True, stdout=subprocess.PIPE) 34 118 content = proc.stdout.read() … … 36 120 elif text.find("$(GCC)") >= 0: 37 121 text = text.replace("$(GCC)", gcc_version("gcc")) 122 elif text.find("$(VS)") >= 0: 123 vsver = VSVersion() 124 text = text.replace("$(VS)", vsver.vs_release) 125 elif text.find("$(VSTARGET)") >= 0: 126 text = text.replace("$(VSTARGET)", vs_target) 38 127 elif text.find("$(DISABLED)") >= 0: 39 128 text = text.replace("$(DISABLED)", "0") 40 129 elif text.find("$(OS)") >= 0: 41 os_info = platform.system() + platform.release() + "-" + platform.machine() 42 if platform.system().lower() == "linux": 43 os_info = os_info + "-" + "-".join(platform.linux_distribution()[0:2]) 44 text = text.replace("$OS", os_info) 130 text = text.replace("$(OS)", os_info) 45 131 elif text.find("$(SUFFIX)") >= 0: 46 proc = subprocess.Popen("sh config.guess", cwd="../..", 47 shell=True, stdout=subprocess.PIPE) 48 plat = proc.stdout.readline().rstrip(" \r\n") 49 text = text.replace("$(SUFFIX)", plat) 132 text = text.replace("$(SUFFIX)", suffix) 50 133 elif text.find("$(HOSTNAME)") >= 0: 51 134 text = text.replace("$(HOSTNAME)", socket.gethostname()) … … 60 143 61 144 def main(args): 62 usage = """Usage: configure.py scenario_template_file 145 global vs_target, build_type 146 usage = """Usage: configure.py [OPTIONS] scenario_template_file 147 148 Where OPTIONS: 149 -t TYPE Specify build type for Windows since we support both 150 Visual Studio and Mingw. If not specified, it will be 151 asked if necessary. Values are: 152 vs: Visual Studio 153 gnu: Makefile based 154 -T TARGETNAME Specify Visual Studio target name if build type is set 155 to "vs", e.g. Release or Debug. If not specified then 156 it will be asked. 63 157 """ 64 158 65 159 args.pop(0) 66 if not len(args): 160 while len(args): 161 if args[0]=='-T': 162 args.pop(0) 163 if len(args): 164 vs_target = args[0] 165 args.pop(0) 166 else: 167 sys.stderr.write("Error: needs value for -T\n") 168 sys.exit(1) 169 elif args[0]=='-t': 170 args.pop(0) 171 if len(args): 172 build_type = args[0].lower() 173 args.pop(0) 174 else: 175 sys.stderr.write("Error: needs value for -t\n") 176 sys.exit(1) 177 if not ["vs", "gnu"].count(build_type): 178 sys.stderr.write("Error: invalid -t argument value\n") 179 sys.exit(1) 180 else: 181 break 182 183 if len(args) != 1: 67 184 print usage 68 185 return 1 69 186 187 if not build_type and (platform.system().lower() == "windows" or platform.system().lower() == "microsoft"): 188 print "Enter the build type (values: vs, gnu) [vs]: ", 189 build_type = sys.stdin.readline().replace("\n", "").replace("\r", "") 190 if not build_type: 191 build_type = "vs" 192 193 70 194 tpl_file = args[len(args)-1] 71 195 if not os.path.isfile(tpl_file): -
pjproject/trunk/tests/pjsua/runall.py
r3120 r3122 6 6 import shutil 7 7 8 PYTHON = os.path.basename(sys.executable) 8 9 9 10 # Usage: … … 103 104 tname = mod[4:mod.find(".py")] + "_" + \ 104 105 param[param.find("/")+1:param.find(".py")] 105 tcmd = 'python run.py ' + t 106 c = "" 107 if len(sys.argv): 108 c = " ".join(sys.argv) + " " 109 tcmd = PYTHON + ' run.py ' + c + t 106 110 print '\t\t<Test name="%s" cmd="%s" wdir="tests/pjsua" />' % (tname, tcmd) 107 111 sys.exit(0)
Note: See TracChangeset
for help on using the changeset viewer.