Changeset 83b52f1 for tests


Ignore:
Timestamp:
Jul 24, 2019, 10:40:28 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
77d2432, 96ac72c0
Parents:
6130304 (diff), 8fc15cf (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
tests
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • tests/.expect/copyfile.txt

    r6130304 r83b52f1  
    1010// Created On       : Tue Jul 16 16:47:22 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 16 16:48:16 2019
    13 // Update Count     : 1
     12// Last Modified On : Wed Jul 17 18:04:44 2019
     13// Update Count     : 26
    1414//
    1515
    1616#include <fstream.hfa>
     17#include <stdlib.hfa>                                                                   // new/delete
    1718
    1819int main( int argc, char * argv[] ) {
    19     ifstream & in  = stdin;                             // default files
    20     ofstream & out = stdout;
    21     try {
    22         choose ( argc ) {
    23           case 2, 3:
    24             open( in, argv[1] );                        // open input file first as output creates file
    25             if ( argc == 3 ) open( out, argv[2] );      // only open output if input opens as output created if nonexistent
    26           case 1: ;                                     // use default files
    27           default:
    28             exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]";
    29         } // choose
     20        ifstream * in  = &stdin;                                                        // default files
     21        ofstream * out = &stdout;
     22        try {
     23                choose ( argc ) {
     24                  case 2, 3:
     25                          in = new( (const char *)argv[1] );            // open input file first as output creates file
     26                          if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent
     27                  case 1: ;                                     // use default files
     28                  default:
     29                          exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]";
     30                } // choose
    3031
    31         char ch;
    32         out | nlOff;                                    // turn off auto newline
    33         in  | nlOn;                                     // turn on reading newline
     32                char ch;
     33                *out | nlOff;                                                                   // turn off auto newline
     34                *in  | nlOn;                                                                    // turn on reading newline
    3435
    35         for () {                                        // read all characters
    36             in | ch;
    37           if ( eof( in ) ) break;                       // eof ?
    38             out | ch;
    39         } // for
    40     } finally {
    41         close( in );                                    // stdin, stdout are never closed
    42         close( out );
    43     } // try
     36                for () {                                                                                // read all characters
     37                        *in | ch;
     38                  if ( eof( *in ) ) break;                                              // eof ?
     39                        *out | ch;
     40                } // for
     41        } finally {
     42                if ( in  != &stdin  ) delete( in );                             // close file, do not delete stdin!
     43                if ( out != &stdout ) delete( out );                    // close file, do not delete stdout!
     44        } // try
    4445} // main
    4546
  • tests/.in/copyfile.txt

    r6130304 r83b52f1  
    1010// Created On       : Tue Jul 16 16:47:22 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 16 16:48:16 2019
    13 // Update Count     : 1
     12// Last Modified On : Wed Jul 17 18:04:44 2019
     13// Update Count     : 26
    1414//
    1515
    1616#include <fstream.hfa>
     17#include <stdlib.hfa>                                                                   // new/delete
    1718
    1819int main( int argc, char * argv[] ) {
    19     ifstream & in  = stdin;                             // default files
    20     ofstream & out = stdout;
    21     try {
    22         choose ( argc ) {
    23           case 2, 3:
    24             open( in, argv[1] );                        // open input file first as output creates file
    25             if ( argc == 3 ) open( out, argv[2] );      // only open output if input opens as output created if nonexistent
    26           case 1: ;                                     // use default files
    27           default:
    28             exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]";
    29         } // choose
     20        ifstream * in  = &stdin;                                                        // default files
     21        ofstream * out = &stdout;
     22        try {
     23                choose ( argc ) {
     24                  case 2, 3:
     25                          in = new( (const char *)argv[1] );            // open input file first as output creates file
     26                          if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent
     27                  case 1: ;                                     // use default files
     28                  default:
     29                          exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]";
     30                } // choose
    3031
    31         char ch;
    32         out | nlOff;                                    // turn off auto newline
    33         in  | nlOn;                                     // turn on reading newline
     32                char ch;
     33                *out | nlOff;                                                                   // turn off auto newline
     34                *in  | nlOn;                                                                    // turn on reading newline
    3435
    35         for () {                                        // read all characters
    36             in | ch;
    37           if ( eof( in ) ) break;                       // eof ?
    38             out | ch;
    39         } // for
    40     } finally {
    41         close( in );                                    // stdin, stdout are never closed
    42         close( out );
    43     } // try
     36                for () {                                                                                // read all characters
     37                        *in | ch;
     38                  if ( eof( *in ) ) break;                                              // eof ?
     39                        *out | ch;
     40                } // for
     41        } finally {
     42                if ( in  != &stdin  ) delete( in );                             // close file, do not delete stdin!
     43                if ( out != &stdout ) delete( out );                    // close file, do not delete stdout!
     44        } // try
    4445} // main
    4546
  • tests/copyfile.cfa

    r6130304 r83b52f1  
    1010// Created On       : Tue Jul 16 16:47:22 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 16 16:48:16 2019
    13 // Update Count     : 1
     12// Last Modified On : Wed Jul 17 18:04:44 2019
     13// Update Count     : 26
    1414//
    1515
    1616#include <fstream.hfa>
     17#include <stdlib.hfa>                                                                   // new/delete
    1718
    1819int main( int argc, char * argv[] ) {
    19     ifstream & in  = stdin;                             // default files
    20     ofstream & out = stdout;
    21     try {
    22         choose ( argc ) {
    23           case 2, 3:
    24             open( in, argv[1] );                        // open input file first as output creates file
    25             if ( argc == 3 ) open( out, argv[2] );      // only open output if input opens as output created if nonexistent
    26           case 1: ;                                     // use default files
    27           default:
    28             exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]";
    29         } // choose
     20        ifstream * in  = &stdin;                                                        // default files
     21        ofstream * out = &stdout;
     22        try {
     23                choose ( argc ) {
     24                  case 2, 3:
     25                          in = new( (const char *)argv[1] );            // open input file first as output creates file
     26                          if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent
     27                  case 1: ;                                     // use default files
     28                  default:
     29                          exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]";
     30                } // choose
    3031
    31         char ch;
    32         out | nlOff;                                    // turn off auto newline
    33         in  | nlOn;                                     // turn on reading newline
     32                char ch;
     33                *out | nlOff;                                                                   // turn off auto newline
     34                *in  | nlOn;                                                                    // turn on reading newline
    3435
    35         for () {                                        // read all characters
    36             in | ch;
    37           if ( eof( in ) ) break;                       // eof ?
    38             out | ch;
    39         } // for
    40     } finally {
    41         close( in );                                    // stdin, stdout are never closed
    42         close( out );
    43     } // try
     36                for () {                                                                                // read all characters
     37                        *in | ch;
     38                  if ( eof( *in ) ) break;                                              // eof ?
     39                        *out | ch;
     40                } // for
     41        } finally {
     42                if ( in  != &stdin  ) delete( in );                             // close file, do not delete stdin!
     43                if ( out != &stdout ) delete( out );                    // close file, do not delete stdout!
     44        } // try
    4445} // main
    4546
  • tests/heap.cfa

    r6130304 r83b52f1  
    1010// Created On       : Tue Nov  6 17:54:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 11 21:52:40 2018
    13 // Update Count     : 18
     12// Last Modified On : Fri Jul 19 08:22:34 2019
     13// Update Count     : 19
    1414//
    1515
     
    2929#define __U_DEFAULT_MMAP_START__ (512 * 1024 + 1)
    3030size_t default_mmap_start() __attribute__(( weak )) {
    31     return __U_DEFAULT_MMAP_START__;
     31        return __U_DEFAULT_MMAP_START__;
    3232} // default_mmap_start
    3333
     
    3636
    3737void main( Worker & ) {
    38     enum { NoOfAllocs = 5000, NoOfMmaps = 10 };
    39     char * locns[NoOfAllocs];
    40     int i;
    41 
    42     // check alloc/free
    43 
    44     for ( j; 40 ) {
     38        enum { NoOfAllocs = 5000, NoOfMmaps = 10 };
     39        char * locns[NoOfAllocs];
     40        int i;
     41
     42        // check alloc/free
     43
     44        for ( j; 40 ) {
    4545                for ( i; NoOfAllocs ) {
    4646                        locns[i] = alloc( i );
     
    6767                        free( locns[i] );
    6868                } // for
    69     } // for
    70 
    71     // check malloc/free (sbrk)
    72 
    73     for ( i; NoOfAllocs ) {
     69        } // for
     70
     71        // check malloc/free (sbrk)
     72
     73        for ( i; NoOfAllocs ) {
    7474                size_t s = (i + 1) * 20;
    7575                char * area = (char *)malloc( s );
     
    7878                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
    7979                free( area );
    80     } // for
    81 
    82     for ( i; NoOfAllocs ) {
     80        } // for
     81
     82        for ( i; NoOfAllocs ) {
    8383                size_t s = i + 1;                                                               // +1 to make initialization simpler
    8484                locns[i] = (char *)malloc( s );
     
    8686                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    8787                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
    88     } // for
    89     for ( i; NoOfAllocs ) {
     88        } // for
     89        for ( i; NoOfAllocs ) {
    9090                size_t s = i + 1;
    9191                if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' ||
    9292                         locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "malloc/free corrupt storage" );
    9393                free( locns[i] );
    94     } // for
    95 
    96     // check malloc/free (mmap)
    97 
    98     for ( i; NoOfMmaps ) {
     94        } // for
     95
     96        // check malloc/free (mmap)
     97
     98        for ( i; NoOfMmaps ) {
    9999                size_t s = i + default_mmap_start();                    // cross over point
    100100                char * area = (char *)malloc( s );
     
    103103                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
    104104                free( area );
    105     } // for
    106 
    107     for ( i; NoOfMmaps ) {
     105        } // for
     106
     107        for ( i; NoOfMmaps ) {
    108108                size_t s = i + default_mmap_start();                    // cross over point
    109109                locns[i] = (char *)malloc( s );
     
    111111                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    112112                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
    113     } // for
    114     for ( i; NoOfMmaps ) {
     113        } // for
     114        for ( i; NoOfMmaps ) {
    115115                size_t s = i + default_mmap_start();                    // cross over point
    116116                if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' ||
    117117                         locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "malloc/free corrupt storage" );
    118118                free( locns[i] );
    119     } // for
    120 
    121     // check calloc/free (sbrk)
    122 
    123     for ( i; NoOfAllocs ) {
     119        } // for
     120
     121        // check calloc/free (sbrk)
     122
     123        for ( i; NoOfAllocs ) {
    124124                size_t s = (i + 1) * 20;
    125125                char * area = (char *)calloc( 5, s );
     
    131131                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
    132132                free( area );
    133     } // for
    134 
    135     for ( i; NoOfAllocs ) {
     133        } // for
     134
     135        for ( i; NoOfAllocs ) {
    136136                size_t s = i + 1;
    137137                locns[i] = (char *)calloc( 5, s );
     
    142142                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    143143                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
    144     } // for
    145     for ( i; NoOfAllocs ) {
     144        } // for
     145        for ( i; NoOfAllocs ) {
    146146                size_t s = i + 1;
    147147                if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' ||
    148148                         locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "calloc/free corrupt storage3" );
    149149                free( locns[i] );
    150     } // for
    151 
    152     // check calloc/free (mmap)
    153 
    154     for ( i; NoOfMmaps ) {
     150        } // for
     151
     152        // check calloc/free (mmap)
     153
     154        for ( i; NoOfMmaps ) {
    155155                size_t s = i + default_mmap_start();                    // cross over point
    156156                char * area = (char *)calloc( 1, s );
     
    162162                area[malloc_usable_size( area ) - 1] = '\345';  // fill ultimate byte
    163163                free( area );
    164     } // for
    165 
    166     for ( i; NoOfMmaps ) {
     164        } // for
     165
     166        for ( i; NoOfMmaps ) {
    167167                size_t s = i + default_mmap_start();                    // cross over point
    168168                locns[i] = (char *)calloc( 1, s );
     
    173173                locns[i][0] = '\345'; locns[i][s - 1] = '\345'; // fill first/last
    174174                locns[i][malloc_usable_size( locns[i] ) - 1] = '\345'; // fill ultimate byte
    175     } // for
    176     for ( i; NoOfMmaps ) {
     175        } // for
     176        for ( i; NoOfMmaps ) {
    177177                size_t s = i + default_mmap_start();                    // cross over point
    178178                if ( locns[i][0] != '\345' || locns[i][s - 1] != '\345' ||
    179179                         locns[i][malloc_usable_size( locns[i] ) - 1] != '\345' ) abort( "calloc/free corrupt storage6" );
    180180                free( locns[i] );
    181     } // for
    182 
    183     // check memalign/free (sbrk)
    184 
    185     enum { limit = 64 * 1024 };                                                 // check alignments up to here
     181        } // for
     182
     183        // check memalign/free (sbrk)
     184
     185        enum { limit = 64 * 1024 };                                                     // check alignments up to here
    186186
    187187        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
     
    198198                        free( area );
    199199                } // for
    200     } // for
    201 
    202     // check memalign/free (mmap)
     200        } // for
     201
     202        // check memalign/free (mmap)
    203203
    204204        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
     
    216216                        free( area );
    217217                } // for
    218     } // for
    219 
    220     // check calloc/realloc/free (sbrk)
    221 
    222     for ( i; 1 ~ 10_000 ~ 12 ) {
     218        } // for
     219
     220        // check calloc/realloc/free (sbrk)
     221
     222        for ( i; 1 ~ 10_000 ~ 12 ) {
    223223                // initial N byte allocation
    224224                char * area = (char *)calloc( 5, i );
     
    237237                } // for
    238238                free( area );
    239     } // for
    240 
    241     // check calloc/realloc/free (mmap)
    242 
    243     for ( i; 1 ~ 10_000 ~ 12 ) {
     239        } // for
     240
     241        // check calloc/realloc/free (mmap)
     242
     243        for ( i; 1 ~ 10_000 ~ 12 ) {
    244244                // initial N byte allocation
    245245                size_t s = i + default_mmap_start();                    // cross over point
     
    259259                } // for
    260260                free( area );
    261     } // for
    262 
    263     // check memalign/realloc/free
    264 
    265     size_t amount = 2;
     261        } // for
     262
     263        // check memalign/realloc/free
     264
     265        size_t amount = 2;
    266266        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    267267                // initial N byte allocation
     
    286286                } // for
    287287                free( area );
    288     } // for
    289 
    290     // check cmemalign/free
     288        } // for
     289
     290        // check cmemalign/free
    291291
    292292        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
     
    305305                        free( area );
    306306                } // for
    307     } // for
    308 
    309     // check cmemalign/realloc/free
    310 
    311     amount = 2;
     307        } // for
     308
     309        // check cmemalign/realloc/free
     310
     311        amount = 2;
    312312        for ( a; libAlign() ~= limit ~ a ) {                            // generate powers of 2
    313313                // initial N byte allocation
     
    338338                } // for
    339339                free( area );
    340     } // for
     340        } // for
    341341        //sout | "worker" | thisTask() | "successful completion";
    342342} // Worker main
    343343
    344344int main() {
    345     const unsigned int NoOfWorkers = 4;
    346     {
     345        const unsigned int NoOfWorkers = 4;
     346        {
    347347                processor processors[NoOfWorkers - 1] __attribute__(( unused )); // more than one processor
    348348                Worker workers[NoOfWorkers] __attribute__(( unused ));
    349     }
     349        }
    350350        // checkFreeOn();
    351     // malloc_stats();
     351        // malloc_stats();
    352352}
    353353
Note: See TracChangeset for help on using the changeset viewer.