Changeset 6903


Ignore:
Timestamp:
Apr 24, 2009, 5:24:52 PM (15 years ago)
Author:
rwilson
Message:

Ongoing changes with Patong validation.

Location:
anuga_validation/automated_validation_tests/patong_beach_validation
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/automated_validation_tests/patong_beach_validation/validate.py

    r6893 r6903  
    3838Mandatory_Data_Objects = ('data.tgz',)
    3939
    40 # sequence of optional local data objects
     40# sequence of optional local data objects.
     41# these names must be of the form <scene>.sww.<type>.tgz
     42# as code below depends upon it.
    4143Optional_Data_Objects = ('patong.sww.TRIAL.tgz',
    4244                         'patong.sww.BASIC.tgz',
     
    115117                return (True, auth)
    116118
    117         log.info('Could not refresh file %s' % local)
    118119        return (False, auth)           
    119120               
     
    141142        else (False, <updated_auth>).
    142143        '''
    143 
    144         log.info("Refreshing local object '%s'" % obj)
    145144
    146145        # create local and remote file paths.
     
    168167                    shutil.move(remote_digest, local_digest)
    169168                    (res, auth) = get_remote_from_mirrors(obj, local_file, auth, mirrors)
    170                
     169
    171170        return (res, auth)
    172171
     
    185184    result = True
    186185    for data_object in data_objects:
     186        log.info("Refreshing file '%s'" % data_object)
    187187        log.debug('refresh_local_data: getting %s from mirrors, auth=%s'
    188188                  % (data_object, str(auth)))
     
    191191                  % (str(res), str(auth)))
    192192        if res == False:
    193             log.debug('Failed fetching %s, returning False' % data_object)
     193            log.info('Refresh of file %s failed.' % data_object)
    194194            result = False
    195195
    196     log.info('Local data has been refreshed, result=%s.' % str(result))
     196    if result:
     197        log.info('Local data has been refreshed.')
     198    else:
     199        log.info('Local data has been refreshed, with one or more errors.')
    197200    return result
    198201
     
    282285
    283286    # run the simulation, produce SWW file
    284     log.critical('Running Patong simulation ...')
    285287    cmd = 'python run_model.py > %s' % RUNMODEL_STDOUT
    286288    log.debug("run_simulation: doing '%s'" % cmd)
     
    297299    return res == 0
    298300
    299 def check_that_output_is_as_expected():
     301def check_that_output_is_as_expected(expected_sww, valid_sww):
    300302    '''Check that validation output is as required.'''
    301303
    302304    # get path to expected SWW file
    303305    log.critical('Checking that simulation results are as expected ...')
    304     local_sww = os.path.join(Local_Data_Directory, Local_Data_Objects[0])
     306    local_sww = os.path.join(Local_Data_Directory, valid_sww)
    305307
    306308    # get output directory from stdout capture file
     
    329331   
    330332    # compare SWW files here and there
    331     new_output_sww = os.path.join(output_directory, OUTPUT_SWW)
     333    new_output_sww = os.path.join(output_directory, expected_sww)
    332334    cmd = 'python cmpsww.py %s %s > cmpsww.stdout' % (local_sww, new_output_sww)
    333335    log.debug("check_that_output_is_as_expected: doing '%s'" % cmd)
     
    423425    log.critical("Running Patong '%s' validation ..." % vtype)
    424426    if run_simulation(vtype, odo):
    425         check_that_output_is_as_expected(vtype, odo)
     427        # get SWW names expected and valid, check 'equal'
     428        (valid_sww, _) = odo.rsplit('.', 1)
     429        (expected_sww, _) = valid_sww.rsplit('.', 1)
     430        check_that_output_is_as_expected(expected_sww, valid_sww)
    426431
    427432# clean up
Note: See TracChangeset for help on using the changeset viewer.