Changeset cb01e1e in mainline for kernel/test/mm


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/mm
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/mm/falloc1.c

    r171f9a1 rcb01e1e  
    3737#include <align.h>
    3838
    39 #define MAX_FRAMES 1024
    40 #define MAX_ORDER 8
    41 #define TEST_RUNS 2
     39#define MAX_FRAMES  1024
     40#define MAX_ORDER   8
     41#define TEST_RUNS   2
    4242
    43 char * test_falloc1(bool quiet) {
    44         uintptr_t * frames = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), 0);
     43char *test_falloc1(void) {
     44        uintptr_t *frames
     45            = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), 0);
    4546        int results[MAX_ORDER + 1];
    4647       
     
    5354        if (frames == NULL)
    5455                return "Unable to allocate frames";
    55 
     56       
    5657        for (run = 0; run < TEST_RUNS; run++) {
    5758                for (order = 0; order <= MAX_ORDER; order++) {
    58                         if (!quiet)
    59                                 printf("Allocating %d frames blocks ... ", 1 << order);
     59                        TPRINTF("Allocating %d frames blocks ... ", 1 << order);
    6060                       
    6161                        allocated = 0;
     
    6464                               
    6565                                if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
    66                                         if (!quiet)
    67                                                 printf("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10);
     66                                        TPRINTF("Block at address %p (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10);
    6867                                        return "Test failed";
    6968                                }
     
    7271                                        allocated++;
    7372                                else {
    74                                         if (!quiet)
    75                                                 printf("done. ");
     73                                        TPRINTF("done. ");
    7674                                        break;
    7775                                }
    7876                        }
    7977                       
    80                         if (!quiet)
    81                                 printf("%d blocks allocated.\n", allocated);
    82                
     78                        TPRINTF("%d blocks allocated.\n", allocated);
     79                       
    8380                        if (run) {
    8481                                if (results[order] != allocated)
     
    8784                                results[order] = allocated;
    8885                       
    89                         if (!quiet)
    90                                 printf("Deallocating ... ");
     86                        TPRINTF("Deallocating ... ");
    9187                       
    9288                        for (i = 0; i < allocated; i++)
    9389                                frame_free(KA2PA(frames[i]));
    9490                       
    95                         if (!quiet)
    96                                 printf("done.\n");
     91                        TPRINTF("done.\n");
    9792                }
    9893        }
    99 
     94       
    10095        free(frames);
    10196       
  • kernel/test/mm/falloc2.c

    r171f9a1 rcb01e1e  
    4040#include <arch.h>
    4141
    42 #define MAX_FRAMES 256
    43 #define MAX_ORDER 8
     42#define MAX_FRAMES  256
     43#define MAX_ORDER   8
    4444
    45 #define THREAD_RUNS 1
    46 #define THREADS 8
     45#define THREAD_RUNS  1
     46#define THREADS      8
    4747
    4848static atomic_t thread_count;
    4949static atomic_t thread_fail;
    50 static bool sh_quiet;
    5150
    52 static void falloc(void * arg)
     51static void falloc(void *arg)
    5352{
    5453        int order, run, allocated, i;
     
    5857        void **frames =  (void **) malloc(MAX_FRAMES * sizeof(void *), FRAME_ATOMIC);
    5958        if (frames == NULL) {
    60                 if (!sh_quiet)
    61                         printf("Thread #%" PRIu64 " (cpu%u): Unable to allocate frames\n", THREAD->tid, CPU->id);
     59                TPRINTF("Thread #%" PRIu64 " (cpu%u): Unable to allocate frames\n", THREAD->tid, CPU->id);
    6260                atomic_inc(&thread_fail);
    6361                atomic_dec(&thread_count);
     
    6664       
    6765        thread_detach(THREAD);
    68 
     66       
    6967        for (run = 0; run < THREAD_RUNS; run++) {
    7068                for (order = 0; order <= MAX_ORDER; order++) {
    71                         if (!sh_quiet)
    72                                 printf("Thread #%" PRIu64 " (cpu%u): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);
     69                        TPRINTF("Thread #%" PRIu64 " (cpu%u): Allocating %d frames blocks ... \n", THREAD->tid, CPU->id, 1 << order);
    7370                       
    7471                        allocated = 0;
     
    8279                        }
    8380                       
    84                         if (!sh_quiet)
    85                                 printf("Thread #%" PRIu64 " (cpu%u): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated);
    86                        
    87                         if (!sh_quiet)
    88                                 printf("Thread #%" PRIu64 " (cpu%u): Deallocating ... \n", THREAD->tid, CPU->id);
     81                        TPRINTF("Thread #%" PRIu64 " (cpu%u): %d blocks allocated.\n", THREAD->tid, CPU->id, allocated);
     82                        TPRINTF("Thread #%" PRIu64 " (cpu%u): Deallocating ... \n", THREAD->tid, CPU->id);
    8983                       
    9084                        for (i = 0; i < allocated; i++) {
    9185                                for (k = 0; k <= (((index_t) FRAME_SIZE << order) - 1); k++) {
    9286                                        if (((uint8_t *) frames[i])[k] != val) {
    93                                                 if (!sh_quiet)
    94                                                         printf("Thread #%" PRIu64 " (cpu%u): Unexpected data (%c) in block %p offset %#" PRIi "\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
     87                                                TPRINTF("Thread #%" PRIu64 " (cpu%u): Unexpected data (%c) in block %p offset %#" PRIi "\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
    9588                                                atomic_inc(&thread_fail);
    9689                                                goto cleanup;
     
    10093                        }
    10194                       
    102                         if (!sh_quiet)
    103                                 printf("Thread #%" PRIu64 " (cpu%u): Finished run.\n", THREAD->tid, CPU->id);
     95                        TPRINTF("Thread #%" PRIu64 " (cpu%u): Finished run.\n", THREAD->tid, CPU->id);
    10496                }
    10597        }
    106 
    107 cleanup:       
     98       
     99cleanup:
    108100        free(frames);
    109101       
    110         if (!sh_quiet)
    111                 printf("Thread #%" PRIu64 " (cpu%u): Exiting\n", THREAD->tid, CPU->id);
     102        TPRINTF("Thread #%" PRIu64 " (cpu%u): Exiting\n", THREAD->tid, CPU->id);
    112103        atomic_dec(&thread_count);
    113104}
    114105
    115 char * test_falloc2(bool quiet)
     106char *test_falloc2(void)
    116107{
    117108        unsigned int i;
    118         sh_quiet = quiet;
    119 
     109       
    120110        atomic_set(&thread_count, THREADS);
    121111        atomic_set(&thread_fail, 0);
    122                
     112       
    123113        for (i = 0; i < THREADS; i++) {
    124114                thread_t * thrd = thread_create(falloc, NULL, TASK, 0, "falloc", false);
    125115                if (!thrd) {
    126                         if (!quiet)
    127                                 printf("Could not create thread %u\n", i);
     116                        TPRINTF("Could not create thread %u\n", i);
    128117                        break;
    129118                }
     
    132121       
    133122        while (atomic_get(&thread_count) > 0) {
    134                 if (!quiet)
    135                         printf("Threads left: %ld\n", atomic_get(&thread_count));
     123                TPRINTF("Threads left: %ld\n", atomic_get(&thread_count));
    136124                thread_sleep(1);
    137125        }
  • kernel/test/mm/mapping1.c

    r171f9a1 rcb01e1e  
    3636#include <debug.h>
    3737
    38 #define PAGE0   0x10000000
    39 #define PAGE1   (PAGE0+PAGE_SIZE)
     38#define PAGE0  0x10000000
     39#define PAGE1  (PAGE0 + PAGE_SIZE)
    4040
    41 #define VALUE0  0x01234567
    42 #define VALUE1  0x89abcdef
     41#define VALUE0  0x01234567
     42#define VALUE1  0x89abcdef
    4343
    44 char * test_mapping1(bool quiet)
     44char *test_mapping1(void)
    4545{
    4646        uintptr_t frame0, frame1;
    4747        uint32_t v0, v1;
    48 
     48       
    4949        frame0 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
    5050        frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
    5151       
    52         if (!quiet)
    53                 printf("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
     52        TPRINTF("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
    5453        *((uint32_t *) frame0) = VALUE0;
    55         if (!quiet)
    56                 printf("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
     54       
     55        TPRINTF("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
    5756        *((uint32_t *) frame1) = VALUE1;
    5857       
    59         if (!quiet)
    60                 printf("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
     58        TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
    6159        page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
    62         if (!quiet)
    63                 printf("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));   
     60       
     61        TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));
    6462        page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
    6563       
    6664        v0 = *((uint32_t *) PAGE0);
    6765        v1 = *((uint32_t *) PAGE1);
    68         if (!quiet) {
    69                 printf("Value at virtual address %p is %#x.\n", PAGE0, v0);
    70                 printf("Value at virtual address %p is %#x.\n", PAGE1, v1);
    71         }
     66        TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, v0);
     67        TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, v1);
    7268       
    7369        if (v0 != VALUE0)
     
    7672                return "Value at v1 not equal to VALUE1";
    7773       
    78         if (!quiet)
    79                 printf("Writing %#x to virtual address %p.\n", 0, PAGE0);
     74        TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE0);
    8075        *((uint32_t *) PAGE0) = 0;
    81         if (!quiet)
    82                 printf("Writing %#x to virtual address %p.\n", 0, PAGE1);
    83         *((uint32_t *) PAGE1) = 0;     
    84 
     76       
     77        TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE1);
     78        *((uint32_t *) PAGE1) = 0;
     79       
    8580        v0 = *((uint32_t *) PAGE0);
    8681        v1 = *((uint32_t *) PAGE1);
    8782       
    88         if (!quiet) {
    89                 printf("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0)); 
    90                 printf("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
    91         }
    92 
     83        TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, *((uint32_t *) PAGE0));
     84        TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, *((uint32_t *) PAGE1));
     85       
    9386        if (v0 != 0)
    9487                return "Value at v0 not equal to 0";
     
    9689                return "Value at v1 not equal to 0";
    9790       
    98         return NULL;   
     91        return NULL;
    9992}
  • kernel/test/mm/purge1.c

    r171f9a1 rcb01e1e  
    4040extern void tlb_invalidate_pages(asid_t asid, uintptr_t va, count_t cnt);
    4141
    42 char * test_purge1(bool quiet)
     42char *test_purge1(void)
    4343{
    4444        tlb_entry_t entryi;
  • kernel/test/mm/purge1_skip.c

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

    r171f9a1 rcb01e1e  
    3434#include <memstr.h>
    3535
    36 #define VAL_COUNT   1024
     36#define VAL_COUNT  1024
    3737
    38 static void * data[VAL_COUNT];
     38static void *data[VAL_COUNT];
    3939
    40 static void testit(int size, int count, bool quiet)
     40static void testit(int size, int count)
    4141{
    4242        slab_cache_t *cache;
    4343        int i;
    4444       
    45         if (!quiet)
    46                 printf("Creating cache, object size: %d.\n", size);
     45        TPRINTF("Creating cache, object size: %d.\n", size);
    4746       
    4847        cache = slab_cache_create("test_cache", size, 0, NULL, NULL,
    49                                 SLAB_CACHE_NOMAGAZINE);
     48            SLAB_CACHE_NOMAGAZINE);
    5049       
    51         if (!quiet)
    52                 printf("Allocating %d items...", count);
     50        TPRINTF("Allocating %d items...", count);
    5351       
    5452        for (i = 0; i < count; i++) {
     
    5755        }
    5856       
    59         if (!quiet) {
    60                 printf("done.\n");
    61                 printf("Freeing %d items...", count);
    62         }
     57        TPRINTF("done.\n");
     58       
     59        TPRINTF("Freeing %d items...", count);
    6360       
    6461        for (i = 0; i < count; i++)
    6562                slab_free(cache, data[i]);
    6663       
    67         if (!quiet) {
    68                 printf("done.\n");
    69                 printf("Allocating %d items...", count);
    70         }
     64        TPRINTF("done.\n");
     65       
     66        TPRINTF("Allocating %d items...", count);
    7167       
    7268        for (i = 0; i < count; i++) {
     
    7571        }
    7672       
    77         if (!quiet) {
    78                 printf("done.\n");
    79                 printf("Freeing %d items...", count / 2);
    80         }
     73        TPRINTF("done.\n");
     74       
     75        TPRINTF("Freeing %d items...", count / 2);
    8176       
    8277        for (i = count - 1; i >= count / 2; i--)
    8378                slab_free(cache, data[i]);
    8479       
    85         if (!quiet) {
    86                 printf("done.\n");     
    87                 printf("Allocating %d items...", count / 2);
    88         }
     80        TPRINTF("done.\n");
     81       
     82        TPRINTF("Allocating %d items...", count / 2);
    8983       
    9084        for (i = count / 2; i < count; i++) {
     
    9387        }
    9488       
    95         if (!quiet) {
    96                 printf("done.\n");
    97                 printf("Freeing %d items...", count);
    98         }
     89        TPRINTF("done.\n");
     90       
     91        TPRINTF("Freeing %d items...", count);
    9992       
    10093        for (i = 0; i < count; i++)
    10194                slab_free(cache, data[i]);
    10295       
    103         if (!quiet)
    104                 printf("done.\n");     
     96        TPRINTF("done.\n");
     97       
    10598        slab_cache_destroy(cache);
    10699       
    107         if (!quiet)
    108                 printf("Test complete.\n");
     100        TPRINTF("Test complete.\n");
    109101}
    110102
    111 static void testsimple(bool quiet)
     103static void testsimple(void)
    112104{
    113         testit(100, VAL_COUNT, quiet);
    114         testit(200, VAL_COUNT, quiet);
    115         testit(1024, VAL_COUNT, quiet);
    116         testit(2048, 512, quiet);
    117         testit(4000, 128, quiet);
    118         testit(8192, 128, quiet);
    119         testit(16384, 128, quiet);
    120         testit(16385, 128, quiet);
     105        testit(100, VAL_COUNT);
     106        testit(200, VAL_COUNT);
     107        testit(1024, VAL_COUNT);
     108        testit(2048, 512);
     109        testit(4000, 128);
     110        testit(8192, 128);
     111        testit(16384, 128);
     112        testit(16385, 128);
    121113}
    122114
    123 #define THREADS     6
    124 #define THR_MEM_COUNT   1024
    125 #define THR_MEM_SIZE    128
     115#define THREADS        6
     116#define THR_MEM_COUNT  1024
     117#define THR_MEM_SIZE   128
    126118
    127 static void * thr_data[THREADS][THR_MEM_COUNT];
     119static void *thr_data[THREADS][THR_MEM_COUNT];
    128120static slab_cache_t *thr_cache;
    129121static semaphore_t thr_sem;
    130 static bool sh_quiet;
    131122
    132123static void slabtest(void *data)
     
    137128        thread_detach(THREAD);
    138129       
    139         if (!sh_quiet)
    140                 printf("Starting thread #%" PRIu64 "...\n", THREAD->tid);
     130        TPRINTF("Starting thread #%" PRIu64 "...\n", THREAD->tid);
    141131       
    142132        for (j = 0; j < 10; j++) {
     
    151141        }
    152142       
    153         if (!sh_quiet)
    154                 printf("Thread #%" PRIu64 " finished\n", THREAD->tid);
     143        TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid);
    155144       
    156145        semaphore_up(&thr_sem);
    157146}
    158147
    159 static void testthreads(bool quiet)
     148static void testthreads(void)
    160149{
    161150        thread_t *t;
    162151        int i;
    163 
     152       
    164153        thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0, NULL, NULL,
    165                                         SLAB_CACHE_NOMAGAZINE);
     154            SLAB_CACHE_NOMAGAZINE);
     155       
    166156        semaphore_initialize(&thr_sem, 0);
    167157        for (i = 0; i < THREADS; i++) { 
    168158                if (!(t = thread_create(slabtest, (void *) (unative_t) i, TASK, 0, "slabtest", false))) {
    169                         if (!quiet)
    170                                 printf("Could not create thread %d\n", i);
     159                        TPRINTF("Could not create thread %d\n", i);
    171160                } else
    172161                        thread_ready(t);
     
    178167        slab_cache_destroy(thr_cache);
    179168       
    180         if (!quiet)
    181                 printf("Test complete.\n");
     169        TPRINTF("Test complete.\n");
    182170}
    183171
    184 char * test_slab1(bool quiet)
     172char *test_slab1(void)
    185173{
    186         sh_quiet = quiet;
    187        
    188         testsimple(quiet);
    189         testthreads(quiet);
     174        testsimple();
     175        testthreads();
    190176       
    191177        return NULL;
  • kernel/test/mm/slab2.c

    r171f9a1 rcb01e1e  
    3737#include <synch/mutex.h>
    3838
    39 #define ITEM_SIZE 256
     39#define ITEM_SIZE  256
    4040
    4141/** Fill memory with 2 caches, when allocation fails,
     
    4343 *  now allocation should clean magazines and allow for full allocation.
    4444 */
    45 static void totalmemtest(bool quiet)
     45static void totalmemtest(void)
    4646{
    4747        slab_cache_t *cache1;
    4848        slab_cache_t *cache2;
    4949        int i;
    50 
     50       
    5151        void *data1, *data2;
    5252        void *olddata1 = NULL, *olddata2 = NULL;
     
    5555        cache2 = slab_cache_create("cache2_tst", ITEM_SIZE, 0, NULL, NULL, 0);
    5656       
    57         if (!quiet)
    58                 printf("Allocating...");
     57        TPRINTF("Allocating...");
    5958       
    6059        /* Use atomic alloc, so that we find end of memory */
     
    7574                olddata1 = data1;
    7675                olddata2 = data2;
    77         } while (1);
    78        
    79         if (!quiet) {
    80                 printf("done.\n");
    81                 printf("Deallocating cache2...");
    82         }
     76        } while (true);
     77       
     78        TPRINTF("done.\n");
     79       
     80        TPRINTF("Deallocating cache2...");
    8381       
    8482        /* We do not have memory - now deallocate cache2 */
     
    8987        }
    9088       
    91         if (!quiet) {
    92                 printf("done.\n");
    93                 printf("Allocating to cache1...\n");
    94         }
     89        TPRINTF("done.\n");
     90       
     91        TPRINTF("Allocating to cache1...\n");
    9592       
    9693        for (i = 0; i < 30; i++) {
    9794                data1 = slab_alloc(cache1, FRAME_ATOMIC);
    9895                if (!data1) {
    99                         if (!quiet)
    100                                 printf("Incorrect memory size - use another test.");
     96                        TPRINTF("Incorrect memory size - use another test.");
    10197                        return;
    10298                }
     
    105101                olddata1 = data1;
    106102        }
    107         while (1) {
     103        while (true) {
    108104                data1 = slab_alloc(cache1, FRAME_ATOMIC);
    109105                if (!data1)
     
    114110        }
    115111       
    116         if (!quiet)
    117                 printf("Deallocating cache1...");
     112        TPRINTF("Deallocating cache1...");
    118113       
    119114        while (olddata1) {
     
    123118        }
    124119       
    125         if (!quiet) {
    126                 printf("done.\n");
    127                 slab_print_list();
    128         }
     120        TPRINTF("done.\n");
     121       
     122        slab_print_list();
    129123       
    130124        slab_cache_destroy(cache1);
     
    136130static condvar_t thread_starter;
    137131static mutex_t starter_mutex;
    138 static bool sh_quiet;
    139 
    140 #define THREADS 8
     132
     133#define THREADS  8
    141134
    142135static void slabtest(void *priv)
     
    150143        mutex_unlock(&starter_mutex);
    151144       
    152         if (!sh_quiet)
    153                 printf("Starting thread #%" PRIu64 "...\n", THREAD->tid);
     145        TPRINTF("Starting thread #%" PRIu64 "...\n", THREAD->tid);
    154146
    155147        /* Alloc all */
    156         if (!sh_quiet)
    157                 printf("Thread #%" PRIu64 " allocating...\n", THREAD->tid);
    158        
    159         while (1) {
     148        TPRINTF("Thread #%" PRIu64 " allocating...\n", THREAD->tid);
     149       
     150        while (true) {
    160151                /* Call with atomic to detect end of memory */
    161152                new = slab_alloc(thr_cache, FRAME_ATOMIC);
     
    166157        }
    167158       
    168         if (!sh_quiet)
    169                 printf("Thread #%" PRIu64 " releasing...\n", THREAD->tid);
     159        TPRINTF("Thread #%" PRIu64 " releasing...\n", THREAD->tid);
    170160       
    171161        while (data) {
     
    176166        }
    177167       
    178         if (!sh_quiet)
    179                 printf("Thread #%" PRIu64 " allocating...\n", THREAD->tid);
    180        
    181         while (1) {
     168        TPRINTF("Thread #%" PRIu64 " allocating...\n", THREAD->tid);
     169       
     170        while (true) {
    182171                /* Call with atomic to detect end of memory */
    183172                new = slab_alloc(thr_cache, FRAME_ATOMIC);
     
    188177        }
    189178       
    190         if (!sh_quiet)
    191                 printf("Thread #%" PRIu64 " releasing...\n", THREAD->tid);
     179        TPRINTF("Thread #%" PRIu64 " releasing...\n", THREAD->tid);
    192180       
    193181        while (data) {
     
    198186        }
    199187       
    200         if (!sh_quiet)
    201                 printf("Thread #%" PRIu64 " finished\n", THREAD->tid);
     188        TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid);
    202189       
    203190        slab_print_list();
     
    205192}
    206193
    207 static void multitest(int size, bool quiet)
     194static void multitest(int size)
    208195{
    209196        /* Start 8 threads that just allocate as much as possible,
     
    213200        int i;
    214201       
    215         if (!quiet)
    216                 printf("Running stress test with size %d\n", size);
     202        TPRINTF("Running stress test with size %d\n", size);
    217203       
    218204        condvar_initialize(&thread_starter);
    219205        mutex_initialize(&starter_mutex, MUTEX_PASSIVE);
    220 
     206       
    221207        thr_cache = slab_cache_create("thread_cache", size, 0, NULL, NULL, 0);
    222208        semaphore_initialize(&thr_sem,0);
    223209        for (i = 0; i < THREADS; i++) { 
    224210                if (!(t = thread_create(slabtest, NULL, TASK, 0, "slabtest", false))) {
    225                         if (!quiet)
    226                                 printf("Could not create thread %d\n", i);
     211                        TPRINTF("Could not create thread %d\n", i);
    227212                } else
    228213                        thread_ready(t);
     
    230215        thread_sleep(1);
    231216        condvar_broadcast(&thread_starter);
    232 
     217       
    233218        for (i = 0; i < THREADS; i++)
    234219                semaphore_down(&thr_sem);
    235220       
    236221        slab_cache_destroy(thr_cache);
    237         if (!quiet)
    238                 printf("Stress test complete.\n");
    239 }
    240 
    241 char * test_slab2(bool quiet)
    242 {
    243         sh_quiet = quiet;
    244        
    245         if (!quiet)
    246                 printf("Running reclaim single-thread test .. pass 1\n");
    247         totalmemtest(quiet);
    248         if (!quiet)
    249                 printf("Running reclaim single-thread test .. pass 2\n");
    250         totalmemtest(quiet);
    251         if (!quiet)
    252                 printf("Reclaim test OK.\n");
    253        
    254         multitest(128, quiet);
    255         multitest(2048, quiet);
    256         multitest(8192, quiet);
     222        TPRINTF("Stress test complete.\n");
     223}
     224
     225char *test_slab2(void)
     226{
     227        TPRINTF("Running reclaim single-thread test .. pass 1\n");
     228        totalmemtest();
     229       
     230        TPRINTF("Running reclaim single-thread test .. pass 2\n");
     231        totalmemtest();
     232       
     233        TPRINTF("Reclaim test OK.\n");
     234       
     235        multitest(128);
     236        multitest(2048);
     237        multitest(8192);
    257238       
    258239        return NULL;
Note: See TracChangeset for help on using the changeset viewer.