Changeset 957


Ignore:
Timestamp:
Feb 17, 2007 12:13:11 AM (12 years ago)
Author:
bennylp
Message:

More robust pjlib file test: it shouldn't leave the file on the disk if the test fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pjlib-test/file.c

    r65 r957  
    2929                          'W', 'o', 'r', 'l', 'd' }; 
    3030 
    31 int file_test(void) 
     31static int file_test_internal(void) 
    3232{ 
    3333    enum { FILE_MAX_AGE = 1000 }; 
     
    9090        return -70; 
    9191 
     92#if INCLUDE_FILE_TIME_TEST 
    9293    /* Check file creation time >= start_time. */ 
    9394    if (!PJ_TIME_VAL_GTE(stat.ctime, start_time)) 
    94 #if INCLUDE_FILE_TIME_TEST 
    9595        return -80; 
    9696    /* Check file creation time is not much later. */ 
     
    207207} 
    208208 
     209 
     210int file_test(void) 
     211{ 
     212    int rc = file_test_internal(); 
     213 
     214    /* Delete test file if exists. */ 
     215    if (pj_file_exists(FILENAME)) 
     216        pj_file_delete(FILENAME); 
     217 
     218    return rc; 
     219} 
     220 
    209221#else 
    210222int dummy_file_test; 
Note: See TracChangeset for help on using the changeset viewer.