Changeset 864a081 in mainline for uspace/app


Ignore:
Timestamp:
2011-05-24T03:40:00Z (14 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf49001
Parents:
5c460cc (diff), d4c472b (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.

Location:
uspace/app/tester
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/mm/common.c

    r5c460cc r864a081  
    135135}
    136136
     137static void check_consistency(const char *loc)
     138{
     139        /* Check heap consistency */
     140        void *prob = heap_check();
     141        if (prob != NULL) {
     142                TPRINTF("\nError: Heap inconsistency at %p in %s.\n",
     143                    prob, loc);
     144                TSTACKTRACE();
     145                error_flag = true;
     146        }
     147}
     148
    137149/** Checked malloc
    138150 *
     
    153165        /* Allocate the chunk of memory */
    154166        data = malloc(size);
     167        check_consistency("checked_malloc");
    155168        if (data == NULL)
    156169                return NULL;
     
    160173                TPRINTF("\nError: Allocated block overlaps with another "
    161174                    "previously allocated block.\n");
     175                TSTACKTRACE();
    162176                error_flag = true;
    163177        }
     
    198212        if (block->addr == NULL) {
    199213                free(block);
     214                check_consistency("alloc_block");
    200215                return NULL;
    201216        }
     
    228243        /* Free the memory */
    229244        free(block->addr);
     245        check_consistency("free_block (a)");
    230246        free(block);
     247        check_consistency("free_block (b)");
    231248}
    232249
     
    257274            pos < end; pos++)
    258275                *pos = block_expected_value(block, pos);
     276       
     277        check_consistency("fill_block");
    259278}
    260279
     
    273292                if (*pos != block_expected_value(block, pos)) {
    274293                        TPRINTF("\nError: Corrupted content of a data block.\n");
     294                        TSTACKTRACE();
    275295                        error_flag = true;
    276296                        return;
     
    296316        if (entry == NULL) {
    297317                TPRINTF("\nError: Corrupted list of allocated memory blocks.\n");
     318                TSTACKTRACE();
    298319                error_flag = true;
    299320        }
     
    325346        if (addr == NULL) {
    326347                free(area);
     348                check_consistency("map_area (a)");
    327349                return NULL;
    328350        }
     
    331353        if (area->addr == (void *) -1) {
    332354                free(area);
     355                check_consistency("map_area (b)");
    333356                return NULL;
    334357        }
     
    361384       
    362385        free(area);
     386        check_consistency("unmap_area");
    363387}
    364388
     
    389413            pos < end; pos++)
    390414                *pos = area_expected_value(area, pos);
    391 }
     415       
     416        check_consistency("fill_area");
     417}
  • uspace/app/tester/mm/malloc1.c

    r5c460cc r864a081  
    241241                                TPRINTF("A");
    242242                                fill_block(blk);
     243                                RETURN_IF_ERROR;
    243244                        }
    244245                       
  • uspace/app/tester/mm/malloc3.c

    r5c460cc r864a081  
    232232                                TPRINTF("A");
    233233                                fill_block(blk);
     234                                RETURN_IF_ERROR;
    234235                               
    235236                                if ((mem_blocks_count % AREA_GRANULARITY) == 0) {
    236237                                        mem_area_t *area = map_area(AREA_SIZE);
    237238                                        RETURN_IF_ERROR;
     239                                       
    238240                                        if (area != NULL) {
    239241                                                TPRINTF("*");
    240242                                                fill_area(area);
     243                                                RETURN_IF_ERROR;
    241244                                        } else
    242245                                                TPRINTF("F(*)");
  • uspace/app/tester/tester.h

    r5c460cc r864a081  
    3838#include <sys/types.h>
    3939#include <bool.h>
     40#include <stacktrace.h>
    4041
    4142#define IPC_TEST_SERVICE  10240
     
    5960                if (!test_quiet) { \
    6061                        fprintf(stderr, (format), ##__VA_ARGS__); \
     62                } \
     63        } while (0)
     64
     65#define TSTACKTRACE() \
     66        do { \
     67                if (!test_quiet) { \
     68                        stacktrace_print(); \
    6169                } \
    6270        } while (0)
Note: See TracChangeset for help on using the changeset viewer.