summaryrefslogtreecommitdiff
path: root/tests/automated/configure.py
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-03-27 07:49:18 +0000
committerBenny Prijono <bennylp@teluu.com>2010-03-27 07:49:18 +0000
commitfacb259a9ea6415daa5a8eb4130d459f194d06eb (patch)
tree1cd20c28649f655ed9ed8581a93428ecb8553265 /tests/automated/configure.py
parent7382a4970d5590b13c829d984ba24a705e265267 (diff)
More #1041 (Unit test):
- Initial work for Symbian targets git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3125 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'tests/automated/configure.py')
-rwxr-xr-xtests/automated/configure.py121
1 files changed, 96 insertions, 25 deletions
diff --git a/tests/automated/configure.py b/tests/automated/configure.py
index d0e2c7ee..167f586b 100755
--- a/tests/automated/configure.py
+++ b/tests/automated/configure.py
@@ -11,6 +11,7 @@ PROG = "r" + "$Rev: 17 $".strip("$ ").replace("Rev: ", "")
PYTHON = os.path.basename(sys.executable)
build_type = ""
vs_target = ""
+s60_target = ""
#
# Get gcc version
@@ -30,7 +31,7 @@ def gcc_version(gcc):
return "gcc-" + ver
#
-# Get Visual Studio version
+# Get Visual Studio info
#
class VSVersion:
def __init__(self):
@@ -74,32 +75,81 @@ class VSVersion:
self.vs_release = "vs" + self.release
+#
+# Get S60 SDK info
+#
+class S60SDK:
+ def __init__(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)
+
+ self.name = sdk2.replace("_", "-")
+
+
+
def replace_vars(text):
- global vs_target, build_type
+ global vs_target, s60_target, build_type
suffix = ""
+
os_info = platform.system() + platform.release() + "-" + platform.machine()
# osinfo
- if platform.system().lower() == "windows" or platform.system().lower() == "microsoft":
+ if build_type == "s60":
+ os_info = S60SDK().name
+ elif platform.system().lower() == "windows" or platform.system().lower() == "microsoft":
if platform.system().lower() == "microsoft":
os_info = platform.release() + "-" + platform.version() + "-" + platform.win32_ver()[2]
elif platform.system().lower() == "linux":
os_info = + "-" + "-".join(platform.linux_distribution()[0:2])
- # Build vs_target
+ # vs_target
if not vs_target and text.find("$(VSTARGET)") >= 0:
if build_type != "vs":
- sys.stderr.write("Error: $(VSTARGET) only valid for Visual Studio\n")
- sys.exit(1)
- else:
- print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ",
- vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "")
- if not vs_target:
- vs_target = "Release"
+ sys.stderr.write("Warning: $(VSTARGET) only valid for Visual Studio\n")
+ print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ",
+ vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "")
+ if not vs_target:
+ vs_target = "Release"
+ # s60_target
+ if not s60_target and text.find("$(S60TARGET)") >= 0:
+ if build_type != "s60":
+ sys.stderr.write("Warning: $(S60TARGET) only valid for S60\n")
+ print "Enter S60 target name (e.g. \"gcce urel\") [gcce urel]: ",
+ s60_target = sys.stdin.readline().replace("\n", "").replace("\r", "")
+ if not s60_target:
+ s60_target = "gcce urel"
+
# Suffix
if build_type == "vs":
suffix = "i386-Win32-vc8-" + vs_target
+ elif build_type == "s60":
+ suffix = S60SDK().name + "-" + s60_target.replace(" ", "-")
elif build_type == "gnu":
proc = subprocess.Popen("sh config.guess", cwd="../..",
shell=True, stdout=subprocess.PIPE)
@@ -121,9 +171,13 @@ def replace_vars(text):
text = text.replace("$(GCC)", gcc_version("gcc"))
elif text.find("$(VS)") >= 0:
vsver = VSVersion()
- text = text.replace("$(VS)", vsver.vs_release)
+ text = text.replace("$(VS)", VSVersion().vs_release)
elif text.find("$(VSTARGET)") >= 0:
text = text.replace("$(VSTARGET)", vs_target)
+ elif text.find("$(S60TARGET)") >= 0:
+ text = text.replace("$(S60TARGET)", s60_target)
+ elif text.find("$(S60TARGETNAME)") >= 0:
+ text = text.replace("$(S60TARGETNAME)", s60_target.replace(" ", "-"))
elif text.find("$(DISABLED)") >= 0:
text = text.replace("$(DISABLED)", "0")
elif text.find("$(OS)") >= 0:
@@ -142,29 +196,46 @@ def replace_vars(text):
def main(args):
- global vs_target, build_type
+ global vs_target, s60_target, build_type
usage = """Usage: configure.py [OPTIONS] scenario_template_file
Where OPTIONS:
- -t TYPE Specify build type for Windows since we support both
- Visual Studio and Mingw. If not specified, it will be
- asked if necessary. Values are:
- vs: Visual Studio
- gnu: Makefile based
- -T TARGETNAME Specify Visual Studio target name if build type is set
- to "vs", e.g. Release or Debug. If not specified then
- it will be asked.
+ -t TYPE Specify build type for Windows since we support both
+ Visual Studio and Mingw. If not specified, it will be
+ asked if necessary. Values are:
+ vs: Visual Studio
+ gnu: Makefile based
+ s60: Symbian S60
+ -vstarget TARGETNAME Specify Visual Studio target name if build type is set
+ to vs. If not specified then it will be asked.
+ Sample target names:
+ - Debug
+ - Release
+ - or any other target in the project file
+ -s60target TARGETNAME Specify S60 target name if build type is set to s60.
+ If not specified then it will be asked. Sample target
+ names:
+ - "gcce udeb"
+ - "gcce urel"
"""
args.pop(0)
while len(args):
- if args[0]=='-T':
+ if args[0]=='-vstarget':
args.pop(0)
if len(args):
vs_target = args[0]
args.pop(0)
else:
- sys.stderr.write("Error: needs value for -T\n")
+ sys.stderr.write("Error: needs value for -vstarget\n")
+ sys.exit(1)
+ elif args[0]=='-s60target':
+ args.pop(0)
+ if len(args):
+ s60_target = args[0]
+ args.pop(0)
+ else:
+ sys.stderr.write("Error: needs value for -s60target\n")
sys.exit(1)
elif args[0]=='-t':
args.pop(0)
@@ -174,7 +245,7 @@ Where OPTIONS:
else:
sys.stderr.write("Error: needs value for -t\n")
sys.exit(1)
- if not ["vs", "gnu"].count(build_type):
+ if not ["vs", "gnu", "s60"].count(build_type):
sys.stderr.write("Error: invalid -t argument value\n")
sys.exit(1)
else:
@@ -185,7 +256,7 @@ Where OPTIONS:
return 1
if not build_type and (platform.system().lower() == "windows" or platform.system().lower() == "microsoft"):
- print "Enter the build type (values: vs, gnu) [vs]: ",
+ print "Enter the build type (values: vs, gnu, s60) [vs]: ",
build_type = sys.stdin.readline().replace("\n", "").replace("\r", "")
if not build_type:
build_type = "vs"