Changeset 7770cc8 for tests


Ignore:
Timestamp:
Nov 24, 2021, 9:47:56 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
5235d49
Parents:
94647b0b (diff), 3cc1111 (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:
10 edited

Legend:

Unmodified
Added
Removed
  • tests/.expect/declarationSpecifier.x64.txt

    r94647b0b r7770cc8  
    11321132char **_X13cfa_args_argvPPc_1;
    11331133char **_X13cfa_args_envpPPc_1;
    1134 signed int _X17cfa_main_returnedi_1 = ((signed int )0);
     1134__attribute__ ((weak)) extern signed int _X17cfa_main_returnedi_1;
    11351135signed int main(signed int _X4argci_1, char **_X4argvPPc_1, char **_X4envpPPc_1){
    11361136    __attribute__ ((unused)) signed int _X12_retval_maini_1;
     
    11491149    signed int _tmp_cp_ret6;
    11501150    signed int _X3reti_2 = (((void)(_tmp_cp_ret6=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret6);
    1151     {
    1152         ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     1151    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
     1152        {
     1153            ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     1154        }
     1155
    11531156    }
    11541157
  • tests/.expect/declarationSpecifier.x86.txt

    r94647b0b r7770cc8  
    11321132char **_X13cfa_args_argvPPc_1;
    11331133char **_X13cfa_args_envpPPc_1;
    1134 signed int _X17cfa_main_returnedi_1 = ((signed int )0);
     1134__attribute__ ((weak)) extern signed int _X17cfa_main_returnedi_1;
    11351135signed int main(signed int _X4argci_1, char **_X4argvPPc_1, char **_X4envpPPc_1){
    11361136    __attribute__ ((unused)) signed int _X12_retval_maini_1;
     
    11491149    signed int _tmp_cp_ret6;
    11501150    signed int _X3reti_2 = (((void)(_tmp_cp_ret6=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret6);
    1151     {
    1152         ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     1151    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
     1152        {
     1153            ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     1154        }
     1155
    11531156    }
    11541157
  • tests/.expect/gccExtensions.x64.txt

    r94647b0b r7770cc8  
    324324char **_X13cfa_args_argvPPc_1;
    325325char **_X13cfa_args_envpPPc_1;
    326 signed int _X17cfa_main_returnedi_1 = ((signed int )0);
     326__attribute__ ((weak)) extern signed int _X17cfa_main_returnedi_1;
    327327signed int main(signed int _X4argci_1, char **_X4argvPPc_1, char **_X4envpPPc_1){
    328328    __attribute__ ((unused)) signed int _X12_retval_maini_1;
     
    341341    signed int _tmp_cp_ret6;
    342342    signed int _X3reti_2 = (((void)(_tmp_cp_ret6=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret6);
    343     {
    344         ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     343    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
     344        {
     345            ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     346        }
     347
    345348    }
    346349
  • tests/.expect/gccExtensions.x86.txt

    r94647b0b r7770cc8  
    302302char **_X13cfa_args_argvPPc_1;
    303303char **_X13cfa_args_envpPPc_1;
    304 signed int _X17cfa_main_returnedi_1 = ((signed int )0);
     304__attribute__ ((weak)) extern signed int _X17cfa_main_returnedi_1;
    305305signed int main(signed int _X4argci_1, char **_X4argvPPc_1, char **_X4envpPPc_1){
    306306    __attribute__ ((unused)) signed int _X12_retval_maini_1;
     
    319319    signed int _tmp_cp_ret6;
    320320    signed int _X3reti_2 = (((void)(_tmp_cp_ret6=invoke_main(_X4argci_1, _X4argvPPc_1, _X4envpPPc_1))) , _tmp_cp_ret6);
    321     {
    322         ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     321    if ( ((&_X17cfa_main_returnedi_1)!=((signed int *)0)) ) {
     322        {
     323            ((void)(_X17cfa_main_returnedi_1=((signed int )1)));
     324        }
     325
    323326    }
    324327
  • tests/concurrent/semaphore.cfa

    r94647b0b r7770cc8  
    22#include <locks.hfa>
    33#include <thread.hfa>
     4#include <mutex_stmt.hfa>
    45
    56enum { num_blockers = 17, num_unblockers = 13 };
     
    2829                thrash();
    2930                P(ben);
    30                 if(((thread&)this).seqable.next != 0p) sout | acquire |"Link not invalidated";
     31                if(((thread&)this).seqable.next != 0p) mutex(sout) sout | "Link not invalidated";
    3132                thrash();
    3233        }
  • tests/concurrent/sleep.cfa

    r94647b0b r7770cc8  
    11#include <fstream.hfa>
    22#include <thread.hfa>
     3#include <mutex_stmt.hfa>
    34#include <time.hfa>
    45
     
    2930
    3031int main() {
    31         sout | acquire | "start";
     32        mutex( sout ) sout | "start";
    3233        {
    3334                slow_sleeper slow;
     
    3637                yield();
    3738        }
    38         sout | acquire | "done";
     39        mutex( sout ) sout | "done";
    3940}
    4041
  • tests/io/io-acquire.cfa

    r94647b0b r7770cc8  
    1010// Created On       : Mon Mar  1 18:40:09 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 27 11:49:34 2021
    13 // Update Count     : 18
     12// Last Modified On : Wed Oct  6 18:04:58 2021
     13// Update Count     : 72
    1414//
    1515
    1616#include <fstream.hfa>
    1717#include <thread.hfa>
     18#include <mutex_stmt.hfa>
    1819
    1920thread T {};
     
    2122        // output from parallel threads should not be scrambled
    2223
    23         for ( 100 ) {                                                                           // local protection
    24                 sout | acquire | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
     24        for ( 100 ) {                                                                           // expression protection
     25                mutex(sout) sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    2526        }
    26         {                                                                                                       // global protection (RAII)
    27                 osacquire acq = { sout };
     27        mutex( sout ) {                                                                         // statement protection
    2828                for ( 100 ) {
    2929                        sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
     
    3131        }
    3232        {                                                                                                       // duplicate protection demonstrating recursive lock
    33                 osacquire acq = { sout };
    34                 for ( 100 ) {
    35                         osacquire acq = { sout };
    36                         sout | acquire | 1 | 2 | 3 | 4 | 5 | acquire | 6 | 7 | 8 | 9;
    37                         sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
     33                ofstream & h1( ofstream & os ) {                                // helper
     34                        mutex( os ) return os | 1 | 2 | 3 | 4;          // unnecessary mutex
     35                }
     36                ofstream & h2( ofstream & os ) {                                // helper
     37                        mutex( os ) return os | 6 | 7 | 8 | 9;          // unnecessary mutex
     38                }
     39                mutex( sout ) {                                                                 // unnecessary mutex
     40                        for ( 100 ) {
     41                                mutex( sout ) {
     42                                        sout | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
     43                                        sout | h1 | 5 | h2;                                     // refactored code
     44                                }
     45                        }
    3846                }
    3947        }
     
    4250
    4351        int a, b, c, d, e, f, g, h, i;
    44         for ( 100 ) {                                                                           // local protection
    45                 sin | acquire | a | b | c | d | e | f | g | h | i;
     52        for ( 100 ) {                                                                           // expression protection
     53                mutex(sin) sin | a | b | c | d | e | f | g | h | i;
    4654        }
    47         {                                                                                                       // global protection (RAII)
    48                 isacquire acq = { sin };
     55        mutex( sin ) {                                                                          // statement protection
    4956                for ( 100 ) {
    5057                        sin  | a | b | c | d | e | f | g | h | i;
     
    5259        }
    5360        {                                                                                                       // duplicate protection demonstrating recursive lock
    54                 isacquire acq = { sin };
    55                 for ( 100 ) {
    56                         isacquire acq = { sin };
    57                         sin | acquire | a | b | c | d | e | acquire | f | g | h | i;
    58                         sin | a | b | c | d | e | f | g | h | i;
     61                ifstream & h1( ifstream & is ) {                                // helper
     62                        mutex( is ) return is | a | b | c | d;          // unnecessary mutex
     63                }
     64                ifstream & h2( ifstream & is ) {                                // helper
     65                        mutex( is ) return is | f | g | h | i;          // unnecessary mutex
     66                }
     67                mutex( sin ) {                                                                  // unnecessary mutex
     68                        for ( 5 ) {
     69                                mutex( sin ) {
     70                                        sin  | a | b | c | d | e | f | g | h | i;
     71                                        sin  | h1 | e | h2;                                     // refactored code
     72                                }
     73                        }
    5974                }
    6075        }
  • tests/linking/io-acquire.cfa

    r94647b0b r7770cc8  
    1717#include <fstream.hfa>
    1818#include <stdlib.hfa>
     19#include <mutex_stmt.hfa>
    1920
    2021int main() {
    2122        int i;
    2223        if(threading_enabled()) {
    23                 stdout | acquire | "YES";
     24                mutex( stdout ) stdout | "YES";
    2425                stdin | i;
    2526        } else {
    26                 stdout | acquire | "NO";
     27                mutex( stdout ) stdout | "NO";
    2728                stdin | i;
    2829        }
  • tests/pybin/test_run.py

    r94647b0b r7770cc8  
    6565        def toString( cls, retcode, duration ):
    6666                if settings.generating :
    67                         if   retcode == TestResult.SUCCESS:     text = "Done   "
    68                         elif retcode == TestResult.TIMEOUT:     text = "TIMEOUT"
    69                         else :                                          text = "ERROR code %d" % retcode
     67                        if   retcode == TestResult.SUCCESS:     key = 'pass'; text = "Done   "
     68                        elif retcode == TestResult.TIMEOUT:     key = 'time'; text = "TIMEOUT"
     69                        else :  key = 'fail';   text = "ERROR code %d" % retcode
    7070                else :
    71                         if   retcode == TestResult.SUCCESS:     text = "PASSED "
    72                         elif retcode == TestResult.TIMEOUT:     text = "TIMEOUT"
    73                         else :                                          text = "FAILED with code %d" % retcode
     71                        if   retcode == TestResult.SUCCESS:     key = 'pass'; text = "PASSED "
     72                        elif retcode == TestResult.TIMEOUT:     key = 'time'; text = "TIMEOUT"
     73                        else :  key = 'fail';   text = "FAILED with code %d" % retcode
    7474
    7575                text += "    C%s - R%s" % (fmtDur(duration[0]), fmtDur(duration[1]))
    76                 return text
     76                return key, text
  • tests/test.py

    r94647b0b r7770cc8  
    257257
    258258                # update output based on current action
    259                 result_txt = TestResult.toString( retcode, duration )
     259                result_key, result_txt = TestResult.toString( retcode, duration )
    260260
    261261                #print result with error if needed
     
    265265                        text = text + '\n' + error
    266266
    267                 return retcode == TestResult.SUCCESS, text
     267                return retcode == TestResult.SUCCESS, result_key, text
    268268        except KeyboardInterrupt:
    269                 return False, ""
     269                return False, 'keybrd', ""
    270270        # except Exception as ex:
    271271        #       print("Unexpected error in worker thread running {}: {}".format(t.target(), ex), file=sys.stderr)
     
    283283
    284284        failed = False
     285        rescnts = {     'pass': 0, 'fail': 0, 'time': 0, 'keybrd': 0 }
     286        other = 0
    285287
    286288        # for each test to run
     
    294296                )
    295297
    296                 for i, (succ, txt) in enumerate(timed(results, timeout = settings.timeout.total), 1) :
     298                for i, (succ, code, txt) in enumerate(timed(results, timeout = settings.timeout.total), 1) :
     299                        if code in rescnts.keys():
     300                                rescnts[code] += 1
     301                        else:
     302                                other += 1
     303
    297304                        if not succ :
    298305                                failed = True
     
    319326        # clean the workspace
    320327        make('clean', output_file=subprocess.DEVNULL, error=subprocess.DEVNULL)
     328
     329        print("{} passes, {} failures, {} timeouts, {} cancelled, {} other".format(rescnts['pass'], rescnts['fail'], rescnts['time'], rescnts['keybrd'], other))
    321330
    322331        return failed
     
    443452                        failed = run_tests(local_tests, options.jobs)
    444453                        if failed:
    445                                 result = 1
    446454                                if not settings.continue_:
    447455                                        break
Note: See TracChangeset for help on using the changeset viewer.