Changeset 6a490b2 for tests


Ignore:
Timestamp:
May 11, 2020, 1:53:29 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
504a7dc
Parents:
b7d6a36 (diff), a7b486b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into relaxed_ready

Location:
tests
Files:
38 added
9 deleted
27 edited
1 moved

Legend:

Unmodified
Added
Removed
  • tests/.expect/alloc-ERROR.txt

    rb7d6a36 r6a490b2  
    1 alloc.cfa:310:1 error: No reasonable alternatives for expression Applying untyped:
     1alloc.cfa:362:1 error: No reasonable alternatives for expression Applying untyped:
    22  Name: ?=?
    33...to:
    4   Name: p
     4  Name: ip
    55  Applying untyped:
    66    Name: realloc
     
    1919
    2020
    21 alloc.cfa:311:1 error: No reasonable alternatives for expression Applying untyped:
     21alloc.cfa:363:1 error: No reasonable alternatives for expression Applying untyped:
    2222  Name: ?=?
    2323...to:
    24   Name: p
    25   Applying untyped:
    26     Name: alloc
    27   ...to:
    28     Name: stp
    29     Applying untyped:
    30       Name: ?*?
    31     ...to:
    32       Name: dim
    33       Sizeof Expression on: Applying untyped:
    34           Name: *?
    35         ...to:
    36           Name: stp
    37 
    38 
    39 
    40 
    41 alloc.cfa:312:1 error: No reasonable alternatives for expression Applying untyped:
    42   Name: ?=?
    43 ...to:
    44   Name: p
     24  Name: ip
    4525  Applying untyped:
    4626    Name: memset
     
    5030
    5131
    52 alloc.cfa:313:1 error: No reasonable alternatives for expression Applying untyped:
     32alloc.cfa:364:1 error: No reasonable alternatives for expression Applying untyped:
    5333  Name: ?=?
    5434...to:
    55   Name: p
     35  Name: ip
    5636  Applying untyped:
    5737    Name: memcpy
  • tests/.expect/alloc.txt

    rb7d6a36 r6a490b2  
    23230xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0xefefefef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101
    2424
    25 CFA resize array alloc
     25CFA realloc array alloc
    26260xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    27 CFA resize array alloc
     27CFA realloc array alloc
    28280xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101
    29 CFA resize array alloc
     29CFA realloc array alloc
    30300xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    31 CFA resize array alloc
     31CFA realloc array alloc, fill
    32320xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
    33 CFA resize array alloc
     33CFA realloc array alloc, fill
    34340xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef
    35 CFA resize array alloc, fill
     35CFA realloc array alloc, fill
    36360xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0x1010101 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede 0xdededede
    3737
  • tests/Makefile.am

    rb7d6a36 r6a490b2  
    4141        -quiet @CFA_FLAGS@ \
    4242        -DIN_DIR="${abs_srcdir}/.in/"
     43
     44AM_CFAFLAGS = -XCFA --deterministic-out
    4345
    4446# get the desired cfa to test
  • tests/Makefile.in

    rb7d6a36 r6a490b2  
    408408        -DIN_DIR="${abs_srcdir}/.in/"
    409409
     410AM_CFAFLAGS = -XCFA --deterministic-out
    410411
    411412# get the desired cfa to test
  • tests/alloc.cfa

    rb7d6a36 r6a490b2  
    1010// Created On       : Wed Feb  3 07:56:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Feb 16 09:21:13 2020
    13 // Update Count     : 405
     12// Last Modified On : Mon Apr  6 21:08:23 2020
     13// Update Count     : 428
    1414//
    1515
     
    2828        size_t dim = 10;
    2929        char fill = '\xde';
    30         int * p, * p1;
     30        int * ip, * ip1;
    3131
    3232        // allocation, non-array types
    3333
    34         p = (int *)malloc( sizeof(*p) );                                        // C malloc, type unsafe
    35         *p = 0xdeadbeef;
    36         printf( "C   malloc %#x\n", *p );
    37         free( p );
    38 
    39         p = malloc();                                       // CFA malloc, type safe
    40         *p = 0xdeadbeef;
    41         printf( "CFA malloc %#x\n", *p );
    42         free( p );
    43 
    44         p = alloc();                                        // CFA alloc, type safe
    45         *p = 0xdeadbeef;
    46         printf( "CFA alloc %#x\n", *p );
    47         free( p );
    48 
    49         p = alloc_set( fill );                                                          // CFA alloc, fill
    50         printf( "CFA alloc, fill %08x\n", *p );
    51         free( p );
    52 
    53         p = alloc_set( 3 );                                                                     // CFA alloc, fill
    54         printf( "CFA alloc, fill %d\n", *p );
    55         free( p );
     34        ip = (int *)malloc( sizeof(*ip) );                                      // C malloc, type unsafe
     35        *ip = 0xdeadbeef;
     36        printf( "C   malloc %#x\n", *ip );
     37        free( ip );
     38
     39        ip = malloc();                                                                          // CFA malloc, type safe
     40        *ip = 0xdeadbeef;
     41        printf( "CFA malloc %#x\n", *ip );
     42        free( ip );
     43
     44        ip = alloc();                                                                           // CFA alloc, type safe
     45        *ip = 0xdeadbeef;
     46        printf( "CFA alloc %#x\n", *ip );
     47        free( ip );
     48
     49        ip = alloc_set( fill );                                                         // CFA alloc, fill
     50        printf( "CFA alloc, fill %08x\n", *ip );
     51        free( ip );
     52
     53        ip = alloc_set( 3 );                                                            // CFA alloc, fill
     54        printf( "CFA alloc, fill %d\n", *ip );
     55        free( ip );
    5656
    5757
     
    5959        printf( "\n" );
    6060
    61         p = (int *)calloc( dim, sizeof( *p ) );                         // C array calloc, type unsafe
     61        ip = (int *)calloc( dim, sizeof( *ip ) );                       // C array calloc, type unsafe
    6262        printf( "C   array calloc, fill 0\n" );
    63         for ( i; dim ) { printf( "%#x ", p[i] ); }
    64         printf( "\n" );
    65         free( p );
    66 
    67         p = calloc( dim );                                  // CFA array calloc, type safe
     63        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     64        printf( "\n" );
     65        free( ip );
     66
     67        ip = calloc( dim );                                                                     // CFA array calloc, type safe
    6868        printf( "CFA array calloc, fill 0\n" );
    69         for ( i; dim ) { printf( "%#x ", p[i] ); }
    70         printf( "\n" );
    71         free( p );
    72 
    73         p = alloc( dim );                                   // CFA array alloc, type safe
    74         for ( i; dim ) { p[i] = 0xdeadbeef; }
     69        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     70        printf( "\n" );
     71        free( ip );
     72
     73        ip = alloc( dim );                                                                      // CFA array alloc, type safe
     74        for ( i; dim ) { ip[i] = 0xdeadbeef; }
    7575        printf( "CFA array alloc, no fill\n" );
    76         for ( i; dim ) { printf( "%#x ", p[i] ); }
    77         printf( "\n" );
    78         free( p );
    79 
    80         p = alloc_set( 2 * dim, fill );                                         // CFA array alloc, fill
     76        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     77        printf( "\n" );
     78        free( ip );
     79
     80        ip = alloc_set( 2 * dim, fill );                                        // CFA array alloc, fill
    8181        printf( "CFA array alloc, fill %#hhx\n", fill );
    82         for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    83         printf( "\n" );
    84         free( p );
    85 
    86         p = alloc_set( 2 * dim, 0xdeadbeef );                           // CFA array alloc, fill
     82        for ( i; 2 * dim ) { printf( "%#x ", ip[i] ); }
     83        printf( "\n" );
     84        free( ip );
     85
     86        ip = alloc_set( 2 * dim, 0xdeadbeef );                          // CFA array alloc, fill
    8787        printf( "CFA array alloc, fill %#hhx\n", 0xdeadbeef );
    88         for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    89         printf( "\n" );
    90         // do not free
    91 
    92         p1 = alloc_set( 2 * dim, p );                                           // CFA array alloc, fill
     88        for ( i; 2 * dim ) { printf( "%#x ", ip[i] ); }
     89        printf( "\n" );
     90        // do not free
     91
     92        ip1 = alloc_set( 2 * dim, ip );                                         // CFA array alloc, fill
    9393        printf( "CFA array alloc, fill from array\n" );
    94         for ( i; 2 * dim ) { printf( "%#x %#x, ", p[i], p1[i] ); }
    95         free( p1 );
    96         printf( "\n" );
    97 
     94        for ( i; 2 * dim ) { printf( "%#x %#x, ", ip[i], ip1[i] ); }
     95        free( ip1 );
     96        printf( "\n" );
     97
     98
     99        // realloc, non-array types
     100        printf( "\n" );
     101
     102        ip = (int *)realloc( ip, dim * sizeof(*ip) );           // C realloc
     103        printf( "C realloc\n" );
     104        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     105        printf( "\n" );
     106        // do not free
     107
     108        ip = realloc( ip, 2 * dim * sizeof(*ip) );                      // CFA realloc
     109        for ( i; dim ~ 2 * dim ) { ip[i] = 0x1010101; }
     110        printf( "CFA realloc\n" );
     111        for ( i; 2 * dim ) { printf( "%#x ", ip[i] ); }
     112        printf( "\n" );
     113        // do not free
     114
     115
     116        // realloc, array types
     117        printf( "\n" );
     118
     119        ip = alloc( ip, dim );                                                          // CFA realloc array alloc
     120        for ( i; dim ) { ip[i] = 0xdeadbeef; }
     121        printf( "CFA realloc array alloc\n" );
     122        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     123        printf( "\n" );
     124        // do not free
     125
     126        ip = alloc( ip, 2 * dim );                                                      // CFA realloc array alloc
     127        for ( i; dim ~ 2 * dim ) { ip[i] = 0x1010101; }         // fill upper part
     128        printf( "CFA realloc array alloc\n" );
     129        for ( i; 2 * dim ) { printf( "%#x ", ip[i] ); }
     130        printf( "\n" );
     131        // do not free
     132
     133        ip = alloc( ip, dim );                                                          // CFA realloc array alloc
     134        printf( "CFA realloc array alloc\n" );
     135        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     136        printf( "\n" );
     137        // do not free
     138
     139        ip = alloc_set( ip, 3 * dim, fill );                            // CFA realloc array alloc, fill
     140        printf( "CFA realloc array alloc, fill\n" );
     141        for ( i; 3 * dim ) { printf( "%#x ", ip[i] ); }
     142        printf( "\n" );
     143        // do not free
     144
     145        ip = alloc_set( ip, dim, fill );                                        // CFA realloc array alloc, fill
     146        printf( "CFA realloc array alloc, fill\n" );
     147        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     148        printf( "\n" );
     149        // do not free
     150
     151        ip = alloc_set( ip, 3 * dim, fill );                            // CFA realloc array alloc, fill
     152        printf( "CFA realloc array alloc, fill\n" );
     153        for ( i; 3 * dim ) { printf( "%#x ", ip[i] ); }
     154        printf( "\n" );
     155        // do not free
     156#if 0 // FIX ME
     157        ip = alloc_set( ip, 5 * dim, 5 );                                       // CFA realloc array alloc, 5
     158        printf( "CFA realloc array alloc, 5\n" );
     159        for ( i; 5 * dim ) { printf( "%#x ", ip[i] ); }
     160        printf( "\n" );
     161        // do not free
     162
     163        ip = alloc_set( ip, dim, 5 );                                           // CFA realloc array alloc, 5
     164        printf( "CFA realloc array alloc, 5\n" );
     165        for ( i; dim ) { printf( "%#x ", ip[i] ); }
     166        printf( "\n" );
     167        // do not free
     168
     169        ip = alloc_set( ip, 5 * dim, 5 );                                       // CFA realloc array alloc, 5
     170        printf( "CFA realloc array alloc, 5\n" );
     171        for ( i; 5 * dim ) { printf( "%#x ", ip[i] ); }
     172        printf( "\n" );
     173#endif // 0
     174        free( ip );
    98175
    99176        // resize, non-array types
    100         printf( "\n" );
    101 
    102         p = (int *)realloc( p, dim * sizeof(*p) );                      // C realloc
    103         printf( "C realloc\n" );
    104         for ( i; dim ) { printf( "%#x ", p[i] ); }
    105         printf( "\n" );
    106         // do not free
    107 
    108         p = realloc( p, 2 * dim * sizeof(*p) );             // CFA realloc
    109         for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; }
    110         printf( "CFA realloc\n" );
    111         for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    112         printf( "\n" );
    113         // do not free
     177
     178        struct S {
     179                int a[5];
     180        };
     181
     182    ip = alloc();
     183        *ip = 5;
     184    double * dp = alloc( ip );
     185        *dp = 5.5;
     186    S * sp = alloc( dp );
     187        *sp = (S){ {0, 1, 2, 3, 4} };
     188    ip = alloc( sp );
     189        *ip = 3;
     190    free( ip );
    114191
    115192
    116193        // resize, array types
    117         printf( "\n" );
    118 
    119         p = alloc( p, dim );                                // CFA resize array alloc
    120         for ( i; dim ) { p[i] = 0xdeadbeef; }
    121         printf( "CFA resize array alloc\n" );
    122         for ( i; dim ) { printf( "%#x ", p[i] ); }
    123         printf( "\n" );
    124         // do not free
    125 
    126         p = alloc( p, 2 * dim );                            // CFA resize array alloc
    127         for ( i; dim ~ 2 * dim ) { p[i] = 0x1010101; }          // fill upper part
    128         printf( "CFA resize array alloc\n" );
    129         for ( i; 2 * dim ) { printf( "%#x ", p[i] ); }
    130         printf( "\n" );
    131         // do not free
    132 
    133         p = alloc( p, dim );                                // CFA resize array alloc
    134         printf( "CFA resize array alloc\n" );
    135         for ( i; dim ) { printf( "%#x ", p[i] ); }
    136         printf( "\n" );
    137         // do not free
    138 
    139         p = alloc_set( p, 3 * dim, fill );                                      // CFA resize array alloc, fill
    140         printf( "CFA resize array alloc\n" );
    141         for ( i; 3 * dim ) { printf( "%#x ", p[i] ); }
    142         printf( "\n" );
    143         // do not free
    144 
    145         p = alloc_set( p, dim, fill );                                          // CFA resize array alloc, fill
    146         printf( "CFA resize array alloc\n" );
    147         for ( i; dim ) { printf( "%#x ", p[i] ); }
    148         printf( "\n" );
    149         // do not free
    150 
    151         p = alloc_set( p, 3 * dim, fill );                                      // CFA resize array alloc, fill
    152         printf( "CFA resize array alloc, fill\n" );
    153         for ( i; 3 * dim ) { printf( "%#x ", p[i] );; }
    154         printf( "\n" );
    155         free( p );
     194
     195    ip = alloc( 5 );
     196        for ( i; 5 ) { ip[i] = 5; }
     197    dp = alloc( ip, 5 );
     198        for ( i; 5 ) { dp[i] = 5.5; }
     199    sp = alloc( dp, 5 );
     200        for ( i; 5 ) { sp[i] = (S){ {0, 1, 2, 3, 4} }; }
     201    ip = alloc( sp, 3 );
     202        for ( i; 3 ) { ip[i] = 3; }
     203    ip = alloc( ip, 7 );
     204        for ( i; 7 ) { ip[i] = 7; }
     205    ip = alloc( ip, 7, false );
     206        for ( i; 7 ) { ip[i] = 7; }
     207    free( ip );
    156208
    157209
     
    168220        free( stp );
    169221
    170         stp = &(*memalign( Alignment )){ 42, 42.5 };          // CFA memalign
     222        stp = &(*memalign( Alignment )){ 42, 42.5 };            // CFA memalign
    171223        assert( (uintptr_t)stp % Alignment == 0 );
    172224        printf( "CFA memalign %d %g\n", stp->x, stp->y );
     
    300352        free( fp - 1 );
    301353
    302         p = foo( bar( baz( malloc(), 0 ), 0 ), 0 );
    303         *p = 0xdeadbeef;
    304         printf( "CFA deep malloc %#x\n", *p );
    305         free( p );
     354        ip = foo( bar( baz( malloc(), 0 ), 0 ), 0 );
     355        *ip = 0xdeadbeef;
     356        printf( "CFA deep malloc %#x\n", *ip );
     357        free( ip );
    306358
    307359#ifdef ERR1
    308360        stp = malloc();
    309361        printf( "\nSHOULD FAIL\n" );
    310         p = realloc( stp, dim * sizeof( *stp ) );
    311         p = alloc( stp, dim * sizeof( *stp ) );
    312         p = memset( stp, 10 );
    313         p = memcpy( &st1, &st );
     362        ip = realloc( stp, dim * sizeof( *stp ) );
     363        ip = memset( stp, 10 );
     364        ip = memcpy( &st1, &st );
    314365#endif
    315366} // main
  • tests/concurrent/.expect/monitor.txt

    rb7d6a36 r6a490b2  
    1 4000000
     13000000
  • tests/concurrent/coroutineYield.cfa

    rb7d6a36 r6a490b2  
    3333                        sout | "Coroutine 2";
    3434                #endif
    35                 suspend();
     35                suspend;
    3636        }
    3737}
  • tests/concurrent/monitor.cfa

    rb7d6a36 r6a490b2  
    2929
    3030void main( MyThread & this ) {
    31         for(int i = 0; i < 1_000_000; i++) {
     31        for(int i = 0; i < 750_000; i++) {
    3232                increment( global );
    3333        }
  • tests/concurrent/multi-monitor.cfa

    rb7d6a36 r6a490b2  
    1111
    1212void increment( monitor_t & mutex p1, monitor_t & mutex p2, int & value ) {
     13        assert(active_thread() == get_monitor(p1)->owner);
     14        assert(active_thread() == get_monitor(p2)->owner);
    1315        value += 1;
     16        assert(active_thread() == get_monitor(p1)->owner);
     17        assert(active_thread() == get_monitor(p2)->owner);
    1418}
    1519
  • tests/concurrent/signal/block.cfa

    rb7d6a36 r6a490b2  
    3333
    3434monitor global_data_t {
    35         thread_desc * last_thread;
    36         thread_desc * last_signaller;
     35        $thread * last_thread;
     36        $thread * last_signaller;
    3737};
    3838
     
    8282        if( !is_empty( cond ) ) {
    8383
    84                 thread_desc * next = front( cond );
     84                $thread * next = front( cond );
    8585
    8686                if( ! signal_block( cond ) ) {
  • tests/concurrent/suspend_then.cfa

    rb7d6a36 r6a490b2  
    11#include <fstream.hfa>
    22#include <kernel.hfa>
    3 #include <monitor.hfa>
    43#include <thread.hfa>
    54#include <time.hfa>
     
    109#include "long_tests.hfa"
    1110
    12 #ifndef PREEMPTION_RATE
    13 #define PREEMPTION_RATE 10`ms
    14 #endif
    15 
    1611Duration default_preemption() {
    17         return PREEMPTION_RATE;
     12        return 0;
    1813}
    1914
     
    2621#if !defined(TEST_FOREVER)
    2722        static inline void print(const char * const text ) {
    28                 write( STDERR_FILENO, text, strlen(text) );
     23                write( STDOUT_FILENO, text, strlen(text) );
    2924        }
    3025#else
     
    3227#endif
    3328
    34 coroutine Coroutine {};
     29generator Coroutine { int i; };
    3530
    3631volatile bool done = false;
     
    4944
    5045void main(Coroutine& this) {
    51         suspend();
    52         for(int i = 0; TEST(i < N); i++) {
     46        this.i = 0;
     47        suspend;
     48        for(;TEST(this.i < N); this.i++) {
    5349
    54                 print("C - Suspending");
    55                 void publish() {
    56                         print("C - Publishing");
     50                print("C - Suspending\n");
     51                suspend{
     52                        print("C - Publishing\n");
    5753                        assert(!the_cor);
    5854                        store( this );
    5955                }
    60                 suspend_then(publish);
    6156                assert(!the_cor);
    62                 print("Coroutine 2");
     57                print("C - Back\n");
    6358                KICK_WATCHDOG;
    6459                yield();
    6560        }
    6661        done = true;
    67         suspend();
     62        suspend;
    6863}
    6964
     
    7772                if(!mine) continue;
    7873
    79                 print("T - took");
     74                print("T - took\n");
    8075                resume(*mine);
    81                 print("T - back");
    8276        }
    8377}
  • tests/coroutine/.expect/fmtLines.txt

    rb7d6a36 r6a490b2  
    4848{                                                         // f  or n  ewli 
    4949ne c  hara  cter  s                                     su 
    50 spen  d();                                      if   ( fm 
    51 t.ch   !=   '\n'   ) b  reak 
    52 ;               /  / ig  nore   new  line 
    53                                   } //   for                              sout 
    54  | f  mt.c  h;                                                  //  
    55 prin  t ch  arac  ter                   }  
    56 // f  or                        sou  t |   "  " 
    57 ;                                                               //   prin  t bl 
    58 ock   sepa  rato  r             }   //  
    59 for             sou  t |   nl;                                   
    60                                   // p  rint   gro  up s 
    61 epar  ator      } /  / fo  r} / 
    62 / ma  invo  id p  rt(   Form 
    63 at &   fmt  , ch  ar c  h )   
    64 {      fmt  .ch   = ch  ;    
    65  res  ume(   fmt   );}   //  
    66 prti  nt m  ain(  ) {     Form 
    67 at f  mt;         char   ch;    for 
    68  ( ;  ; )   {           s  in |   ch; 
    69                                                                                 //   rea  d on 
    70 e ch  arac  ter     if   ( e 
    71 of(   sin   ) )   brea  k;               
    72                                         //   eof   ?            p  rt(  
    73 fmt,   ch   );  }   //   for} 
    74  //   main  // L  ocal   Var 
    75 iabl  es:   ////   tab  -wid 
    76 th:   4 //  // c  ompi  le-c 
    77 omma  nd:   "cfa   fmt  Line 
    78 s.cf  a" /  ///   End:   //
     50spen  d;                                        i  f (   fmt. 
     51ch !  = '\  n' )   bre  ak;      
     52        //   igno  re n  ewli  ne                
     53                }   // f  or                            so  ut | 
     54 fmt  .ch;                                                      /  / pr 
     55int   char  acte  r                       } // 
     56 for                    s  out   | "    ";       
     57                                                        /  / pr  int   bloc 
     58k se  para  tor         } /  / fo 
     59r               s  out   | nl  ;                                                         
     60                //   pri  nt g  roup   sep 
     61arat  or        }   //   for}   //  
     62main  void   prt  ( Fo  rmat 
     63 & f  mt,   char   ch   ) {   
     64   f  mt.c  h =   ch;      r 
     65esum  e( f  mt )  ;} /  / pr 
     66tint   mai  n()   {     Fo  rmat 
     67 fmt  ; ch  ar c  h;    f  or ( 
     68 ;;   ) {               sin   | c  h;            
     69                                                                  // r  ead   one  
     70char  acte  r       if (   eof 
     71( si  n )   ) br  eak;                                   
     72                        /  / eo  f ?            prt  ( fm 
     73t, c  h );      } /  / fo  r} / 
     74/ ma  in//   Loc  al V  aria 
     75bles  : //  // t  ab-w  idth 
     76: 4   ////   com  pile  -com 
     77mand  : "c  fa f  mtLi  nes. 
     78cfa"   ///  / En  d: /  /
  • tests/coroutine/.in/fmtLines.txt

    rb7d6a36 r6a490b2  
    3535                        for ( fmt.b = 0; fmt.b < 4; fmt.b += 1 ) {      // blocks of 4 characters
    3636                                for ( ;; ) {                                                    // for newline characters
    37                                         suspend();
     37                                        suspend;
    3838                                        if ( fmt.ch != '\n' ) break;            // ignore newline
    3939                                } // for
  • tests/coroutine/cntparens.cfa

    rb7d6a36 r6a490b2  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
     6//
    77// cntparens.cfa -- match left/right parenthesis
    8 // 
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Apr 20 11:04:45 2019
     
    1212// Last Modified On : Sat Apr 20 11:06:21 2019
    1313// Update Count     : 1
    14 // 
     14//
    1515
    1616#include <fstream.hfa>
     
    2626void main( CntParens & cpns ) with( cpns ) {
    2727        for ( ; ch == '('; cnt += 1 ) {                                         // left parenthesis
    28                 suspend();
     28                suspend;
    2929        }
    3030        for ( ; ch == ')' && cnt > 1; cnt -= 1 ) {                      // right parenthesis
    31                 suspend();
     31                suspend;
    3232        }
    3333        status = ch == ')' ? Match : Error;
    3434} // main
    35        
     35
    3636void ?{}( CntParens & cpns ) with( cpns ) { status = Cont; cnt = 0; }
    3737
  • tests/coroutine/devicedriver.cfa

    rb7d6a36 r6a490b2  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // devicedriver.cfa -- 
    8 // 
     6//
     7// devicedriver.cfa --
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Mar 16 15:30:34 2019
     
    1212// Last Modified On : Sat Apr 20 09:07:19 2019
    1313// Update Count     : 90
    14 // 
     14//
    1515
    1616#include <fstream.hfa>
     
    2929
    3030void checkCRC( Driver & d, unsigned int sum ) with( d ) {
    31         suspend();
     31        suspend;
    3232        unsigned short int crc = byte << 8;                                     // sign extension over written
    33         suspend();
     33        suspend;
    3434        // prevent sign extension for signed char
    3535        status = (crc | (unsigned char)byte) == sum ? MSG : ECRC;
     
    4141                status = CONT;
    4242                unsigned int lnth = 0, sum = 0;
    43                 while ( byte != STX ) suspend();
     43                while ( byte != STX ) suspend;
    4444          emsg: for () {
    45                         suspend();
     45                        suspend;
    4646                        choose ( byte ) {                                                       // process byte
    4747                          case STX:
    48                                 status = ESTX; suspend(); continue msg;
     48                                status = ESTX; suspend; continue msg;
    4949                          case ETX:
    5050                                break emsg;
    5151                          case ESC:
    52                                 suspend();
     52                                suspend;
    5353                        } // choose
    5454                        if ( lnth >= MaxMsg ) {                                         // buffer full ?
    55                                 status = ELNTH; suspend(); continue msg;
     55                                status = ELNTH; suspend; continue msg;
    5656                        } // if
    5757                        msg[lnth++] = byte;
     
    6060                msg[lnth] = '\0';                                                               // terminate string
    6161                checkCRC( d, sum );                                                             // refactor CRC check
    62                 suspend();
     62                suspend;
    6363        } // for
    6464} // main
  • tests/coroutine/fibonacci.cfa

    rb7d6a36 r6a490b2  
    2222        int fn1, fn2;                                                                           // retained between resumes
    2323        fn = 0;  fn1 = fn;                                                                      // 1st case
    24         suspend();                                                                                      // restart last resume
     24        suspend;                                                                                        // restart last resume
    2525        fn = 1;  fn2 = fn1;  fn1 = fn;                                          // 2nd case
    26         suspend();                                                                                      // restart last resume
     26        suspend;                                                                                        // restart last resume
    2727        for () {
    2828                fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;                  // general case
    29                 suspend();                                                                              // restart last resume
     29                suspend;                                                                                // restart last resume
    3030        } // for
    3131}
  • tests/coroutine/fibonacci_1.cfa

    rb7d6a36 r6a490b2  
    1212// Last Modified On : Thu Mar 21 08:10:45 2019
    1313// Update Count     : 25
    14 // 
     14//
    1515
    1616#include <fstream.hfa>
     
    2323        [fn1, fn] = [0, 1];                                                                     // precompute first two states
    2424        for () {
    25                 suspend();                                                                              // restart last resume
     25                suspend;                                                                                // restart last resume
    2626                [fn1, fn] = [fn, fn1 + fn];                                             // general case
    2727        } // for
  • tests/coroutine/fmtLines.cfa

    rb7d6a36 r6a490b2  
    2727                        for ( b = 0; b < 4; b += 1 ) {                          // blocks of 4 characters
    2828                                for () {                                                                // for newline characters
    29                                         suspend();
     29                                        suspend;
    3030                                  if ( ch != '\n' ) break;                              // ignore newline
    3131                                } // for
  • tests/coroutine/raii.cfa

    rb7d6a36 r6a490b2  
    3939        Raii raii = { "Coroutine" };
    4040        sout | "Before Suspend";
    41         suspend();
     41        suspend;
    4242        sout | "After Suspend";
    4343}
  • tests/coroutine/runningTotal.cfa

    rb7d6a36 r6a490b2  
    2525void update( RunTotal & rntl, int input ) with( rntl ) { // helper
    2626        total += input;                                                                         // remember between activations
    27         suspend();                                                                                      // inactivate on stack
     27        suspend;                                                                                        // inactivate on stack
    2828}
    2929
  • tests/coroutine/suspend_then.cfa

    rb7d6a36 r6a490b2  
    1515
    1616#include <fstream.hfa>
    17 #include <coroutine.hfa>
    1817
    19 void then() {
    20         sout | "Then!";
    21 }
    22 
    23 coroutine Fibonacci { int fn; };                                                // used for communication
     18generator Fibonacci {
     19        int fn;                                                                         // used for communication
     20        int fn1, fn2;                                                           // retained between resumes
     21};
    2422
    2523void main( Fibonacci & fib ) with( fib ) {                              // called on first resume
    26         int fn1, fn2;                                                           // retained between resumes
    2724        fn = 0;  fn1 = fn;                                                      // 1st case
    28         suspend_then(then);                                                     // restart last resume
     25        suspend { sout | "Then!"; }                                             // restart last resume
    2926        fn = 1;  fn2 = fn1;  fn1 = fn;                                  // 2nd case
    30         suspend_then(then);                                                     // restart last resume
     27        suspend { sout | "Then!"; }                                             // restart last resume
    3128        for () {
    3229                fn = fn1 + fn2;  fn2 = fn1;  fn1 = fn;                  // general case
    33                 suspend_then(then);                                             // restart last resume
     30                suspend { sout | "Then!"; }                                     // restart last resume
    3431        } // for
    3532}
  • tests/errors/.expect/completeType.txt

    rb7d6a36 r6a490b2  
    2727    void
    2828  )
    29   Environment:( _83_4_DT ) -> instance of struct A with body 0 (no widening)
     29  Environment: -> instance of struct A with body 0 (no widening)
    3030
    3131
     
    5050    void
    5151  )
    52   Environment:( _83_4_DT ) -> instance of struct B with body 1 (no widening)
     52  Environment: -> instance of struct B with body 1 (no widening)
    5353
    5454
     
    127127          void
    128128        )
    129         Environment:( _102_0_T ) -> instance of type T (not function type) (no widening)
     129        Environment: -> instance of type T (not function type) (no widening)
    130130
    131131      Could not satisfy assertion:
    132132?=?: pointer to function
    133133        ... with parameters
    134           reference to instance of type _102_0_T (not function type)
    135           instance of type _102_0_T (not function type)
     134          reference to instance of type _104_0_T (not function type)
     135          instance of type _104_0_T (not function type)
    136136        ... returning
    137           _retval__operator_assign: instance of type _102_0_T (not function type)
     137          _retval__operator_assign: instance of type _104_0_T (not function type)
    138138          ... with attributes:
    139139            Attribute with name: unused
  • tests/manipulatorsOutput1.cfa

    rb7d6a36 r6a490b2  
    77// Created On       : Sat Jun  8 18:04:11 2019
    88// Last Modified By : Peter A. Buhr
    9 // Last Modified On : Mon Jun 10 12:37:28 2019
    10 // Update Count     : 8
     9// Last Modified On : Fri May  1 11:51:44 2020
     10// Update Count     : 9
    1111//
    1212
     
    1717        signed char sc = -12;
    1818        printf( "%hhd %2hhd %5.2hhd %-5.2hhd %hho %#hho %hhx %#hhx %#8hhx %#8.10hhx %#8.3hhX %+-8.3hhd %08hhd\n", sc, sc, sc, sc, sc, sc, sc, sc, sc, sc, sc, sc, sc );
    19         sout | sc | wd(2,sc) | wd(5,2,sc) | left(wd(5,2,sc)) | nobase(oct(sc)) | oct(sc) | nobase(hex(sc)) | hex(sc) | wd(8,hex(sc)) | wd(8,10,hex(sc)) | upcase(wd(8,3,hex(sc))) | left(sign(upcase(wd(8,3,sc)))) | pad0(wd(8,sc));
     19        sout | sc | wd(2,sc) | wd(5,2,sc) | left(wd(5,2,sc)) | nobase(oct(sc)) | oct(sc) | nonl;
     20        sout | nobase(hex(sc)) | hex(sc) | wd(8,hex(sc)) | wd(8,10,hex(sc)) | upcase(wd(8,3,hex(sc))) | nonl;
     21        sout | left(sign(upcase(wd(8,3,sc)))) | pad0(wd(8,sc));
    2022
    2123        sout | "unsigned char";
    2224        unsigned char usc = 12;
    2325        printf( "%hhu %2hhu %5.2hhu %-5.2hhu %hho %#hho %hhx %#hhx %#8hhx %#8.10hhx %#8.3hhX %-8.3hhu %08hhu\n", usc, usc, usc, usc, usc, usc, usc, usc, usc, usc, usc, usc, usc );
    24         sout | usc | wd(2,usc) | wd(5,2,usc) | left(wd(5,2,usc)) | nobase(oct(usc)) | oct(usc) | nobase(hex(usc)) | hex(usc) | wd(8,hex(usc)) | wd(8,10,hex(usc)) | upcase(wd(8,3,hex(usc))) | left(upcase(wd(8,3,usc))) | pad0(wd(8,usc));
     26        sout | usc | wd(2,usc) | wd(5,2,usc) | left(wd(5,2,usc)) | nobase(oct(usc)) | oct(usc) | nonl;
     27        sout | nobase(hex(usc)) | hex(usc) | wd(8,hex(usc)) | wd(8,10,hex(usc)) | upcase(wd(8,3,hex(usc))) | nonl;
     28        sout | left(upcase(wd(8,3,usc))) | pad0(wd(8,usc));
    2529
    2630        sout | "signed short int";
    2731        signed short int si = -12;
    2832        printf( "%hd %2hd %5.2hd %-5.2hd %ho %#ho %hx %#hx %#8hx %#8.10hx %#8.3hX %+-8.3hd %08hd\n", si, si, si, si, si, si, si, si, si, si, si, si, si );
    29         sout | si | wd(2,si) | wd(5,2,si) | left(wd(5,2,si)) | nobase(oct(si)) | oct(si) | nobase(hex(si)) | hex(si) | wd(8,hex(si)) | wd(8,10,hex(si)) | upcase(wd(8,3,hex(si))) | left(sign(upcase(wd(8,3,si)))) | pad0(wd(8,si));
     33        sout | si | wd(2,si) | wd(5,2,si) | left(wd(5,2,si)) | nobase(oct(si)) | oct(si) | nonl;
     34        sout | nobase(hex(si)) | hex(si) | wd(8,hex(si)) | wd(8,10,hex(si)) | upcase(wd(8,3,hex(si))) | nonl;
     35        sout | left(sign(upcase(wd(8,3,si)))) | pad0(wd(8,si));
    3036
    3137        sout | "unsigned short int";
    3238        unsigned short int usi = 12;
    3339        printf( "%hu %2hu %5.2hu %-5.2hu %ho %#ho %hx %#hx %#8hx %#8.10hx %#8.3hX %-8.3hu %08hu\n", usi, usi, usi, usi, usi, usi, usi, usi, usi, usi, usi, usi, usi );
    34         sout | usi | wd(2,usi) | wd(5,2,usi) | left(wd(5,2,usi)) | nobase(oct(usi)) | oct(usi) | nobase(hex(usi)) | hex(usi) | wd(8,hex(usi)) | wd(8,10,hex(usi)) | upcase(wd(8,3,hex(usi))) | left(upcase(wd(8,3,usi))) | pad0(wd(8,usi));
     40        sout | usi | wd(2,usi) | wd(5,2,usi) | left(wd(5,2,usi)) | nobase(oct(usi)) | oct(usi) | nonl;
     41        sout | nobase(hex(usi)) | hex(usi) | wd(8,hex(usi)) | wd(8,10,hex(usi)) | upcase(wd(8,3,hex(usi))) | nonl;
     42        sout | left(upcase(wd(8,3,usi))) | pad0(wd(8,usi));
    3543
    3644        sout | "signed int";
    3745        signed int i = -12;
    3846        printf( "%d %2d %5.2d %-5.2d %o %#o %x %#x %#8x %#8.10x %#8.3X %+-8.3d %08d\n", i, i, i, i, i, i, i, i, i, i, i, i, i );
    39         sout | i | wd(2,i) | wd(5,2,i) | left(wd(5,2,i)) | nobase(oct(i)) | oct(i) | nobase(hex(i)) | hex(i) | wd(8,hex(i)) | wd(8,10,hex(i)) | upcase(wd(8,3,hex(i))) | left(sign(upcase(wd(8,3,i)))) | pad0(wd(8,i));
     47        sout | i | wd(2,i) | wd(5,2,i) | left(wd(5,2,i)) | nobase(oct(i)) | oct(i) | nonl;
     48        sout | nobase(hex(i)) | hex(i) | wd(8,hex(i)) | wd(8,10,hex(i)) | upcase(wd(8,3,hex(i))) | nonl;
     49        sout | left(sign(upcase(wd(8,3,i)))) | pad0(wd(8,i));
    4050
    4151        sout | "unsigned int";
    4252        unsigned int ui = 12;
    4353        printf( "%u %2u %5.2u %-5.2u %o %#o %x %#x %#8x %#8.10x %#8.3X %-8.3u %08u\n", ui, ui, ui, ui, ui, ui, ui, ui, ui, ui, ui, ui, ui );
    44         sout | ui | wd(2,ui) | wd(5,2,ui) | left(wd(5,2,ui)) | nobase(oct(ui)) | oct(ui) | nobase(hex(ui)) | hex(ui) | wd(8,hex(ui)) | wd(8,10,hex(ui)) | upcase(wd(8,3,hex(ui))) | left(upcase(wd(8,3,ui))) | pad0(wd(8,ui));
     54        sout | ui | wd(2,ui) | wd(5,2,ui) | left(wd(5,2,ui)) | nobase(oct(ui)) | oct(ui) | nonl;
     55        sout | nobase(hex(ui)) | hex(ui) | wd(8,hex(ui)) | wd(8,10,hex(ui)) | upcase(wd(8,3,hex(ui))) | nonl;
     56        sout | left(upcase(wd(8,3,ui))) | pad0(wd(8,ui));
    4557
    4658        sout | "signed long long int";
    4759        signed long long int lli = -12;
    4860        printf( "%lld %2lld %5.2lld %-5.2lld %llo %#llo %llx %#llx %#8llx %#8.10llx %#8.3llX %+-8.3lld %08lld\n", lli, lli, lli, lli, lli, lli, lli, lli, lli, lli, lli, lli, lli );
    49         sout | lli | wd(2,lli) | wd(5,2,lli) | left(wd(5,2,lli)) | nobase(oct(lli)) | oct(lli) | nobase(hex(lli)) | hex(lli) | wd(8,hex(lli)) | wd(8,10,hex(lli)) | upcase(wd(8,3,hex(lli))) | left(sign(upcase(wd(8,3,lli)))) | pad0(wd(8,lli));
     61        sout | lli | wd(2,lli) | wd(5,2,lli) | left(wd(5,2,lli)) | nobase(oct(lli)) | oct(lli) | nonl;
     62        sout | nobase(hex(lli)) | hex(lli) | wd(8,hex(lli)) | wd(8,10,hex(lli)) | upcase(wd(8,3,hex(lli))) | nonl;
     63        sout | left(sign(upcase(wd(8,3,lli)))) | pad0(wd(8,lli));
    5064
    5165        sout | "unsigned long long int";
    5266        unsigned long long int ulli = 12;
    5367        printf( "%llu %2llu %5.2llu %-5.2llu %llo %#llo %llx %#llx %#8llx %#8.10llx %#8.3llX %-8.3llu %08llu\n", ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli, ulli );
    54         sout | ulli | wd(2,ulli) | wd(5,2,ulli) | left(wd(5,2,ulli)) | nobase(oct(ulli)) | oct(ulli) | nobase(hex(ulli)) | hex(ulli) | wd(8,hex(ulli)) | wd(8,10,hex(ulli)) | upcase(wd(8,3,hex(ulli))) | left(upcase(wd(8,3,ulli))) | pad0(wd(8,ulli));
     68        sout | ulli | wd(2,ulli) | wd(5,2,ulli) | left(wd(5,2,ulli)) | nobase(oct(ulli)) | oct(ulli) | nonl;
     69        sout | nobase(hex(ulli)) | hex(ulli) | wd(8,hex(ulli)) | wd(8,10,hex(ulli)) | upcase(wd(8,3,hex(ulli))) | nonl;
     70        sout | left(upcase(wd(8,3,ulli))) | pad0(wd(8,ulli));
    5571
    5672        sout | nl | "binary integral";
    57         sout | bin(0) | bin(13) | upcase(bin(13)) | nobase(bin(13)) | left(wd(8,bin(13))) | wd(8,bin(13)) | pad0(left(wd(8,bin(13)))) | pad0(wd(8,bin(13))) | pad0(wd(8,10,bin(13))) | pad0(wd(8,6,bin(13)));
     73        sout | bin(0) | bin(13) | upcase(bin(13)) | nobase(bin(13)) | left(wd(8,bin(13))) | wd(8,bin(13)) | nonl;
     74        sout | pad0(left(wd(8,bin(13)))) | pad0(wd(8,bin(13))) | pad0(wd(8,10,bin(13))) | pad0(wd(8,6,bin(13)));
    5875
    5976
     
    6279        printf( "%g  %8g %#8g %g %8g %8.0g %#8.0g %8.2g %#8.2g %-8.2g %-8.2g %-#8.2g %-+8.2g %-+#8.2g %08.2g %8.2E %8.2a %#8.2A %#8.2e\n",
    6380                    0.0,3.0F,3.0F, f,  f,    f,     f,    f,     f,  3.0F,      f,      f,      f,       f,     f,    f,    f,     f,     f );
    64         sout | 0.0 | wd(8, 3.0F) | nodp(wd(8, 3.0F)) | f | wd(8, f) | ws(8,0, f) | nodp(ws(8,0, f)) | ws(8,2, f) | nodp(ws(8,2, f)) | left(ws(8,2, 3.0F)) | left(ws(8,2, f)) | left(nodp(ws(8,2, f))) | left(sign(ws(8,2, f))) | left(sign(nodp(ws(8,2, f)))) | pad0(ws(8,2, f)) | upcase(wd(8,2, sci(f))) | wd(8,2, hex(f)) | upcase(wd(8,2, hex(f))) | nodp(wd(8,2, sci(f)));
     81        sout | 0.0 | wd(8, 3.0F) | nodp(wd(8, 3.0F)) | f | wd(8, f) | ws(8,0, f) | nodp(ws(8,0, f)) | ws(8,2, f) | nodp(ws(8,2, f)) | nonl;
     82        sout | left(ws(8,2, 3.0F)) | left(ws(8,2, f)) | left(nodp(ws(8,2, f))) | left(sign(ws(8,2, f))) | left(sign(nodp(ws(8,2, f)))) | nonl;
     83        sout | pad0(ws(8,2, f)) | upcase(wd(8,2, sci(f))) | wd(8,2, hex(f)) | upcase(wd(8,2, hex(f))) | nodp(wd(8,2, sci(f)));
    6584
    6685        sout | "double";
     
    6887        printf( "%g  %#8f %g %8f %#8.0f %8.0f %8.2f %-8.2f %-+#8.2f %08.2F %8.2E %8.2a %8.2A %8.2e\n",
    6988                        0.0,  3.0, d,  d,     d,    d,    d,     d,       d,     d,    d,    d,    d,    d );
    70         sout | 0.0 | wd(8, 3.0) | d | wd(8, d) | nodp(wd(8,0, d)) | wd(8,0, d) | wd(8,2, d) | left(wd(8,2, d)) | left(sign(wd(8,2, d))) | pad0(upcase(wd(8,2, d))) | upcase(wd(8,2, sci(d))) | wd(8,2, hex(d)) | upcase(wd(8,2, hex(d))) | wd(8,2, sci(d));
     89        sout | 0.0 | wd(8, 3.0) | d | wd(8, d) | nodp(wd(8,0, d)) | wd(8,0, d) | wd(8,2, d) | nonl;
     90        sout | left(wd(8,2, d)) | left(sign(wd(8,2, d))) | pad0(upcase(wd(8,2, d))) | upcase(wd(8,2, sci(d))) | wd(8,2, hex(d)) | upcase(wd(8,2, hex(d))) | wd(8,2, sci(d));
    7191
    7292        sout | "long double";
     
    7494        printf( "%Lg  %#8Lf %Lg %8Lf %#8.0Lf %8.0Lf %8.2Lf %-8.2Lf %-+#8.2Lf %08.2LF %8.2LE %8.2La %8.2LA %8.2Le\n",
    7595                        0.0L,  3.0L, ld,  ld,     ld,    ld,    ld,     ld,       ld,     ld,    ld,    ld,    ld,    ld );
    76         sout | 0.0L | wd(8, 3.0L) | ld | wd(8, ld) | nodp(wd(8,0, ld)) | wd(8,0, ld) | wd(8,2, ld) | left(wd(8,2, ld)) | left(sign(wd(8,2, ld))) | pad0(upcase(wd(8,2, ld))) | upcase(wd(8,2, sci(ld))) | wd(8,2, hex(ld)) | upcase(wd(8,2, hex(ld))) | wd(8,2, sci(ld));
     96        sout | 0.0L | wd(8, 3.0L) | ld | wd(8, ld) | nodp(wd(8,0, ld)) | wd(8,0, ld) | wd(8,2, ld) | nonl;
     97        sout | left(wd(8,2, ld)) | left(sign(wd(8,2, ld))) | pad0(upcase(wd(8,2, ld))) | upcase(wd(8,2, sci(ld))) | wd(8,2, hex(ld)) | upcase(wd(8,2, hex(ld))) | wd(8,2, sci(ld));
    7798
    7899
     
    80101        char c = 'a';
    81102        printf( "%c %2c %5c %-5c %hho %#hho %hhx %#hhx %#8hhx %#8hhX %-8c %8c\n", c, c, c, c, c, c, c, c, c, c, c, c );
    82         sout | c | ' ' | wd(2,c) | wd(5,c) | left(wd(5,c)) | nobase(oct(c)) | oct(c) | nobase(hex(c)) | hex(c) | wd(8,hex(c)) | upcase(wd(8,hex(c))) | left(wd(8,c)) | wd(8,c);
     103        sout | c | ' ' | wd(2,c) | wd(5,c) | left(wd(5,c)) | nobase(oct(c)) | oct(c) | nonl;
     104        sout | nobase(hex(c)) | hex(c) | wd(8,hex(c)) | upcase(wd(8,hex(c))) | left(wd(8,c)) | wd(8,c);
    83105
    84106        sout | nl | "string";
  • tests/pybin/settings.py

    rb7d6a36 r6a490b2  
    2323class Architecture:
    2424        KnownArchitectures = {
    25                 'x64'           : 'x64',
    26                 'x86-64'        : 'x64',
    27                 'x86_64'        : 'x64',
    28                 'x86'           : 'x86',
    29                 'aarch64'       : 'arm',
    30                 'i386'          : 'x86',
    31                 'i486'          : 'x86',
    32                 'i686'          : 'x86',
    33                 'Intel 80386'   : 'x86',
    34                 'arm'           : 'arm',
    35                 'ARM'           : 'arm',
     25                'x64'         : 'x64',
     26                'x86-64'      : 'x64',
     27                'x86_64'      : 'x64',
     28                'x86'         : 'x86',
     29                'aarch64'     : 'arm',
     30                'i386'        : 'x86',
     31                'i486'        : 'x86',
     32                'i686'        : 'x86',
     33                'Intel 80386' : 'x86',
     34                'arm'         : 'arm',
     35                'ARM'         : 'arm',
    3636        }
    3737
     
    7777                        print("updated to %s" % self.target)
    7878
    79         def match(self, arch):
     79        def filter(self, tests):
     80                return [test for test in tests if not test.arch or self.target == test.arch]
    8081                return True if not arch else self.target == arch
    8182
    82         @classmethod
    83         def make_canonical(_, arch):
     83        @staticmethod
     84        def make_canonical(arch):
    8485                return Architecture.KnownArchitectures[arch]
    8586
     
    104105                self.total  = Timeouts.check(tg)
    105106
    106         @classmethod
    107         def check(_, value):
     107        @staticmethod
     108        def check(value):
    108109                if value < 1:
    109110                        print("Timeouts must be at least 1 second", file=sys.stderr)
     
    113114
    114115def init( options ):
     116        global all_arch
     117        global all_debug
     118        global all_install
    115119        global arch
    116120        global archive
     121        global continue_
    117122        global debug
    118         global distcc
    119123        global dry_run
    120124        global generating
     
    123127        global output_width
    124128        global timeout
     129        global timeout2gdb
    125130
    126         arch         = Architecture(options.arch)
     131        all_arch     = [Architecture(o) for o in list(dict.fromkeys(options.arch   ))] if options.arch else [Architecture(None)]
     132        all_debug    = [Debug(o)        for o in list(dict.fromkeys(options.debug  ))]
     133        all_install  = [Install(o)      for o in list(dict.fromkeys(options.install))]
    127134        archive      = os.path.abspath(os.path.join(original_path, options.archive_errors)) if options.archive_errors else None
    128         debug        = Debug(options.debug)
     135        continue_    = options.continue_
    129136        dry_run      = options.dry_run # must be called before tools.config_hash()
    130         distcc       = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()
    131137        generating   = options.regenerate_expected
    132         install      = Install(options.install)
    133138        make         = ['make']
    134139        output_width = 24
    135140        timeout      = Timeouts(options.timeout, options.global_timeout)
     141        timeout2gdb  = options.timeout_with_gdb
    136142
    137143        # if we distribute, distcc errors will fail tests, use log file for distcc
     
    146152
    147153def validate():
     154        """Validate the current configuration and update globals"""
     155
     156        global distcc
     157        distcc       = "DISTCC_CFA_PATH=~/.cfadistcc/%s/cfa" % tools.config_hash()
    148158        errf = os.path.join(BUILDDIR, ".validate.err")
    149159        make_ret, out = tools.make( ".validate", error_file = errf, output_file=subprocess.DEVNULL, error=subprocess.DEVNULL )
  • tests/pybin/test_run.py

    rb7d6a36 r6a490b2  
    4040                return os.path.normpath( os.path.join(settings.BUILDDIR, self.path, self.name) )
    4141
    42         @classmethod
    43         def valid_name(_, name):
     42        @staticmethod
     43        def valid_name(name):
    4444                return not name.endswith( ('.c', '.cc', '.cpp', '.cfa') )
    4545
    46         @classmethod
    47         def from_target(_, target):
     46        @staticmethod
     47        def new_target(target, arch):
    4848                test = Test()
    4949                test.name = os.path.basename(target)
    5050                test.path = os.path.relpath (os.path.dirname(target), settings.SRCDIR)
    51                 test.arch = settings.arch.target if settings.arch.cross_compile else ''
     51                test.arch = arch.target if arch else ''
    5252                return test
    5353
     
    7272                return text
    7373
    74         @classmethod
    75         def fmtDur( cls, duration ):
     74        @staticmethod
     75        def fmtDur( duration ):
    7676                if duration :
    7777                        hours, rem = divmod(duration, 3600)
  • tests/pybin/tools.py

    rb7d6a36 r6a490b2  
    7575                                        return proc.returncode, out.decode("utf-8") if out else None
    7676                                except subprocess.TimeoutExpired:
    77                                         proc.send_signal(signal.SIGABRT)
    78                                         proc.communicate()
    79                                         return 124, str(None)
     77                                        if settings.timeout2gdb:
     78                                                print("Process {} timeout".format(proc.pid))
     79                                                proc.communicate()
     80                                                return 124, str(None)
     81                                        else:
     82                                                proc.send_signal(signal.SIGABRT)
     83                                                proc.communicate()
     84                                                return 124, str(None)
    8085
    8186        except Exception as ex:
     
    322327        raise argparse.ArgumentTypeError(msg)
    323328
     329# Convert a function that converts a string to one that converts comma separated string.
     330def comma_separated(elements):
     331    return lambda string: [elements(part) for part in string.split(',')]
     332
    324333def fancy_print(text):
    325334        column = which('column')
  • tests/test.py

    rb7d6a36 r6a490b2  
    66
    77import argparse
     8import itertools
    89import re
    910import sys
     
    2930                        test.path = match.group(1)
    3031                        test.arch = match.group(3)[1:] if match.group(3) else None
    31                         if settings.arch.match(test.arch):
    32                                 expected.append(test)
     32                        expected.append(test)
    3333
    3434        path_walk( match_test )
     
    5353                ]
    5454
     55        # sort the test alphabetically for convenience
     56        test_list.sort(key=lambda t: ('~' if t.arch else '') + t.target() + (t.arch if t.arch else ''))
     57
    5558        return test_list
    5659
     
    6467                for testname in options.tests :
    6568                        testname = canonical_path( testname )
     69                        # first check if this is a valid name to regenerate
    6670                        if Test.valid_name(testname):
     71                                # this is a valid name, let's check if it already exists
    6772                                found = [test for test in all_tests if canonical_path( test.target() ) == testname]
    68                                 tests.append( found[0] if len(found) == 1 else Test.from_target(testname) )
     73                                if not found:
     74                                        # it's a new name, create it according to the name and specified architecture
     75                                        if options.arch:
     76                                                # user specified one or multiple architectures, assume the tests will have architecture specific results
     77                                                tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
     78                                        else:
     79                                                # user didn't specify an architecture, just create a cross platform test
     80                                                tests.append( Test.new_target( testname, None ) )
     81                                elif len(found) == 1 and not found[0].arch:
     82                                        # we found a single test, the user better be wanting to create a cross platform test
     83                                        if options.arch:
     84                                                print('ERROR: "%s", test has no specified architecture but --arch was specified, ignoring it' % testname, file=sys.stderr)
     85                                        else:
     86                                                tests.append( found[0] )
     87                                else:
     88                                        # this test is already cross platform, just add a test for each platform the user asked
     89                                        tests.extend( [Test.new_target(testname, arch) for arch in settings.all_arch] )
     90
     91                                        # print a warning if it users didn't ask for a specific architecture
     92                                        if not options.arch:
     93                                                print('WARNING: "%s", test has architecture specific expected files but --arch was not specified, regenerating only for current host' % testname, file=sys.stderr)
     94
    6995                        else :
    7096                                print('ERROR: "%s", tests are not allowed to end with a C/C++/CFA extension, ignoring it' % testname, file=sys.stderr)
     
    76102
    77103                        if test :
    78                                 tests.append( test[0] )
     104                                tests.extend( test )
    79105                        else :
    80106                                print('ERROR: No expected file for test %s, ignoring it' % testname, file=sys.stderr)
     
    86112        # create a parser with the arguments for the tests script
    87113        parser = argparse.ArgumentParser(description='Script which runs cforall tests')
    88         parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='yes')
    89         parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=yes_no, default='no')
    90         parser.add_argument('--arch', help='Test for specific architecture', type=str, default='')
     114        parser.add_argument('--debug', help='Run all tests in debug or release', type=comma_separated(yes_no), default='yes')
     115        parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=comma_separated(yes_no), default='no')
     116        parser.add_argument('--arch', help='Test for specific architecture', type=comma_separated(str), default=None)
     117        parser.add_argument('--continue', help='When multiple specifications are passed (debug/install/arch), sets whether or not to continue if the last specification failed', type=yes_no, default='yes', dest='continue_')
    91118        parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60)
    92119        parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200)
     120        parser.add_argument('--timeout-with-gdb', help='Instead of killing the command when it times out, orphan it and print process id to allow gdb to attach', type=yes_no, default="no")
    93121        parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
    94122        parser.add_argument('--list', help='List all test available', action='store_true')
     
    178206
    179207                else:
    180                         with open (out_file, "r") as myfile:
    181                                 error = myfile.read()
     208                        if os.stat(out_file).st_size < 1048576:
     209                                with open (out_file, "r") as myfile:
     210                                        error = myfile.read()
     211                        else:
     212                                error = "Output log can't be read, file is bigger than 1MB, see {} for actual error\n".format(out_file)
    182213
    183214                        ret, info = core_info(exe_file)
     
    215246                return False, ""
    216247        except Exception as ex:
    217                 print("Unexpected error in worker thread: %s" % ex, file=sys.stderr)
     248                print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
    218249                sys.stderr.flush()
    219250                return False, ""
     
    278309        make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
    279310
    280         return 1 if failed else 0
     311        return failed
    281312
    282313
     
    292323        settings.init( options )
    293324
    294         # fetch the liest of all valid tests
    295         all_tests = list_tests( options.include, options.exclude )
    296 
    297 
    298         # if user wants all tests than no other treatement of the test list is required
    299         if options.all or options.list or options.list_comp or options.include :
    300                 tests = all_tests
    301 
    302         #otherwise we need to validate that the test list that was entered is valid
    303         else :
    304                 tests = valid_tests( options )
    305 
    306         # make sure we have at least some test to run
    307         if not tests :
    308                 print('ERROR: No valid test to run', file=sys.stderr)
    309                 sys.exit(1)
    310 
    311 
    312         # sort the test alphabetically for convenience
    313         tests.sort(key=lambda t: (t.arch if t.arch else '') + t.target())
    314 
    315325        # users may want to simply list the tests
    316326        if options.list_comp :
    317                 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout -j --jobs ", end='')
     327                # fetch the liest of all valid tests
     328                tests = list_tests( None, None )
     329
     330                # print the possible options
     331                print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --archive-errors --install --timeout --global-timeout --timeout-with-gdb -j --jobs -I --include -E --exclude --continue ", end='')
    318332                print(" ".join(map(lambda t: "%s" % (t.target()), tests)))
    319333
    320334        elif options.list :
    321                 print("Listing for %s:%s"% (settings.arch.string, settings.debug.string))
     335                # fetch the liest of all valid tests
     336                tests = list_tests( options.include, options.exclude )
     337
     338                # print the available tests
    322339                fancy_print("\n".join(map(lambda t: t.toString(), tests)))
    323340
    324341        else :
    325                 # check the build configuration works
     342                # fetch the liest of all valid tests
     343                all_tests = list_tests( options.include, options.exclude )
     344
     345                # if user wants all tests than no other treatement of the test list is required
     346                if options.all or options.include :
     347                        tests = all_tests
     348
     349                #otherwise we need to validate that the test list that was entered is valid
     350                else :
     351                        tests = valid_tests( options )
     352
     353                # make sure we have at least some test to run
     354                if not tests :
     355                        print('ERROR: No valid test to run', file=sys.stderr)
     356                        sys.exit(1)
     357
     358                # prep invariants
    326359                settings.prep_output(tests)
    327                 settings.validate()
    328 
    329                 options.jobs, forceJobs = job_count( options, tests )
    330                 settings.update_make_cmd(forceJobs, options.jobs)
    331 
    332                 print('%s %i tests on %i cores (%s:%s)' % (
    333                         'Regenerating' if settings.generating else 'Running',
    334                         len(tests),
    335                         options.jobs,
    336                         settings.arch.string,
    337                         settings.debug.string
    338                 ))
    339 
    340                 # otherwise run all tests and make sure to return the correct error code
    341                 sys.exit( run_tests(tests, options.jobs) )
     360                failed = 0
     361
     362                # for each build configurations, run the test
     363                for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install):
     364                        settings.arch    = arch
     365                        settings.debug   = debug
     366                        settings.install = install
     367
     368                        # filter out the tests for a different architecture
     369                        # tests are the same across debug/install
     370                        local_tests = settings.arch.filter( tests )
     371                        options.jobs, forceJobs = job_count( options, local_tests )
     372                        settings.update_make_cmd(forceJobs, options.jobs)
     373
     374                        # check the build configuration works
     375                        settings.validate()
     376
     377                        # print configuration
     378                        print('%s %i tests on %i cores (%s:%s)' % (
     379                                'Regenerating' if settings.generating else 'Running',
     380                                len(local_tests),
     381                                options.jobs,
     382                                settings.arch.string,
     383                                settings.debug.string
     384                        ))
     385
     386                        # otherwise run all tests and make sure to return the correct error code
     387                        failed = run_tests(local_tests, options.jobs)
     388                        if failed:
     389                                result = 1
     390                                if not settings.continue_:
     391                                        break
     392
     393
     394                sys.exit( failed )
  • tests/vector.cfa

    rb7d6a36 r6a490b2  
    1414//
    1515
     16#include <vector.hfa>
    1617#include <fstream.hfa>
    17 #include <vector.hfa>
    1818
    1919#undef assert
     
    2828int main() {
    2929        vector( int ) iv;
     30
     31        assert( ((uintptr_t)&iv.storage.storage ) == (((uintptr_t)&iv)) );
     32        assert( ((uintptr_t)&iv.storage.capacity) == (((uintptr_t)&iv) + sizeof(void *)) );
     33        assert( ((uintptr_t)&iv.size            ) == (((uintptr_t)&iv) + sizeof(void *) + sizeof(size_t)) );
    3034
    3135        assert( empty( &iv ) );
Note: See TracChangeset for help on using the changeset viewer.