Added Symbian test configurator

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2405 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2009-01-01 00:11:17 +00:00
parent 0b262934c6
commit fee946baa1
5 changed files with 229 additions and 29 deletions

View File

@ -3,4 +3,5 @@
@rem set EPOCROOT=\Symbian\9.1\S60_3rd_MR_2\
@rem set EPOCROOT=\Symbian\UIQ3SDK\
@rem set EPOCROOT=\symbian\UIQ3.1\
@rem set EPOCROOT=\symbian\9.2\S60_3rd_FP1\
bldmake bldfiles

View File

@ -335,15 +335,17 @@ class GNUTestBuilder(TestBuilder):
#
class MSVCTestBuilder(TestBuilder):
"""\
This class creates list of tests suitable for Visual Studio builds.
This class creates list of tests suitable for Visual Studio builds.
You need to set the MSVC environment variables (typically by calling
vcvars32.bat) prior to running this class.
"""
def __init__(self, config, vs_config="Release|Win32", build_config_name="",
def __init__(self, config, target="Release|Win32", build_config_name="",
config_site="", exclude=[], not_exclude=[]):
"""\
Parameters:
config - BaseConfig instance
vs_config - Visual Studio build configuration to build.
target - Visual Studio build configuration to build.
Sample: "Debug|Win32", "Release|Win32".
build_config_name - Optional name to be added as suffix to the build
name. Sample: "Debug", "Release", "IPv6", etc.
@ -358,11 +360,11 @@ class MSVCTestBuilder(TestBuilder):
TestBuilder.__init__(self, config, build_config_name=build_config_name,
config_site=config_site, exclude=exclude,
not_exclude=not_exclude)
self.vs_config = vs_config.lower()
self.target = target.lower()
def build_tests(self):
(vsbuild,sys) = self.vs_config.split("|",2)
(vsbuild,sys) = self.target.split("|",2)
build_name = sys + "-" + vs_get_version() + "-" + vsbuild
@ -370,7 +372,7 @@ class MSVCTestBuilder(TestBuilder):
build_name = build_name + "-" + self.build_config_name
vccmd = "vcbuild.exe /nologo /nohtmllog /nocolor /rebuild " + \
"pjproject-vs8.sln " + " \"" + self.vs_config + "\""
"pjproject-vs8.sln " + " \"" + self.target + "\""
suffix = "-i386-win32-vc8-" + vsbuild
pjsua = "pjsua_vc8"
@ -396,3 +398,89 @@ class MSVCTestBuilder(TestBuilder):
self.ccdash_args.append(args)
#
# Symbian test configurator
#
class SymbianTestBuilder(TestBuilder):
"""\
This class creates list of tests suitable for Symbian builds. You need to
set the command line build settings prior to running this class (typically
that involves setting the EPOCROOT variable and current device).
"""
def __init__(self, config, target="gcce urel", build_config_name="",
config_site="", exclude=[], not_exclude=[]):
"""\
Parameters:
config - BaseConfig instance
target - Symbian target to build. Default is "gcce urel".
build_config_name - Optional name to be added as suffix to the build
name. Sample: "APS", "VAS", etc.
config_site - Contents to be put on config_site.h
exclude - List of regular expression patterns for tests
that will be excluded from the run
not_exclude - List of regular expression patterns for tests
that will be run regardless of whether they
match the excluded pattern.
"""
TestBuilder.__init__(self, config, build_config_name=build_config_name,
config_site=config_site, exclude=exclude,
not_exclude=not_exclude)
self.target = target.lower()
def build_tests(self):
# Check that EPOCROOT is set
if not "EPOCROOT" in os.environ:
print "Error: EPOCROOT environment variable is not set"
sys.exit(1)
epocroot = os.environ["EPOCROOT"]
# EPOCROOT must have trailing backslash
if epocroot[-1] != "\\":
epocroot = epocroot + "\\"
os.environ["EPOCROOT"] = epocroot
sdk1 = epocroot.split("\\")[-2]
# Check that correct device is set
proc = subprocess.Popen("devices", stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=True)
sdk2 = ""
while True:
line = proc.stdout.readline()
if line.find("- default") > 0:
sdk2 = line.split(":",1)[0]
break
proc.wait()
if sdk1 != sdk2:
print "Error: default SDK in device doesn't match EPOCROOT"
print "Default device SDK =", sdk2
print "EPOCROOT SDK =", sdk1
sys.exit(1)
build_name = sdk2.replace("_", "-") + "-" + \
self.target.replace(" ", "-")
if self.build_config_name:
build_name = build_name + "-" + self.build_config_name
cmdline = "cmd /C \"cd build.symbian && bldmake bldfiles && abld build %s\"" % (self.target)
cmds = []
cmds.extend(update_ops)
cmds.extend([Operation(Operation.BUILD, cmdline)])
self.ccdash_args = []
suffix = ""
for c in cmds:
c.cmdline = c.cmdline.replace("$SUFFIX", suffix)
args = c.encode(self.config.base_dir)
args.extend(["-U", self.config.url,
"-S", self.config.site,
"-T", self.stamp(),
"-B", build_name,
"-G", self.config.group])
args.extend(self.config.options)
self.ccdash_args.append(args)

View File

@ -23,19 +23,36 @@ import sys
# Each configurator must export this function
def create_builder(args):
usage = """\
Usage:
main.py cfg_gnu [-h|--help] [cfg_site]
Arguments:
cfg_site: site configuration module. If not specified, "cfg_site"
is implied
-h, --help Show this help screen
"""
# (optional) args format:
# site configuration module. If not specified, "cfg_site" is implied
if len(args)>0:
file = args[0]
else:
file = "cfg_site"
if os.access(file+".py", os.F_OK) == False:
print "Error: file '%s.py' doesn't exist." % (file)
cfg_site = "cfg_site"
for arg in args:
if arg=="-h" or arg=="--help":
print usage
sys.exit(0)
elif arg[0]=="-":
print usage
sys.exit(1)
else:
cfg_site = arg
if os.access(cfg_site+".py", os.F_OK) == False:
print "Error: file '%s.py' doesn't exist." % (cfg_site)
sys.exit(1)
cfg_site = __import__(file)
cfg_site = __import__(cfg_site)
test_cfg = builder.BaseConfig(cfg_site.BASE_DIR, \
cfg_site.URL, \
cfg_site.SITE_NAME, \

View File

@ -23,25 +23,35 @@ import sys
# Each configurator must export this function
def create_builder(args):
# (optional) args format:
# [cfg_site] [--vs-config VSCFG]
#
# cfg_site: site configuration module. If not specified, "cfg_site"
# is implied
# VSCFG: Visual Studio build configuration to build. Sample values:
# "Debug|Win32", "Release|Win32". If not specified then
# "Release|Win32" is assumed
usage = """\
Usage:
main.py cfg_msvc [-h|--help] [-t|--target TARGET] [cfg_site]
Arguments:
cfg_site: site configuration module. If not specified, "cfg_site"
is implied
-t,--target TARGET: Visual Studio build configuration to build. Default is
"Release|Win32". Sample values: "Debug|Win32"
-h, --help Show this help screen
"""
cfg_site = "cfg_site"
vs_cfg = "Release|Win32"
target = "Release|Win32"
in_option = ""
for arg in args:
if in_option=="--vs-config":
vs_cfg = arg
if in_option=="-t":
target = arg
in_option = ""
elif arg=="--vs-config":
in_option = arg
elif arg=="--target" or arg=="-t":
in_option = "-t"
elif arg=="-h" or arg=="--help":
print usage
sys.exit(0)
elif arg[0]=="-":
print usage
sys.exit(1)
else:
cfg_site = arg
@ -58,7 +68,7 @@ def create_builder(args):
builders = [
builder.MSVCTestBuilder(test_cfg,
vs_config=vs_cfg,
target=target,
build_config_name="default",
config_site="#define PJ_TODO(x)\n",
exclude=cfg_site.EXCLUDE,

View File

@ -0,0 +1,84 @@
#
# cfg_symbian.py - Symbian target configurator
#
# Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
import builder
import os
import sys
# Each configurator must export this function
def create_builder(args):
usage = """\
Usage:
main.py cfg_symbian [-h|--help] [-t|--target TARGET] [cfg_site]
Arguments:
cfg_site: site configuration module. If not specified, "cfg_site"
is implied
-t,--target TARGET: Symbian target to build. Default is "gcce urel".
Other values:
"winscw udeb", "gcce udeb", etc.
-h, --help Show this help screen
"""
cfg_site = "cfg_site"
target = "gcce urel"
in_option = ""
for arg in args:
if in_option=="-t":
target = arg
in_option = ""
elif arg=="--target" or arg=="-t":
in_option = "-t"
elif arg=="--help" or arg=="-h":
print usage
sys.exit(0)
elif arg[0]=="-":
print usage
sys.exit(1)
else:
cfg_site = arg
if os.access(cfg_site+".py", os.F_OK) == False:
print "Error: file '%s.py' doesn't exist." % (cfg_site)
sys.exit(1)
cfg_site = __import__(cfg_site)
test_cfg = builder.BaseConfig(cfg_site.BASE_DIR, \
cfg_site.URL, \
cfg_site.SITE_NAME, \
cfg_site.GROUP, \
cfg_site.OPTIONS)
config_site1 = """\
#define PJ_TODO(x)
#include <pj/config_site_sample.h>
"""
builders = [
builder.SymbianTestBuilder(test_cfg,
target=target,
build_config_name="default",
config_site=config_site1,
exclude=cfg_site.EXCLUDE,
not_exclude=cfg_site.NOT_EXCLUDE)
]
return builders