Changeset e6a78b9 in mainline for kernel/test/mm/falloc1.c


Ignore:
Timestamp:
2012-06-29T15:31:44Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9432f08
Parents:
34ab31c (diff), 0bbd13e (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 mainline changes.

File:
1 edited

Legend:

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

    r34ab31c re6a78b9  
    3737#include <align.h>
    3838
    39 #define MAX_FRAMES  1024
     39#define MAX_FRAMES  1024U
    4040#define MAX_ORDER   8
    4141#define TEST_RUNS   2
    4242
    43 const char *test_falloc1(void) {
    44         uintptr_t *frames
    45             = (uintptr_t *) malloc(MAX_FRAMES * sizeof(uintptr_t), 0);
    46         int results[MAX_ORDER + 1];
    47        
    48         int i, order, run;
    49         int allocated;
    50        
     43const char *test_falloc1(void)
     44{
    5145        if (TEST_RUNS < 2)
    5246                return "Test is compiled with TEST_RUNS < 2";
    5347       
     48        uintptr_t *frames = (uintptr_t *)
     49            malloc(MAX_FRAMES * sizeof(uintptr_t), 0);
    5450        if (frames == NULL)
    5551                return "Unable to allocate frames";
    5652       
    57         for (run = 0; run < TEST_RUNS; run++) {
    58                 for (order = 0; order <= MAX_ORDER; order++) {
    59                         TPRINTF("Allocating %d frames blocks ... ", 1 << order);
     53        unsigned int results[MAX_ORDER + 1];
     54        for (unsigned int run = 0; run < TEST_RUNS; run++) {
     55                for (unsigned int order = 0; order <= MAX_ORDER; order++) {
     56                        TPRINTF("Allocating %u frames blocks ... ", 1 << order);
    6057                       
    61                         allocated = 0;
    62                         for (i = 0; i < MAX_FRAMES >> order; i++) {
    63                                 frames[allocated] = (uintptr_t) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
     58                        unsigned int allocated = 0;
     59                        for (unsigned int i = 0; i < (MAX_FRAMES >> order); i++) {
     60                                frames[allocated] = (uintptr_t)
     61                                    frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
    6462                               
    65                                 if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
    66                                         TPRINTF("Block at address %p (size %dK) is not aligned\n",
     63                                if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) !=
     64                                    frames[allocated]) {
     65                                        TPRINTF("Block at address %p (size %u) is not aligned\n",
    6766                                            (void *) frames[allocated], (FRAME_SIZE << order) >> 10);
    6867                                        return "Test failed";
     
    8786                        TPRINTF("Deallocating ... ");
    8887                       
    89                         for (i = 0; i < allocated; i++)
     88                        for (unsigned int i = 0; i < allocated; i++)
    9089                                frame_free(KA2PA(frames[i]));
    9190                       
Note: See TracChangeset for help on using the changeset viewer.