Changeset cca034e for tests


Ignore:
Timestamp:
Jan 9, 2023, 4:10:32 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
ADT, ast-experimental, master
Children:
73e3a8f9
Parents:
5c931e0
Message:

added another channel test and refactored the existing one to reuse code

Location:
tests/concurrent/channels
Files:
3 added
1 moved

Legend:

Unmodified
Added
Removed
  • tests/concurrent/channels/parallel_harness.cfa

    r5c931e0 rcca034e  
    77#include <time.hfa>
    88#include <stats.hfa>
    9 size_t Processors = 10, Channels = 10, Producers = 40, Consumers = 40, ChannelSize = 128;
     9
     10// user defines this
     11// #define BIG 1
    1012
    1113owner_lock o;
    1214
    1315unsigned long long total_operations = 0;
    14 
    15 #define BIG 1
    1616
    1717struct bigObject {
     
    3232typedef channel( bigObject ) Channel;
    3333#else
    34 typedef channel Channel;
     34typedef channel( size_t ) Channel;
    3535#endif
    3636
     
    9999
    100100
    101 int main( int argc, char *argv[] ) {
    102     switch( argc ) {
    103       case 6:
    104                 if ( strcmp( argv[5], "d" ) != 0 ) {                    // default ?
    105                         if ( atoi( argv[5] ) < 1) goto Usage;
    106                         ChannelSize = atoi( argv[5] );
    107                 } // if
    108       case 5:
    109                 if ( strcmp( argv[4], "d" ) != 0 ) {                    // default ?
    110                         if ( atoi( argv[4] ) < 1 ) goto Usage;
    111                         Channels = atoi( argv[4] );
    112                 } // if
    113       case 4:
    114                 if ( strcmp( argv[3], "d" ) != 0 ) {                    // default ?
    115                         if ( atoi( argv[3] ) < 1 ) goto Usage;
    116                         Consumers = atoi( argv[3] );
    117                 } // if
    118       case 3:
    119                 if ( strcmp( argv[2], "d" ) != 0 ) {                    // default ?
    120                         if ( atoi( argv[2] ) < 1 ) goto Usage;
    121                         Producers = atoi( argv[2] );
    122                 } // if
    123       case 2:
    124                 if ( strcmp( argv[1], "d" ) != 0 ) {                    // default ?
    125                         if ( atoi( argv[1] ) < 1 ) goto Usage;
    126                         Processors = atoi( argv[1] );
    127                 } // if
    128           case 1:                                                                                       // use defaults
    129                 break;
    130           default:
    131           Usage:
    132                 sout | "Usage: " | argv[0]
    133              | " [ processors > 0 | d ]"
    134              | " [ ProdsPerChan > 0 | d ]"
    135              | " [ ConsPerChan > 0 | d ]"
    136              | " [ channels > 0 | d ]";
    137                 exit( EXIT_FAILURE );
    138     }
    139 
     101int test( size_t Processors, size_t Channels, size_t Producers, size_t Consumers, size_t ChannelSize ) {
    140102    size_t Clusters = 1;
    141103    // create a cluster
Note: See TracChangeset for help on using the changeset viewer.