Changeset 3a32b3a for tests


Ignore:
Timestamp:
Jul 10, 2020, 11:42:41 AM (4 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:
20ab637, 2fc94ced, fb98462
Parents:
732b406 (diff), 49cad912 (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:
25 added
7 edited

Legend:

Unmodified
Added
Removed
  • tests/copyfile.cfa

    r732b406 r3a32b3a  
    1010// Created On       : Fri Jun 19 13:44:05 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 19 17:58:03 2020
    13 // Update Count     : 4
     12// Last Modified On : Sun Jul  5 11:27:43 2020
     13// Update Count     : 5
    1414//
    1515
     
    2222
    2323        try {
    24                 choose ( argc ) {
     24                choose ( argc ) {                                                               // terminate if command-line errors
    2525                  case 2, 3:
    2626                        open( in, argv[1] );                                            // open input file first as output creates file
    2727                        if ( argc == 3 ) open( out, argv[2] );          // do not create output unless input opens
    2828                  case 1: ;                                                                             // use default files
    29                   default:
     29                  default:                                                                              // wrong number of options
    3030                        exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
    3131                } // choose
  • tests/exceptions/.expect/defaults.txt

    r732b406 r3a32b3a  
    33jump default handler.
    44Catch unhandled_exception.
     5cross terminate throw
     6cross terminate default
     7cross terminate catch
     8cross resume throw
     9cross resume default
     10cross resume catch
  • tests/exceptions/defaults.cfa

    r732b406 r3a32b3a  
    3030                throwResume (log_message){(char *)"Should be printed.\n"};
    3131        } catchResume (log_message * this) {
    32                 printf(this->virtual_table->msg(this));
     32                printf("%s", this->virtual_table->msg(this));
    3333        }
    3434        // But we don't have to:
     
    6969}
    7070
     71TRIVIAL_EXCEPTION(second);
     72
     73void cross_test(void) {
     74        void defaultTerminationHandler(first &) {
     75                printf("cross terminate default\n");
     76                throw (second){};
     77        }
     78        void defaultResumptionHandler(first &) {
     79                printf("cross resume default\n");
     80                throwResume (second){};
     81        }
     82        try {
     83                printf("cross terminate throw\n");
     84                throw (first){};
     85        } catch (second *) {
     86                printf("cross terminate catch\n");
     87        }
     88        try {
     89                printf("cross resume throw\n");
     90                throwResume (first){};
     91        } catchResume (second *) {
     92                printf("cross resume catch\n");
     93        }
     94}
     95
    7196int main(int argc, char * argv[]) {
    7297        log_test();
    7398        jump_test();
    7499        unhandled_test();
     100        cross_test();
    75101}
  • tests/manipulatorsOutput3.cfa

    r732b406 r3a32b3a  
    1313    sout | sign(x);
    1414    sout | nl;
    15 #if 1
     15
    1616    sout | bin(x);
    1717    sout | upcase(bin(x));
     
    124124    sout | nl;
    125125
    126    
     126
     127    // extras
     128    sout | "extras";
    127129    sout | bin(divisor);
    128130    sout | upcase(bin(divisor));
     
    140142    sout | left(sign(wd(0,40, divisor))) | 'X';
    141143    printf( "%-+1.40dX\n", 123456789 );
    142 #endif // 0
     144
     145    int128 i128;
     146    unsigned int128 ui128;
     147
     148    i128 = -10;
     149    for ( 25 ) {
     150        sout | left( sign( wd( 20, i128 ) ) ) | left( wd( 20, hex( i128 ) ) ) | left( wd( 20, oct( i128 ) ) );
     151        sout | left( wd( 20, bin( i128 ) ) );
     152        i128 += 1;
     153    }
     154    sout | nl;
     155
     156    i128 = 0x7fffffffffffffff;
     157    i128 <<= 64;
     158    i128 += 0xfffffffffffffffa;
     159
     160    for ( 20 ) {
     161        sout | i128;
     162        sout | left( sign( wd( 45, i128 ) ) ) | left( wd( 45, hex( i128 ) ) ) | left( wd( 45, oct( i128 ) ) );
     163        sout | left( wd( 45, bin( i128 ) ) );
     164        i128 += 1;
     165    }
     166    sout | nl;
     167
     168    ui128 = 0x7fffffffffffffff;
     169    ui128 <<= 64;
     170    ui128 += 0xfffffffffffffffa;
     171   
     172    for ( 20 ) {
     173        sout | ui128;
     174        ui128 += 1;
     175    }
     176    sout | nl;
     177
     178    ui128 = 0xffffffffffffffff;
     179    ui128 <<= 64;
     180    ui128 += 0xfffffffffffffffa;
     181   
     182    for ( 20 ) {
     183        sout | ui128;
     184        ui128 += 1;
     185    }
    143186}
  • tests/pybin/test_run.py

    r732b406 r3a32b3a  
    6969                        else :                                          text = "FAILED with code %d" % retcode
    7070
    71                 text += "    C%s - R%s" % (cls.fmtDur(duration[0]), cls.fmtDur(duration[1]))
     71                text += "    C%s - R%s" % (fmtDur(duration[0]), fmtDur(duration[1]))
    7272                return text
    73 
    74         @staticmethod
    75         def fmtDur( duration ):
    76                 if duration :
    77                         hours, rem = divmod(duration, 3600)
    78                         minutes, rem = divmod(rem, 60)
    79                         seconds, millis = divmod(rem, 1)
    80                         return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
    81                 return " n/a"
  • tests/pybin/tools.py

    r732b406 r3a32b3a  
    387387                while True:
    388388                        yield i.next(max(expire - time.time(), 0))
     389
     390def fmtDur( duration ):
     391        if duration :
     392                hours, rem = divmod(duration, 3600)
     393                minutes, rem = divmod(rem, 60)
     394                seconds, millis = divmod(rem, 1)
     395                return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)
     396        return " n/a"
  • tests/test.py

    r732b406 r3a32b3a  
    361361
    362362                # 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 
     363                with Timed() as total_dur:
     364                        for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install):
     365                                settings.arch    = arch
     366                                settings.debug   = debug
     367                                settings.install = install
     368
     369                                # filter out the tests for a different architecture
     370                                # tests are the same across debug/install
     371                                local_tests = settings.arch.filter( tests )
     372                                options.jobs, forceJobs = job_count( options, local_tests )
     373                                settings.update_make_cmd(forceJobs, options.jobs)
     374
     375                                # check the build configuration works
     376                                settings.validate()
     377
     378                                # print configuration
     379                                print('%s %i tests on %i cores (%s:%s)' % (
     380                                        'Regenerating' if settings.generating else 'Running',
     381                                        len(local_tests),
     382                                        options.jobs,
     383                                        settings.arch.string,
     384                                        settings.debug.string
     385                                ))
     386
     387                                # otherwise run all tests and make sure to return the correct error code
     388                                failed = run_tests(local_tests, options.jobs)
     389                                if failed:
     390                                        result = 1
     391                                        if not settings.continue_:
     392                                                break
     393
     394                print('Tests took %s' % fmtDur( total_dur.duration ))
    394395                sys.exit( failed )
Note: See TracChangeset for help on using the changeset viewer.