Changeset cb01e1e in mainline for kernel/test/fpu


Ignore:
Timestamp:
2009-04-04T00:26:27Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a85aebd
Parents:
171f9a1
Message:

use global variable and a macro for silencing tests

Location:
kernel/test/fpu
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/fpu/fpu1_ia64.c

    r171f9a1 rcb01e1e  
    6464static atomic_t threads_fault;
    6565static waitq_t can_start;
    66 static bool sh_quiet;
    6766
    6867static void e(void *data)
     
    8685               
    8786                if ((int) (100000000 * e) != E_10e8) {
    88                         if (!sh_quiet)
    89                                 printf("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
     87                        TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
    9088                        atomic_inc(&threads_fault);
    9189                        break;
     
    120118               
    121119                if ((int) (1000000 * pi) != PI_10e8) {
    122                         if (!sh_quiet)
    123                                 printf("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100));
     120                        TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100));
    124121                        atomic_inc(&threads_fault);
    125122                        break;
     
    129126}
    130127
    131 char * test_fpu1(bool quiet)
     128char *test_fpu1(void)
    132129{
    133130        unsigned int i, total = 0;
    134         sh_quiet = quiet;
    135131       
    136132        waitq_initialize(&can_start);
     
    138134        atomic_set(&threads_fault, 0);
    139135       
    140         if (!quiet)
    141                 printf("Creating %u threads... ", 2 * THREADS);
     136        TPRINTF("Creating %u threads... ", 2 * THREADS);
    142137       
    143         for (i = 0; i < THREADS; i++) { 
     138        for (i = 0; i < THREADS; i++) {
    144139                thread_t *t;
    145140               
    146141                if (!(t = thread_create(e, NULL, TASK, 0, "e", false))) {
    147                         if (!quiet)
    148                                 printf("could not create thread %u\n", 2 * i);
     142                        TPRINTF("could not create thread %u\n", 2 * i);
    149143                        break;
    150144                }
     
    153147               
    154148                if (!(t = thread_create(pi, NULL, TASK, 0, "pi", false))) {
    155                         if (!quiet)
    156                                 printf("could not create thread %u\n", 2 * i + 1);
     149                        TPRINTF("could not create thread %u\n", 2 * i + 1);
    157150                        break;
    158151                }
     
    161154        }
    162155       
    163         if (!quiet)
    164                 printf("ok\n");
     156        TPRINTF("ok\n");
    165157       
    166158        thread_sleep(1);
     
    168160       
    169161        while (atomic_get(&threads_ok) != (long) total) {
    170                 if (!quiet)
    171                         printf("Threads left: %d\n", total - atomic_get(&threads_ok));
     162                TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
    172163                thread_sleep(1);
    173164        }
  • kernel/test/fpu/fpu1_skip.c

    r171f9a1 rcb01e1e  
    2929#include <test.h>
    3030
    31 char * test_fpu1(bool quiet)
     31char *test_fpu1(void)
    3232{
    3333        return NULL;
  • kernel/test/fpu/fpu1_x86.c

    r171f9a1 rcb01e1e  
    6161static atomic_t threads_fault;
    6262static waitq_t can_start;
    63 static bool sh_quiet;
    6463
    6564static void e(void *data)
     
    8382               
    8483                if ((int) (100000000 * e) != E_10e8) {
    85                         if (!sh_quiet)
    86                                 printf("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
     84                        TPRINTF("tid%" PRIu64 ": e*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8);
    8785                        atomic_inc(&threads_fault);
    8886                        break;
     
    117115               
    118116                if ((int) (100000000 * pi) != PI_10e8) {
    119                         if (!sh_quiet)
    120                                 printf("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);
     117                        TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);
    121118                        atomic_inc(&threads_fault);
    122119                        break;
     
    126123}
    127124
    128 char * test_fpu1(bool quiet)
     125char *test_fpu1(void)
    129126{
    130127        unsigned int i, total = 0;
    131         sh_quiet = quiet;
    132128       
    133129        waitq_initialize(&can_start);
     
    135131        atomic_set(&threads_fault, 0);
    136132       
    137         if (!quiet)
    138                 printf("Creating %u threads... ", 2 * THREADS);
     133        TPRINTF("Creating %u threads... ", 2 * THREADS);
    139134       
    140         for (i = 0; i < THREADS; i++) { 
     135        for (i = 0; i < THREADS; i++) {
    141136                thread_t *t;
    142137               
    143138                if (!(t = thread_create(e, NULL, TASK, 0, "e", false))) {
    144                         if (!quiet)
    145                                 printf("could not create thread %u\n", 2 * i);
     139                        TPRINTF("could not create thread %u\n", 2 * i);
    146140                        break;
    147141                }
     
    150144               
    151145                if (!(t = thread_create(pi, NULL, TASK, 0, "pi", false))) {
    152                         if (!quiet)
    153                                 printf("could not create thread %u\n", 2 * i + 1);
     146                        TPRINTF("could not create thread %u\n", 2 * i + 1);
    154147                        break;
    155148                }
     
    158151        }
    159152       
    160         if (!quiet)
    161                 printf("ok\n");
     153        TPRINTF("ok\n");
    162154       
    163155        thread_sleep(1);
     
    165157       
    166158        while (atomic_get(&threads_ok) != (long) total) {
    167                 if (!quiet)
    168                         printf("Threads left: %d\n", total - atomic_get(&threads_ok));
     159                TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
    169160                thread_sleep(1);
    170161        }
  • kernel/test/fpu/mips2.c

    r171f9a1 rcb01e1e  
    4444static atomic_t threads_fault;
    4545static waitq_t can_start;
    46 static bool sh_quiet;
    4746
    4847static void testit1(void *data)
     
    7069               
    7170                if (arg != after_arg) {
    72                         if (!sh_quiet)
    73                                 printf("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
     71                        TPRINTF("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
    7472                        atomic_inc(&threads_fault);
    7573                        break;
     
    102100               
    103101                if (arg != after_arg) {
    104                         if (!sh_quiet)
    105                                 printf("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
     102                        TPRINTF("General reg tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
    106103                        atomic_inc(&threads_fault);
    107104                        break;
     
    112109
    113110
    114 char * test_mips2(bool quiet)
     111char *test_mips2(void)
    115112{
    116113        unsigned int i, total = 0;
    117         sh_quiet = quiet;
    118114       
    119115        waitq_initialize(&can_start);
     
    121117        atomic_set(&threads_fault, 0);
    122118       
    123         if (!quiet)
    124                 printf("Creating %u threads... ", 2 * THREADS);
     119        TPRINTF("Creating %u threads... ", 2 * THREADS);
    125120       
    126121        for (i = 0; i < THREADS; i++) {
     
    128123               
    129124                if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
    130                         if (!quiet)
    131                                 printf("could not create thread %u\n", 2 * i);
     125                        TPRINTF("could not create thread %u\n", 2 * i);
    132126                        break;
    133127                }
     
    136130               
    137131                if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
    138                         if (!quiet)
    139                                 printf("could not create thread %u\n", 2 * i + 1);
     132                        TPRINTF("could not create thread %u\n", 2 * i + 1);
    140133                        break;
    141134                }
     
    144137        }
    145138       
    146         if (!quiet)
    147                 printf("ok\n");
     139        TPRINTF("ok\n");
    148140               
    149141        thread_sleep(1);
     
    151143       
    152144        while (atomic_get(&threads_ok) != (long) total) {
    153                 if (!quiet)
    154                         printf("Threads left: %d\n", total - atomic_get(&threads_ok));
     145                TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
    155146                thread_sleep(1);
    156147        }
  • kernel/test/fpu/mips2_skip.c

    r171f9a1 rcb01e1e  
    2929#include <test.h>
    3030
    31 char * test_mips2(bool quiet)
     31char *test_mips2(void)
    3232{
    3333        return NULL;
  • kernel/test/fpu/sse1.c

    r171f9a1 rcb01e1e  
    4444static atomic_t threads_fault;
    4545static waitq_t can_start;
    46 static bool sh_quiet;
    47 
    4846
    4947static void testit1(void *data)
     
    5250        int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
    5351        int after_arg __attribute__((aligned(16)));
    54 
     52       
    5553        thread_detach(THREAD);
    5654       
    5755        waitq_sleep(&can_start);
    58 
     56       
    5957        for (i = 0; i < ATTEMPTS; i++) {
    6058                asm volatile (
     
    6260                        : [arg] "=m" (arg)
    6361                );
    64 
     62               
    6563                delay(DELAY);
    6664                asm volatile (
     
    7068               
    7169                if (arg != after_arg) {
    72                         if (!sh_quiet)
    73                                 printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
     70                        TPRINTF("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
    7471                        atomic_inc(&threads_fault);
    7572                        break;
     
    8885       
    8986        waitq_sleep(&can_start);
    90 
     87       
    9188        for (i = 0; i < ATTEMPTS; i++) {
    9289                asm volatile (
     
    9491                        : [arg] "=m" (arg)
    9592                );
    96 
     93               
    9794                scheduler();
    9895                asm volatile (
     
    10299               
    103100                if (arg != after_arg) {
    104                         if (!sh_quiet)
    105                                 printf("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
     101                        TPRINTF("tid%" PRIu64 ": arg(%d) != %d\n", THREAD->tid, arg, after_arg);
    106102                        atomic_inc(&threads_fault);
    107103                        break;
     
    111107}
    112108
    113 
    114 char * test_sse1(bool quiet)
     109char *test_sse1(void)
    115110{
    116111        unsigned int i, total = 0;
    117         sh_quiet = quiet;
    118112       
    119113        waitq_initialize(&can_start);
     
    121115        atomic_set(&threads_fault, 0);
    122116       
    123         if (!quiet)
    124                 printf("Creating %u threads... ", 2 * THREADS);
    125 
     117        TPRINTF("Creating %u threads... ", 2 * THREADS);
     118       
    126119        for (i = 0; i < THREADS; i++) {
    127120                thread_t *t;
    128121               
    129122                if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
    130                         if (!quiet)
    131                                 printf("could not create thread %u\n", 2 * i);
     123                        TPRINTF("could not create thread %u\n", 2 * i);
    132124                        break;
    133125                }
     
    136128               
    137129                if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
    138                         if (!quiet)
    139                                 printf("could not create thread %u\n", 2 * i + 1);
     130                        TPRINTF("could not create thread %u\n", 2 * i + 1);
    140131                        break;
    141132                }
     
    144135        }
    145136       
    146         if (!quiet)
    147                 printf("ok\n");
    148                
     137        TPRINTF("ok\n");
     138       
    149139        thread_sleep(1);
    150140        waitq_wakeup(&can_start, WAKEUP_ALL);
    151141       
    152142        while (atomic_get(&threads_ok) != (long) total) {
    153                 if (!quiet)
    154                         printf("Threads left: %d\n", total - atomic_get(&threads_ok));
     143                TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
    155144                thread_sleep(1);
    156145        }
  • kernel/test/fpu/sse1_skip.c

    r171f9a1 rcb01e1e  
    2929#include <test.h>
    3030
    31 char * test_sse1(bool quiet)
     31char *test_sse1(void)
    3232{
    3333        return NULL;
Note: See TracChangeset for help on using the changeset viewer.