Changeset 7b84d3e for tests


Ignore:
Timestamp:
Oct 23, 2023, 11:58:10 AM (2 years ago)
Author:
caparson <caparson@…>
Branches:
master, stuck-waitfor-destruct
Children:
edc4813
Parents:
2ad5e1d5 (diff), abb04a4 (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:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/concurrency/waituntil/channel_close.cfa

    r2ad5e1d5 r7b84d3e  
    2626        for( ;; ) {
    2727            if ( useAnd ) {
    28                 waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; }
    29                 and waituntil( (in2 << B) ) { assert( B_removes == in2 ); B_removes++; removes++; }
     28                waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; }
     29                and waituntil( (in2 << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( B_removes == in2 ); B_removes++; removes++; }
    3030                continue;
    3131            }
    32             waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; }
    33             or waituntil( (in << B) ) { assert( B_removes == in ); B_removes++; removes++; }
     32            waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; }
     33            or waituntil( (in << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); ( B_removes == in ); B_removes++; removes++; }
    3434        }
    3535    } catchResume ( channel_closed * e ) {} // continue to remove until would block
     
    3737    try {
    3838        for( ;; )
    39             waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; }
     39            waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; }
    4040    } catchResume ( channel_closed * e ) {} // continue to remove until would block
    4141    catch ( channel_closed * e ) {}
    4242    try {
    4343        for( ;; )
    44             waituntil( (in << B) ) { assert( B_removes == in ); B_removes++; removes++; }
     44            waituntil( (in << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( B_removes == in ); B_removes++; removes++; }
    4545    } catchResume ( channel_closed * e ) {} // continue to remove until would block
    4646    catch ( channel_closed * e ) {}
  • tests/genericUnion.cfa

    r2ad5e1d5 r7b84d3e  
    1010// Created On       : Tue Dec 25 14:42:46 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 25 14:46:33 2018
    13 // Update Count     : 2
     12// Last Modified On : Fri Oct 20 09:13:26 2023
     13// Update Count     : 15
    1414//
    1515
     16#include <fstream.hfa>
    1617#include <limits.hfa>
    1718
    18 forall(T)
     19forall( T )
    1920union ByteView {
    2021        T val;
     
    2324
    2425forall(T)
    25 void print(ByteView(T) x) {
    26         for (int i = 0; i < sizeof(int); i++) {                         // want to change to sizeof(T)
    27                 printf("%02x", x.bytes[i] & 0xff);
     26void print( ByteView(T) x ) {
     27        for ( i; sizeof(int) ) {                                                        // want to change to sizeof(T)
     28                sout | nobase( pad0( wd( 2, hex( x.bytes[i] & 0xff ) ) ) ) | nosep;
    2829        }
    2930}
    3031
    3132forall(T)
    32 void f(ByteView(T) x, T val) {
    33         print(x);
    34         printf(" ");
     33void f( ByteView(T) x, T val ) {
     34        print( x );
     35        sout | " ";
    3536        x.val = val;
    36         print(x);
    37         printf("\n");
     37        print( x );
     38        sout | nl;
    3839}
    3940
    4041int main() {
     42        sout | nlOff;
    4143        ByteView(unsigned) u = { 0 };
    4244        ByteView(int) i = { 0 };
    43         f(u, MAX);
    44         f(i, -1);
     45        f( u, MAX );
     46        f( i, -1 );
    4547}
    4648
Note: See TracChangeset for help on using the changeset viewer.