diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-03-23 14:03:30 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-03-23 14:03:30 +0000 |
commit | 21922560c1fb20d2b851acce5d5d67e7d3b8899c (patch) | |
tree | fe7a4dd5eedbee5abb0eeef99c7189f5d5ee2dad /tests/automated | |
parent | 8e703ff217b32a9cc4d29393769ac85688900fbf (diff) |
Ticket #1041:
- initial work for GNU targets
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3120 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'tests/automated')
-rwxr-xr-x | tests/automated/configure.py | 87 | ||||
-rw-r--r-- | tests/automated/gnu.xml.template | 28 |
2 files changed, 115 insertions, 0 deletions
diff --git a/tests/automated/configure.py b/tests/automated/configure.py new file mode 100755 index 00000000..8be437ff --- /dev/null +++ b/tests/automated/configure.py @@ -0,0 +1,87 @@ +#!/usr/bin/python + +import optparse +import os +import platform +import socket +import subprocess +import sys + +PROG = "r" + "$Rev: 17 $".strip("$ ").replace("Rev: ", "") + +# +# Get gcc version +# +def gcc_version(gcc): + proc = subprocess.Popen(gcc + " -v", stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, shell=True) + ver = "" + while True: + s = proc.stdout.readline() + if not s: + break + if s.find("gcc version") >= 0: + ver = s.split(None, 3)[2] + break + proc.wait() + return "gcc-" + ver + +def replace_vars(text): + while True: + if text.find("$(PJSUA-TESTS)") >= 0: + proc = subprocess.Popen("python runall.py --list-xml", cwd="../pjsua", + shell=True, stdout=subprocess.PIPE) + content = proc.stdout.read() + text = text.replace("$(PJSUA-TESTS)", content) + elif text.find("$(GCC)") >= 0: + text = text.replace("$(GCC)", gcc_version("gcc")) + elif text.find("$(DISABLED)") >= 0: + text = text.replace("$(DISABLED)", "0") + elif text.find("$(OS)") >= 0: + os_info = platform.system() + platform.release() + "-" + platform.machine() + if platform.system().lower() == "linux": + os_info = os_info + "-" + "-".join(platform.linux_distribution()[0:2]) + text = text.replace("$OS", os_info) + elif text.find("$(SUFFIX)") >= 0: + proc = subprocess.Popen("sh config.guess", cwd="../..", + shell=True, stdout=subprocess.PIPE) + plat = proc.stdout.readline().rstrip(" \r\n") + text = text.replace("$(SUFFIX)", plat) + elif text.find("$(HOSTNAME)") >= 0: + text = text.replace("$(HOSTNAME)", socket.gethostname()) + elif text.find("$(PJDIR)") >= 0: + wdir = os.path.join(os.getcwd(), "../..") + wdir = os.path.normpath(wdir) + text = text.replace("$(PJDIR)", wdir) + else: + break + return text + + +def main(args): + usage = """Usage: configure.py scenario_template_file +""" + + args.pop(0) + if not len(args): + print usage + return 1 + + tpl_file = args[len(args)-1] + if not os.path.isfile(tpl_file): + print "Error: unable to find template file '%s'" % (tpl_file) + return 1 + + f = open(tpl_file, "r") + tpl = f.read() + f.close() + + tpl = replace_vars(tpl) + print tpl + return 0 + + +if __name__ == "__main__": + rc = main(sys.argv) + sys.exit(rc) + diff --git a/tests/automated/gnu.xml.template b/tests/automated/gnu.xml.template new file mode 100644 index 00000000..6e304b3a --- /dev/null +++ b/tests/automated/gnu.xml.template @@ -0,0 +1,28 @@ +<?xml version="1.0" ?> +<Scenario site="$(HOSTNAME)" url="http://my.cdash.org/submit.php?project=PJSIP" wdir="$(PJDIR)"> + + <Submit group="Experimental" build="$(SUFFIX)-$(GCC)-default" disabled="$(DISABLED)" > + <Update /> + <Write file="user.mak"> + <![CDATA[ +# Written by ccdash +]]> + </Write> + <Write file="pjlib/include/pj/config_site.h"> + <![CDATA[ +/* Written by ccdash */ +#define PJ_HAS_IPV6 1 +#define PJMEDIA_HAS_G7221_CODEC 1 +]]> + </Write> + <Configure cmd="./aconfigure" /> + <Build cmd="make dep && make distclean && make" /> + <Test name="pjlib-test" info="" wdir="pjlib/bin" cmd="./pjlib-test-$(SUFFIX)" /> + <Test name="pjlib-util-test" info="" wdir="pjlib-util/bin" cmd="./pjlib-util-test-$(SUFFIX)" /> + <Test name="pjnath-test" info="" wdir="pjnath/bin" cmd="./pjnath-test-$(SUFFIX)" /> + <Test name="pjmedia-test" info="" wdir="pjmedia/bin" cmd="./pjmedia-test-$(SUFFIX)" /> + <Test name="pjsip-test" info="" wdir="pjsip/bin" cmd="./pjsip-test-$(SUFFIX)" /> + $(PJSUA-TESTS) + </Submit> + +</Scenario> |