Ignore:
Timestamp:
Dec 30, 2008 4:19:38 PM (15 years ago)
Author:
bennylp
Message:

CDash test for MSVC

Location:
pjproject/trunk/tests/cdash
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/tests/cdash

    • Property svn:ignore
      •  

        old new  
        22cfg_site.py 
        33out.xml 
         4build.log 
  • pjproject/trunk/tests/cdash/builder.py

    r2401 r2404  
    7070# 
    7171std_test_ops= [ 
    72     Operation(Operation.TEST, "./pjlib-test-$SUFFIX", name="pjlib test", 
     72    Operation(Operation.TEST, "./pjlib-test$SUFFIX", name="pjlib test", 
    7373              wdir="pjlib/bin"), 
    74     Operation(Operation.TEST, "./pjlib-util-test-$SUFFIX",  
     74    Operation(Operation.TEST, "./pjlib-util-test$SUFFIX",  
    7575              name="pjlib-util test", wdir="pjlib-util/bin"), 
    76     Operation(Operation.TEST, "./pjnath-test-$SUFFIX", name="pjnath test", 
     76    Operation(Operation.TEST, "./pjnath-test$SUFFIX", name="pjnath test", 
    7777              wdir="pjnath/bin"), 
    78     Operation(Operation.TEST, "./pjmedia-test-$SUFFIX", name="pjmedia test", 
     78    Operation(Operation.TEST, "./pjmedia-test$SUFFIX", name="pjmedia test", 
    7979              wdir="pjmedia/bin"), 
    80     Operation(Operation.TEST, "./pjsip-test-$SUFFIX", name="pjsip test", 
     80    Operation(Operation.TEST, "./pjsip-test$SUFFIX", name="pjsip test", 
    8181              wdir="pjsip/bin") 
    8282] 
     
    8686# 
    8787gnu_build_ops = [ 
    88     Operation(Operation.CONFIGURE, "./configure"), 
    89     Operation(Operation.BUILD, "make distclean; make dep && make; cd pjsip-apps/src/python; python setup.py clean build"), 
     88    Operation(Operation.CONFIGURE, "sh ./configure"), 
     89    Operation(Operation.BUILD, "sh -c 'make distclean && make dep && make && cd pjsip-apps/src/python && python setup.py clean build'"), 
    9090    #Operation(Operation.BUILD, "python setup.py clean build", 
    9191    #          wdir="pjsip-apps/src/python") 
     
    9595# These are pjsua Python based unit test operations 
    9696# 
    97 def build_pjsua_test_ops(): 
     97def build_pjsua_test_ops(pjsua_exe=""): 
    9898    ops = [] 
     99    if pjsua_exe: 
     100        exe = " -e ../../pjsip-apps/bin/" + pjsua_exe 
     101    else: 
     102        exe = "" 
    99103    cwd = os.getcwd() 
    100104    os.chdir("../pjsua") 
     
    106110        name = mod[4:mod.find(".py")] + "_" + \ 
    107111               param[param.find("/")+1:param.find(".py")] 
    108         ops.append(Operation(Operation.TEST, "python run.py " + e, name=name, 
    109                    wdir="tests/pjsua")) 
     112        ops.append(Operation(Operation.TEST, "python run.py" + exe + " " + \ 
     113                             e, name=name, wdir="tests/pjsua")) 
     114    f.close() 
     115    os.remove("list")  
    110116    os.chdir(cwd) 
    111117    return ops 
     
    127133    proc.wait() 
    128134    return "gcc-" + ver 
     135 
     136# 
     137# Get Visual Studio version 
     138# 
     139def vs_get_version(): 
     140    proc = subprocess.Popen("cl", stdout=subprocess.PIPE, 
     141                            stderr=subprocess.STDOUT) 
     142    while True: 
     143        s = proc.stdout.readline() 
     144        if s=="": 
     145            break 
     146        pos = s.find("Version") 
     147        if pos > 0: 
     148            proc.wait() 
     149            s = s[pos+8:] 
     150            ver = s.split(None, 1)[0] 
     151            major = ver[0:2] 
     152            if major=="12": 
     153                return "vs6" 
     154            elif major=="13": 
     155                return "vs2003" 
     156            elif major=="14": 
     157                return "vs2005" 
     158            elif major=="15": 
     159                return "vs2008" 
     160            else: 
     161                return "vs-" + major 
     162    proc.wait() 
     163    return "vs-unknown" 
     164     
    129165 
    130166# 
     
    184220        # Restore user.mak 
    185221        name = self.config.base_dir + "/user.mak" 
    186         if self.saved_user_mak: 
    187             f = open(name, "wt") 
    188             f.write(self.saved_user_mak) 
    189             f.close() 
    190         else: 
    191             os.remove(name) 
     222        f = open(name, "wt") 
     223        f.write(self.saved_user_mak) 
     224        f.close() 
    192225        # Restore config_site.h 
    193226        name = self.config.base_dir + "/pjlib/include/pj/config_site.h" 
    194         if self.saved_config_site: 
    195             f = open(name, "wt") 
    196             f.write(self.saved_config_site) 
    197             f.close() 
    198         else: 
    199             os.remove(name) 
     227        f = open(name, "wt") 
     228        f.write(self.saved_config_site) 
     229        f.close() 
    200230 
    201231    def build_tests(self): 
     
    223253                        break 
    224254            if excluded and not included: 
    225                 print "Skipping test '%s'.." % (fullcmd) 
     255                if len(fullcmd)>60: 
     256                    fullcmd = fullcmd[0:60] + ".." 
     257                print "Skipping '%s'" % (fullcmd) 
    226258                continue 
    227259 
    228             #a.extend(["-o", "/tmp/xx" + a[0] + ".xml"]) 
    229             #print a 
    230             #a = ["ccdash.py"].extend(a) 
    231260            b = ["ccdash.py"] 
    232261            b.extend(a) 
     
    242271# 
    243272class GNUTestBuilder(TestBuilder): 
     273    """\ 
     274    This class creates list of tests suitable for GNU targets. 
     275 
     276    """ 
    244277    def __init__(self, config, build_config_name="", user_mak="", \ 
    245278                 config_site="", cross_compile="", exclude=[], not_exclude=[]): 
     279        """\ 
     280        Parameters: 
     281        config              - BaseConfig instance 
     282        build_config_name   - Optional name to be added as suffix to the build 
     283                              name. Sample: "min-size", "O4", "TLS", etc. 
     284        user_mak            - Contents to be put on user.mak 
     285        config_site         - Contents to be put on config_site.h 
     286        cross_compile       - Optional cross-compile prefix. Must include the 
     287                              trailing dash, e.g. "arm-unknown-linux-" 
     288        exclude             - List of regular expression patterns for tests 
     289                              that will be excluded from the run 
     290        not_exclude         - List of regular expression patterns for tests 
     291                              that will be run regardless of whether they 
     292                              match the excluded pattern. 
     293 
     294        """ 
    246295        TestBuilder.__init__(self, config, build_config_name=build_config_name, 
    247296                             user_mak=user_mak, config_site=config_site, 
     
    253302    def build_tests(self): 
    254303        if self.cross_compile: 
    255             suffix = self.cross_compile 
    256             build_name =  suffix + gcc_version(self.cross_compile + "gcc") 
     304            suffix = "-" + self.cross_compile[0:-1] 
     305            build_name =  self.cross_compile + \ 
     306                          gcc_version(self.cross_compile + "gcc") 
    257307        else: 
    258             proc = subprocess.Popen(self.config.base_dir+"/config.guess", 
    259                                     stdout=subprocess.PIPE) 
    260             suffix = proc.stdout.readline().rstrip(" \r\n") 
    261             build_name =  suffix+"-"+gcc_version(self.cross_compile + "gcc") 
     308            proc = subprocess.Popen("sh "+self.config.base_dir+"/config.guess", 
     309                                    shell=True, stdout=subprocess.PIPE) 
     310            sys = proc.stdout.readline().rstrip(" \r\n") 
     311            build_name =  sys + "-"+gcc_version(self.cross_compile + "gcc") 
     312            suffix = "-" + sys 
    262313 
    263314        if self.build_config_name: 
     
    280331            self.ccdash_args.append(args) 
    281332 
    282  
     333# 
     334# MSVC test configurator 
     335# 
     336class MSVCTestBuilder(TestBuilder): 
     337    """\ 
     338    This class creates list of tests suitable for Visual Studio builds. 
     339 
     340    """ 
     341    def __init__(self, config, vs_config="Release|Win32", build_config_name="",  
     342                 config_site="", exclude=[], not_exclude=[]): 
     343        """\ 
     344        Parameters: 
     345        config              - BaseConfig instance 
     346        vs_config           - Visual Studio build configuration to build. 
     347                              Sample: "Debug|Win32", "Release|Win32". 
     348        build_config_name   - Optional name to be added as suffix to the build 
     349                              name. Sample: "Debug", "Release", "IPv6", etc. 
     350        config_site         - Contents to be put on config_site.h 
     351        exclude             - List of regular expression patterns for tests 
     352                              that will be excluded from the run 
     353        not_exclude         - List of regular expression patterns for tests 
     354                              that will be run regardless of whether they 
     355                              match the excluded pattern. 
     356 
     357        """ 
     358        TestBuilder.__init__(self, config, build_config_name=build_config_name, 
     359                             config_site=config_site, exclude=exclude,  
     360                             not_exclude=not_exclude) 
     361        self.vs_config = vs_config.lower() 
     362 
     363    def build_tests(self): 
     364        
     365        (vsbuild,sys) = self.vs_config.split("|",2) 
     366         
     367        build_name = sys + "-" + vs_get_version() + "-" + vsbuild 
     368 
     369        if self.build_config_name: 
     370            build_name = build_name + "-" + self.build_config_name 
     371 
     372        vccmd = "vcbuild.exe /nologo /nohtmllog /nocolor /rebuild " + \ 
     373                "pjproject-vs8.sln " + " \"" + self.vs_config + "\"" 
     374         
     375        suffix = "-i386-win32-vc8-" + vsbuild 
     376        pjsua = "pjsua_vc8" 
     377        if vsbuild=="debug": 
     378            pjsua = pjsua + "d" 
     379         
     380        cmds = [] 
     381        cmds.extend(update_ops) 
     382        cmds.extend([Operation(Operation.BUILD, vccmd)]) 
     383        cmds.extend(std_test_ops) 
     384        cmds.extend(build_pjsua_test_ops(pjsua)) 
     385 
     386        self.ccdash_args = [] 
     387        for c in cmds: 
     388            c.cmdline = c.cmdline.replace("$SUFFIX", suffix) 
     389            args = c.encode(self.config.base_dir) 
     390            args.extend(["-U", self.config.url,  
     391                         "-S", self.config.site,  
     392                         "-T", self.stamp(),  
     393                         "-B", build_name,  
     394                         "-G", self.config.group]) 
     395            args.extend(self.config.options) 
     396            self.ccdash_args.append(args) 
     397 
     398 
Note: See TracChangeset for help on using the changeset viewer.