Changeset 5ef4008 for tests


Ignore:
Timestamp:
Sep 13, 2024, 2:43:22 PM (17 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
8c79dc3c
Parents:
c494b84 (diff), 9739c56f (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:
31 added
15 edited
3 moved

Legend:

Unmodified
Added
Removed
  • tests/Makefile.am

    rc494b84 r5ef4008  
    8181        avltree/avl-private.h \
    8282        avltree/avl.h \
    83         configs/.in/parseconfig-all.txt \
    84         configs/.in/parseconfig-errors.txt \
    85         configs/.in/parseconfig-missing.txt \
    8683        exceptions/except-io.hfa \
    8784        exceptions/with-threads.hfa \
    88         io/.in/io.data \
    89         io/.in/many_read.data \
    9085        meta/fork+exec.hfa \
    9186        concurrency/clib_tls.c \
     
    10095        echo "Gathering test files"
    10196        for file in `${TEST_PY} --list-dist`; do \
    102                 if test -f ${srcdir}/$${file}; then \
     97                if ls ${srcdir}/$${file} > /dev/null 2>&1; then \
    10398                        ${MKDIR_P} $$(dirname ${distdir}/$${file}); \
    104                         cp -df ${srcdir}/$${file} ${distdir}/$${file}; \
     99                        cp -df ${srcdir}/$${file} $$(dirname ${distdir}/$${file}); \
    105100                fi; \
    106101        done
  • tests/array-collections/.expect/array-raii-c.txt

    rc494b84 r5ef4008  
    7070dtor 1
    7171dtor 0
    72 === uninit
     72=== uninit ( uNoCtor[] )
    7373 [1]
    7474before ctors
  • tests/array-collections/.expect/array-raii-cfa.txt

    rc494b84 r5ef4008  
    7070dtor 1
    7171dtor 0
    72 === uninit
     72=== uninit ( uNoCtor[] )
    7373 [1]
    7474before ctors
     
    108108dtor 101
    109109dtor 100
     110=== uninit alt ( uArray )
     111 [1]
     112before ctors
     113ctor 0
     114ctor 999
     115ctor 888
     116ctor 3
     117ctor 4
     118func 0
     119func 999
     120func 888
     121func 3
     122func 4
     123dtor 4
     124dtor 3
     125dtor 888
     126dtor 999
     127dtor 0
     128 [2]
     129before ctors
     130ctor 100
     131ctor 101
     132ctor 102
     133ctor 110
     134ctor 999
     135ctor 888
     136func 100 at (0, 0)
     137func 101 at (0, 1)
     138func 102 at (0, 2)
     139func 110 at (1, 0)
     140func 999 at (1, 1)
     141func 888 at (1, 2)
     142dtor 888
     143dtor 999
     144dtor 110
     145dtor 102
     146dtor 101
     147dtor 100
     148=== uC++ cheat sheet
     149ctor 0
     150ctor 1
     151ctor 2
     152ctor 3
     153ctor 4
     1540
     1551
     1562
     1573
     1584
     159dtor 4
     160dtor 3
     161dtor 2
     162dtor 1
     163dtor 0
  • tests/array-collections/array-raii-c.cfa

    rc494b84 r5ef4008  
    2020
    2121#include "array-raii.hfa"
     22
     23void test_extras() {}
  • tests/array-collections/array-raii-cfa.cfa

    rc494b84 r5ef4008  
    1616// CFA array means like `array(float, 17) x;`
    1717
     18
     19#include <fstream.hfa>
    1820#include <collections/array.hfa>
    1921
     
    2224
    2325#include "array-raii.hfa"
     26
     27void test_uninit_alt() {
     28    printf(" [1]\n");
     29    {
     30        array(thing, 5) a = { delay_init };
     31        printf("before ctors\n");
     32        for(i; 5) {
     33            if (i == 1)
     34                (a[i]){};  // no need for `emplace` bc no-arg ctor call means elem's real ctor
     35            else if (i == 2)
     36                (a[i]){888};
     37            else
     38                (a[i]){i};
     39        }
     40        for(i; 5) printf("func %d\n", a[i].mem);
     41    }
     42    printf(" [2]\n");
     43    {
     44        array(thing, 2, 3) a = { delay_init };
     45        printf("before ctors\n");
     46        for(i; 2) for(j; 3) {
     47            if (i == 1 && j == 1)
     48                (a[i][j]){};
     49            else if (i == 1 && j == 2)
     50                (a[i][j]){888};
     51            else
     52                (a[i][j]){100 + 10 * i + j};
     53        }
     54        for(i; 2) for(j; 3) {
     55            printf("func %d at (%d, %d)\n", a[i][j].mem, i, j);
     56        }
     57    }
     58}
     59
     60void test_uCxxCheatSheet() {
     61    struct S {
     62        int i;
     63    };
     64    void ?{}( S & s, int i ) { s.i = i; sout | "ctor" | s.i; }
     65    void ^?{}( S & s ) { sout | "dtor" | s.i; }
     66//  int main() {
     67        enum { N = 5 };
     68        array(S, N) s = { delay_init };   // no constructor calls
     69        for ( i; N ) s[i]{ i };
     70        for ( i; N ) sout | s[i].i;
     71//  }
     72}
     73
     74void test_extras() {
     75
     76    printf("=== uninit alt ( uArray )\n");
     77    test_uninit_alt();
     78
     79    printf("=== uC++ cheat sheet\n");
     80    test_uCxxCheatSheet();
     81}
  • tests/array-collections/array-raii.hfa

    rc494b84 r5ef4008  
    118118}
    119119
     120struct thing { int mem; };
     121void ?{}( thing & this, int i ) {
     122    (this.mem){ i };
     123    printf("ctor %d\n", this.mem);
     124}
     125void ?{}( thing & this ) {
     126    (this){ 999 };
     127}
     128void ^?{}( thing & this ) {
     129    printf("dtor %d\n", this.mem);
     130}
     131
    120132// Array of uninits sees explicit ctor calls (only), and implied dtor calls
    121133void test_uninit() {
    122     struct thing { int mem; };
    123     void ?{}( thing & this, int i ) {
    124         (this.mem){ i };
    125         printf("ctor %d\n", this.mem);
    126     }
    127     void ?{}( thing & this ) {
    128         (this){ 999 };
    129     }
    130     void ^?{}( thing & this ) {
    131         printf("dtor %d\n", this.mem);
    132     }
    133134    printf(" [1]\n");
    134135    {
     
    163164}
    164165
     166void test_extras();
     167
    165168int main() {
    166169    printf("=== builtins\n");
     
    170173    test_custom();
    171174
    172     printf("=== uninit\n");
     175    printf("=== uninit ( uNoCtor[] )\n");
    173176    test_uninit();
     177
     178    test_extras();
    174179}
  • tests/configs/parsebools.cfa

    rc494b84 r5ef4008  
    5050}
    5151
    52 int true_main( const char * path, char * env[] ) {
     52int true_main( const char * path, const char * env[] ) {
    5353        printf( "no arg:\n" );
    5454        if ( pid_t child = strict_fork(); child == 0 ) {
  • tests/configs/parseconfig.cfa

    rc494b84 r5ef4008  
    5050        sout | "Different types of destination addresses";
    5151
    52         parse_config( xstr(IN_DIR) "parseconfig-all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
     52        parse_config( xstr(IN_DIR) "parseconfig.all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    5353
    5454    sout | "Stop cost: " | config_params.stop_cost;
     
    7777        sout | "Missing_Config_Entries thrown when config file is missing entries we want";
    7878        try {
    79                 parse_config( xstr(IN_DIR) "parseconfig-missing.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
     79                parse_config( xstr(IN_DIR) "parseconfig.missing.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    8080        } catch( Missing_Config_Entries * ex ) {
    8181                msg( ex );
     
    9292
    9393        try {
    94                 parse_config( xstr(IN_DIR) "parseconfig-errors.txt", entry, 1, parse_tabular_config_format );
     94                parse_config( xstr(IN_DIR) "parseconfig.errors.txt", entry, 1, parse_tabular_config_format );
    9595        } catch( Parse_Failure * ex ) {
    9696                msg( ex );
     
    106106
    107107        try {
    108                 parse_config( xstr(IN_DIR) "parseconfig-errors.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
     108                parse_config( xstr(IN_DIR) "parseconfig.errors.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    109109        } catch( Validation_Failure * ex ) {
    110110                msg( ex );
     
    115115        sout | "No error is thrown when validation succeeds";
    116116        config_params.stop_cost = -1; // Reset value
    117         parse_config( xstr(IN_DIR) "parseconfig-all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
     117        parse_config( xstr(IN_DIR) "parseconfig.all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    118118        sout | "Stop cost: " | config_params.stop_cost;
    119119        sout | nl;
     
    126126
    127127        config_params.stop_cost = -1; // Reset value
    128         parse_config( xstr(IN_DIR) "parseconfig-all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
     128        parse_config( xstr(IN_DIR) "parseconfig.all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    129129
    130130        sout | "Stop cost: " | config_params.stop_cost;
     
    139139
    140140        config_params.stop_cost = -1; // Reset value
    141         parse_config( xstr(IN_DIR) "parseconfig-all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
     141        parse_config( xstr(IN_DIR) "parseconfig.all.txt", entries, NUM_ENTRIES, parse_tabular_config_format );
    142142
    143143        sout | "Stop cost: " | config_params.stop_cost;
  • tests/configs/parsenums.cfa

    rc494b84 r5ef4008  
    6161}
    6262
    63 int true_main( const char * path, char * env[] ) {
     63int true_main( const char * path, const char * env[] ) {
    6464        printf( "no arg:\n" );
    6565        if ( pid_t child = strict_fork(); child == 0 ) {
  • tests/configs/usage.cfa

    rc494b84 r5ef4008  
    108108
    109109// no used
    110 static int true_main( const char * path, char * env[]) { return 0; }
     110static int true_main( const char * path, const char * env[]) { return 0; }
  • tests/meta/fork+exec.cfa

    rc494b84 r5ef4008  
    3232
    3333
    34 int true_main(const char * path, char * env[]) {
     34int true_main(const char * path, const char * env[]) {
    3535        printf("no arg:\n");
    3636        if(pid_t child = strict_fork(); child == 0) {
  • tests/meta/fork+exec.hfa

    rc494b84 r5ef4008  
    2828}
    2929
    30 static int true_main(const char * path, char * env[]);
     30static int true_main(const char * path, const char * env[]);
    3131
    3232static int do_wait(pid_t pid) {
     
    7070        if(getenv("CFATEST_FORK_EXEC_TEXT")) return;
    7171
    72         char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", 0p };
     72        const char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", (char*)0 };
    7373        exit( true_main(path, env) );
    7474}
  • tests/pybin/test_run.py

    rc494b84 r5ef4008  
    2929                return os.path.normpath( os.path.join(settings.BUILDDIR, self.path, ".out"   , "%s.log" % self.name) )
    3030
     31        # one file that goes to the test's stdin
    3132        def input(self):
    3233                return os.path.normpath( os.path.join(settings.SRCDIR  , self.path, ".in"    , "%s.txt" % self.name) )
     34
     35        # several files available for this test to open
     36        def inputs_all(self):
     37                return os.path.normpath( os.path.join(settings.SRCDIR  , self.path, ".in"    , "%s.*" % self.name) )
    3338
    3439        def target_output(self):
  • tests/test.py

    rc494b84 r5ef4008  
    352352                for t in tests:
    353353                        print(os.path.relpath(t.expect(), settings.SRCDIR), end=' ')
    354                         print(os.path.relpath(t.input() , settings.SRCDIR), end=' ')
     354                        print(os.path.relpath(t.inputs_all() , settings.SRCDIR), end=' ')
    355355                        code, out, err = make_recon(t.target())
    356356
     
    360360
    361361                        print(' '.join(re.findall(r'([^\s]+\.cfa)', out)), end=' ')
    362 
    363                 print('')
    364362
    365363                # done
  • tests/time.cfa

    rc494b84 r5ef4008  
    1010// Created On       : Tue Mar 27 17:24:56 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 13 09:09:47 2024
    13 // Update Count     : 76
     12// Last Modified On : Fri Sep 13 00:57:15 2024
     13// Update Count     : 77
    1414//
    1515
     
    1818#include <stdlib.h>                                                                             // putenv
    1919
    20 extern "C" size_t malloc_unfreed() { return 2048; }             // guess at unfreed storage from putenv/tzset
     20extern "C" size_t malloc_unfreed() { return 4096; }             // guess at unfreed storage from putenv/tzset
    2121
    2222int main() {
Note: See TracChangeset for help on using the changeset viewer.