From facb259a9ea6415daa5a8eb4130d459f194d06eb Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sat, 27 Mar 2010 07:49:18 +0000 Subject: 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 --- tests/automated/configure.py | 121 +++++++++++++++++++++++++++-------- tests/automated/msvc.xml.template | 1 + tests/automated/run.py | 9 +++ tests/automated/symbian.xml.template | 21 ++++++ tests/automated/testvars.template | 24 +++++++ 5 files changed, 151 insertions(+), 25 deletions(-) create mode 100644 tests/automated/run.py create mode 100644 tests/automated/symbian.xml.template create mode 100644 tests/automated/testvars.template 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" diff --git a/tests/automated/msvc.xml.template b/tests/automated/msvc.xml.template index 986e9c99..53da44b1 100644 --- a/tests/automated/msvc.xml.template +++ b/tests/automated/msvc.xml.template @@ -10,6 +10,7 @@ #define PJMEDIA_HAS_G7221_CODEC 1 ]]> + diff --git a/tests/automated/run.py b/tests/automated/run.py new file mode 100644 index 00000000..a9c319e1 --- /dev/null +++ b/tests/automated/run.py @@ -0,0 +1,9 @@ +import sys +import ccdash + +if __name__ == "__main__": + sys.argv[0] = "ccdash.py" + rc = ccdash.main(sys.argv) + sys.exit(rc) + + diff --git a/tests/automated/symbian.xml.template b/tests/automated/symbian.xml.template new file mode 100644 index 00000000..6cac8cee --- /dev/null +++ b/tests/automated/symbian.xml.template @@ -0,0 +1,21 @@ + + + + + + + +#undef PJ_HAS_IPV6 +#define PJ_HAS_IPV6 1 +#undef PJMEDIA_HAS_G7221_CODEC +#define PJMEDIA_HAS_G7221_CODEC 1 +]]> + + + + + + + diff --git a/tests/automated/testvars.template b/tests/automated/testvars.template new file mode 100644 index 00000000..c9389421 --- /dev/null +++ b/tests/automated/testvars.template @@ -0,0 +1,24 @@ +Variables: +----------------------------- +DISABLED = "$(DISABLED)" +GCC = "$(GCC)" +HOSTNAME = "$(HOSTNAME)" +OS = "$(OS)" +PJDIR = "$(PJDIR)" +SUFFIX = "$(SUFFIX)" + +S60 only: +------------------------------ +S60TARGET = "$(S60TARGET)" +S60TARGETNAME = "$(S60TARGETNAME)" + +VS only: +------------------------------ +VS = "$(VS)" +VSTARGET = "$(VSTARGET)" + +PJSUA-TESTS: +------------------------------ +$(PJSUA-TESTS) +------------------------------ + -- cgit v1.2.3