Changes in / [863b34f:059531a6]


Ignore:
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    r863b34f r059531a6  
    3131
    3232                //Run the tests from the tests directory
    33                 dir ('src/tests') {
    34                         if (full_build) {
    35                                 sh 'make all-tests debug=yes'
    36                                 sh 'make all-tests debug=no'
    37                         }
    38                         else {
    39                                 sh 'make'
    40                         }
     33                if (full_build) {
     34                        sh 'make -C src/tests all-tests debug=yes'
     35                        sh 'make -C src/tests all-tests debug=no'
     36                }
     37                else {
     38                        sh 'make -C src/tests'
    4139                }
    4240
  • src/libcfa/stdlib

    r863b34f r059531a6  
    2929
    3030extern "C" { void * malloc( size_t ); }                                 // use default C routine for void *
    31 forall( otype T ) T * malloc( void );
    32 forall( otype T ) T * malloc( char fill );
    33 forall( otype T ) T * malloc( T * ptr, size_t size );
    34 forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
     31forall( dtype T | sized(T) ) T * malloc( void );
     32forall( dtype T | sized(T) ) T * malloc( char fill );
     33forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size );
     34forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill );
    3535extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void *
    36 forall( otype T ) T * calloc( size_t nmemb );
     36forall( dtype T | sized(T) ) T * calloc( size_t nmemb );
    3737extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void *
    38 forall( otype T ) T * realloc( T * ptr, size_t size );
    39 forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
     38forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size );
     39forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill );
    4040
    41 forall( otype T ) T * aligned_alloc( size_t alignment );
    42 forall( otype T ) T * memalign( size_t alignment );             // deprecated
    43 forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
     41forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment );
     42forall( dtype T | sized(T) ) T * memalign( size_t alignment );          // deprecated
     43forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment );
    4444
    4545extern "C" {
     
    4848} // extern "C"
    4949
    50 forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p );
     50forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
    5151forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
    5252
  • src/libcfa/stdlib.c

    r863b34f r059531a6  
    2727} // extern "C"
    2828
    29 forall( otype T ) T * malloc( void ) {
     29forall( dtype T | sized(T) ) T * malloc( void ) {
    3030        //printf( "malloc1\n" );
    3131    return (T *)malloc( sizeof(T) );
    3232} // malloc
    33 forall( otype T ) T * malloc( char fill ) {
     33forall( dtype T | sized(T) ) T * malloc( char fill ) {
    3434        //printf( "malloc3\n" );
    3535        T * ptr = (T *)malloc( sizeof(T) );
     
    3737} // malloc
    3838
    39 forall( otype T ) T * calloc( size_t nmemb ) {
     39forall( dtype T | sized(T) ) T * calloc( size_t nmemb ) {
    4040        //printf( "calloc\n" );
    4141    return (T *)calloc( nmemb, sizeof(T) );
    4242} // calloc
    4343
    44 forall( otype T ) T * realloc( T * ptr, size_t size ) {
     44forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ) {
    4545        //printf( "realloc1\n" );
    4646    return (T *)(void *)realloc( (void *)ptr, size );
    4747} // realloc
    48 forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ) {
     48forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ) {
    4949        //printf( "realloc2\n" );
    5050    char * nptr = (T *)(void *)realloc( (void *)ptr, size );
     
    5454} // realloc
    5555
    56 forall( otype T ) T * malloc( T * ptr, size_t size ) {
     56forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ) {
    5757        //printf( "malloc4\n" );
    5858    return (T *)realloc( ptr, size );
    5959} // malloc
    60 forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ) {
     60forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ) {
    6161        //printf( "malloc5\n" );
    6262    return (T *)realloc( ptr, size, fill );
    6363} // malloc
    6464
    65 forall( otype T ) T * aligned_alloc( size_t alignment ) {
     65forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ) {
    6666        //printf( "aligned_alloc\n" );
    6767    return (T *)memalign( alignment, sizeof(T) );
    6868} // aligned_alloc
    6969
    70 forall( otype T ) T * memalign( size_t alignment ) {
     70forall( dtype T | sized(T) ) T * memalign( size_t alignment ) {
    7171        //printf( "memalign\n" );
    7272    return (T *)memalign( alignment, sizeof(T) );
    7373} // memalign
    7474
    75 forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ) {
     75forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ) {
    7676        //printf( "posix_memalign\n" );
    7777    return posix_memalign( (void **)ptr, alignment, sizeof(T) );
    7878} // posix_memalign
    7979
    80 forall( otype T, ttype Params | { void ?{}(T *, Params); } )
     80forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } )
    8181T * new( Params p ) {
    8282        return ((T*)malloc()){ p };
  • src/tests/dtor-early-exit.c

    r863b34f r059531a6  
    2828// don't want these called
    2929void ?{}(A * a) { assert( false ); }
    30 void ?{}(A * a, char * name) { a->name = name; sout | "construct " | name | endl; a->x = malloc(); }
     30void ?{}(A * a, char * name) { a->name = name; sout | "construct " | name | endl; a->x = (int*)malloc(); }
    3131void ?{}(A * a, char * name, int * ptr) { assert( false ); }
    3232
    3333A ?=?(A * a, A a) {  sout | "assign " | a->name | " " | a.name; return a; }
    34 void ?{}(A * a, A a) { sout | "copy construct " | a.name | endl; a->x = malloc(); }
     34void ?{}(A * a, A a) { sout | "copy construct " | a.name | endl; a->x = (int*)malloc(); }
    3535void ^?{}(A * a) { sout | "destruct " | a->name | endl; free(a->x); }
    3636
  • src/tests/test.py

    r863b34f r059531a6  
    168168
    169169def run_test_instance(t, generate, dry_run, debug) :
    170         # print formated name
    171         name_txt = "%20s  " % t.name
    172 
    173         #run the test instance and collect the result
    174         test_failed, error = run_single_test(t, generate, dry_run, debug)
    175 
    176         # update output based on current action
    177         if generate :
    178                 failed_txt = "ERROR"
    179                 success_txt = "Done"
    180         else :
    181                 failed_txt = "FAILED"
    182                 success_txt = "PASSED"
    183 
    184         #print result with error if needed
    185         text = name_txt + (failed_txt if test_failed else success_txt)
    186         out = sys.stdout
    187         if error :
    188                 text = text + "\n" + error
    189                 out = sys.stderr
    190 
    191         print(text, file = out);
    192         sys.stdout.flush()
    193         sys.stderr.flush()
    194 
    195         return test_failed
     170        try :
     171                # print formated name
     172                name_txt = "%20s  " % t.name
     173
     174                #run the test instance and collect the result
     175                test_failed, error = run_single_test(t, generate, dry_run, debug)
     176
     177                # update output based on current action
     178                if generate :
     179                        failed_txt = "ERROR"
     180                        success_txt = "Done"
     181                else :
     182                        failed_txt = "FAILED"
     183                        success_txt = "PASSED"
     184
     185                #print result with error if needed
     186                text = name_txt + (failed_txt if test_failed else success_txt)
     187                out = sys.stdout
     188                if error :
     189                        text = text + "\n" + error
     190                        out = sys.stderr
     191
     192                print(text, file = out);
     193                sys.stdout.flush()
     194                sys.stderr.flush()
     195                return test_failed
     196       
     197        except KeyboardInterrupt:
     198                test_failed = True
     199
    196200
    197201# run the given list of tests with the given parameters
     
    209213        pool = Pool(jobs)
    210214        try :
    211                 results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests ).get(99999999)
     215                results = pool.map_async(partial(run_test_instance, generate=generate, dry_run=dry_run, debug=debug), tests ).get(9999)
    212216        except KeyboardInterrupt:
    213217                pool.terminate()
  • src/tests/tupleVariadic.c

    r863b34f r059531a6  
    2929}
    3030
    31 forall(otype T, ttype Params | { void ?{}(T *, Params); })
     31forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } )
    3232T * new(Params p);
    3333
Note: See TracChangeset for help on using the changeset viewer.