Changeset 3125


Ignore:
Timestamp:
Mar 27, 2010 7:49:18 AM (14 years ago)
Author:
bennylp
Message:

More #1041 (Unit test):

  • Initial work for Symbian targets
Location:
pjproject/trunk/tests/automated
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/tests/automated/configure.py

    r3122 r3125  
    1212build_type = "" 
    1313vs_target = "" 
     14s60_target = "" 
    1415 
    1516# 
     
    3132 
    3233# 
    33 # Get Visual Studio version 
     34# Get Visual Studio info 
    3435# 
    3536class VSVersion: 
     
    7576     
    7677 
     78# 
     79# Get S60 SDK info 
     80# 
     81class S60SDK: 
     82        def __init__(self): 
     83                # Check that EPOCROOT is set 
     84                if not "EPOCROOT" in os.environ: 
     85                    print "Error: EPOCROOT environment variable is not set" 
     86                    sys.exit(1) 
     87                epocroot = os.environ["EPOCROOT"] 
     88                # EPOCROOT must have trailing backslash 
     89                if epocroot[-1] != "\\": 
     90                    epocroot = epocroot + "\\" 
     91                    os.environ["EPOCROOT"] = epocroot 
     92                sdk1 = epocroot.split("\\")[-2] 
     93 
     94                # Check that correct device is set 
     95                proc = subprocess.Popen("devices", stdout=subprocess.PIPE, 
     96                                        stderr=subprocess.STDOUT, shell=True) 
     97                sdk2 = "" 
     98                while True: 
     99                    line = proc.stdout.readline() 
     100                    if line.find("- default") > 0: 
     101                        sdk2 = line.split(":",1)[0] 
     102                        break 
     103                proc.wait() 
     104 
     105                if sdk1 != sdk2: 
     106                    print "Error: default SDK in device doesn't match EPOCROOT" 
     107                    print "Default device SDK =", sdk2 
     108                    print "EPOCROOT SDK =", sdk1 
     109                    sys.exit(1) 
     110 
     111                self.name = sdk2.replace("_", "-") 
     112 
     113 
     114 
    77115def replace_vars(text): 
    78         global vs_target, build_type 
     116        global vs_target, s60_target, build_type 
    79117        suffix = "" 
     118 
    80119        os_info = platform.system() + platform.release() + "-" + platform.machine() 
    81120 
    82121        # osinfo 
    83         if platform.system().lower() == "windows" or platform.system().lower() == "microsoft": 
     122        if build_type == "s60": 
     123                os_info = S60SDK().name 
     124        elif platform.system().lower() == "windows" or platform.system().lower() == "microsoft": 
    84125                if platform.system().lower() == "microsoft": 
    85126                        os_info = platform.release() + "-" + platform.version() + "-" + platform.win32_ver()[2] 
     
    87128                os_info =  + "-" + "-".join(platform.linux_distribution()[0:2]) 
    88129 
    89         # Build vs_target 
     130        # vs_target 
    90131        if not vs_target and text.find("$(VSTARGET)") >= 0: 
    91132                if build_type != "vs": 
    92                         sys.stderr.write("Error: $(VSTARGET) only valid for Visual Studio\n") 
    93                         sys.exit(1) 
    94                 else: 
    95                         print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ", 
    96                         vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 
    97                         if not vs_target: 
    98                                 vs_target = "Release" 
    99  
     133                        sys.stderr.write("Warning: $(VSTARGET) only valid for Visual Studio\n") 
     134                print "Enter Visual Studio vs_target name (e.g. Release, Debug) [Release]: ", 
     135                vs_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 
     136                if not vs_target: 
     137                        vs_target = "Release" 
     138 
     139        # s60_target 
     140        if not s60_target and text.find("$(S60TARGET)") >= 0: 
     141                if build_type != "s60": 
     142                        sys.stderr.write("Warning: $(S60TARGET) only valid for S60\n") 
     143                print "Enter S60 target name (e.g. \"gcce urel\") [gcce urel]: ", 
     144                s60_target = sys.stdin.readline().replace("\n", "").replace("\r", "") 
     145                if not s60_target: 
     146                        s60_target = "gcce urel" 
     147     
    100148        # Suffix 
    101149        if build_type == "vs": 
    102150                suffix = "i386-Win32-vc8-" + vs_target 
     151        elif build_type == "s60": 
     152                suffix = S60SDK().name + "-" + s60_target.replace(" ", "-") 
    103153        elif build_type == "gnu": 
    104154                proc = subprocess.Popen("sh config.guess", cwd="../..", 
     
    122172                elif text.find("$(VS)") >= 0: 
    123173                        vsver = VSVersion() 
    124                         text = text.replace("$(VS)", vsver.vs_release) 
     174                        text = text.replace("$(VS)", VSVersion().vs_release) 
    125175                elif text.find("$(VSTARGET)") >= 0: 
    126176                        text = text.replace("$(VSTARGET)", vs_target) 
     177                elif text.find("$(S60TARGET)") >= 0: 
     178                        text = text.replace("$(S60TARGET)", s60_target) 
     179                elif text.find("$(S60TARGETNAME)") >= 0: 
     180                        text = text.replace("$(S60TARGETNAME)", s60_target.replace(" ", "-")) 
    127181                elif text.find("$(DISABLED)") >= 0: 
    128182                        text = text.replace("$(DISABLED)", "0") 
     
    143197 
    144198def main(args): 
    145         global vs_target, build_type 
     199        global vs_target, s60_target, build_type 
    146200        usage = """Usage: configure.py [OPTIONS] scenario_template_file 
    147201 
    148202Where OPTIONS: 
    149   -t TYPE           Specify build type for Windows since we support both 
    150                     Visual Studio and Mingw. If not specified, it will be 
    151                     asked if necessary. Values are:  
    152                        vs:    Visual Studio 
    153                        gnu:   Makefile based 
    154   -T TARGETNAME     Specify Visual Studio target name if build type is set 
    155                     to "vs", e.g. Release or Debug. If not specified then  
    156                     it will be asked. 
     203  -t TYPE               Specify build type for Windows since we support both 
     204                        Visual Studio and Mingw. If not specified, it will be 
     205                        asked if necessary. Values are:  
     206                            vs:    Visual Studio 
     207                            gnu:   Makefile based 
     208                            s60:   Symbian S60 
     209  -vstarget TARGETNAME  Specify Visual Studio target name if build type is set 
     210                        to vs. If not specified then it will be asked. 
     211                        Sample target names: 
     212                            - Debug 
     213                            - Release 
     214                            - or any other target in the project file 
     215  -s60target TARGETNAME Specify S60 target name if build type is set to s60. 
     216                        If not specified then it will be asked. Sample target 
     217                        names: 
     218                            - "gcce udeb" 
     219                            - "gcce urel" 
    157220""" 
    158221 
    159222        args.pop(0) 
    160223        while len(args): 
    161                 if args[0]=='-T': 
     224                if args[0]=='-vstarget': 
    162225                        args.pop(0) 
    163226                        if len(args): 
     
    165228                                args.pop(0) 
    166229                        else: 
    167                                 sys.stderr.write("Error: needs value for -T\n") 
     230                                sys.stderr.write("Error: needs value for -vstarget\n") 
     231                                sys.exit(1) 
     232                elif args[0]=='-s60target': 
     233                        args.pop(0) 
     234                        if len(args): 
     235                                s60_target = args[0] 
     236                                args.pop(0) 
     237                        else: 
     238                                sys.stderr.write("Error: needs value for -s60target\n") 
    168239                                sys.exit(1) 
    169240                elif args[0]=='-t': 
     
    175246                                sys.stderr.write("Error: needs value for -t\n") 
    176247                                sys.exit(1) 
    177                         if not ["vs", "gnu"].count(build_type): 
     248                        if not ["vs", "gnu", "s60"].count(build_type): 
    178249                                sys.stderr.write("Error: invalid -t argument value\n") 
    179250                                sys.exit(1) 
     
    186257         
    187258        if not build_type and (platform.system().lower() == "windows" or platform.system().lower() == "microsoft"): 
    188             print "Enter the build type (values: vs, gnu) [vs]: ", 
     259            print "Enter the build type (values: vs, gnu, s60) [vs]: ", 
    189260            build_type = sys.stdin.readline().replace("\n", "").replace("\r", "") 
    190261            if not build_type: 
  • pjproject/trunk/tests/automated/msvc.xml.template

    r3122 r3125  
    1111]]>                      
    1212                </Write> 
     13                <Configure cmd="cmd /c echo success" /> 
    1314                <Build cmd='vcbuild.exe /nologo /nohtmllog /nocolor /rebuild pjproject-vs8.sln "$(VSTARGET)|Win32"' /> 
    1415                <Test name="pjlib-test" info="" wdir="pjlib/bin" cmd="pjlib-test-i386-Win32-vs8-$(VSTARGET)" /> 
Note: See TracChangeset for help on using the changeset viewer.