Changeset 3289 for pjproject


Ignore:
Timestamp:
Aug 23, 2010 9:16:03 AM (14 years ago)
Author:
bennylp
Message:

re #1111 (more on automated tests): added delay option in run_continuous.py to prevent more than one scripts from running simultaneously on a single host

File:
1 edited

Legend:

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

    r3278 r3289  
    77 
    88INTERVAL = 300 
     9DELAY = 0 
    910 
    1011def run_scenarios(scenarios, group): 
     
    2425 
    2526 
     27def usage(): 
     28        print """Periodically monitor working directory for Continuous and Nightly builds 
     29 
     30Usage: 
     31  run_continuous.py [options] scenario1.xml [scenario2.xml ...] 
     32 
     33options: 
     34  These are options which will be processed by run_continuous.py: 
     35 
     36  --delay MIN   Delay both Continuous and Nightly builds by MIN minutes.  
     37                This is useful to coordinate the build with other build  
     38                machines. By default, Continuous build will be done right 
     39                after changes are detected, and Nightly build will be done 
     40                at 00:00 GMT. MIN is a float number. 
     41 
     42""" 
     43        sys.exit(1) 
     44 
    2645if __name__ == "__main__": 
    27         if len(sys.argv)<=1 or sys.argv[1]=="-h" or sys.argv[1]=="--h" or sys.argv[1]=="/h": 
    28                 print "This will run both Continuous and Nightly tests" 
    29                 print "" 
    30                 print "Usage: run_continuous.py scenario1.xml [scenario2.xml ...]" 
    31                 print "" 
    32                 sys.exit(1) 
     46        if len(sys.argv)<=1 or sys.argv[1]=="-h" or sys.argv[1]=="--h" or sys.argv[1]=="--help" or sys.argv[1]=="/h": 
     47                usage() 
    3348 
    3449        # Splice list 
    35         scenarios = sys.argv[1:] 
     50        scenarios = [] 
     51        i = 1 
     52        while i < len(sys.argv): 
     53                if sys.argv[i]=="--delay": 
     54                        i = i + 1 
     55                        if i >= len(sys.argv): 
     56                                print "Error: missing argument" 
     57                                sys.exit(1) 
     58                        DELAY = float(sys.argv[i]) * 60 
     59                        print "Delay is set to %f minute(s)" % (DELAY / 60) 
     60                else: 
     61                        # Check if scenario exists 
     62                        scenario = sys.argv[i] 
     63                        if not os.path.exists(scenario): 
     64                                print "Error: file " + scenario + " does not exist" 
     65                                sys.exit(1) 
     66                        scenario.append(scenario) 
     67                        print "Scenario %s added" % (scenario) 
     68                i = i + 1 
    3669 
    37         # Check if scenario exists 
    38         for scenario in scenarios: 
    39                 if not os.path.exists(scenario): 
    40                         print "Error: file " + scenario + " does not exist" 
    41                         sys.exit(1) 
     70        if len(scenarios) < 1: 
     71                print "Error: scenario is required" 
     72                sys.exit(1) 
    4273 
    4374        # Current date 
Note: See TracChangeset for help on using the changeset viewer.