Changeset 7bdcc45 in mainline for kernel/test


Ignore:
Timestamp:
2010-12-16T16:38:49Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7837101
Parents:
8e58f94 (diff), eb221e5 (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:
kernel/test
Files:
1 added
16 edited
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/test/avltree/avltree1.c

    r8e58f94 r7bdcc45  
    202202        avltree_create(tree);
    203203       
    204         TPRINTF("Inserting %" PRIs " nodes...", node_count);
     204        TPRINTF("Inserting %zu nodes...", node_count);
    205205       
    206206        for (i = 0; i < node_count; i++) {
  • kernel/test/fpu/fpu1_ia64.c

    r8e58f94 r7bdcc45  
    8585               
    8686                if ((int) (100000000 * e) != E_10e8) {
    87                         TPRINTF("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, (sysarg_t) (100000000 * e), (sysarg_t) E_10e8);
    8888                        atomic_inc(&threads_fault);
    8989                        break;
     
    118118               
    119119                if ((int) (1000000 * pi) != PI_10e8) {
    120                         TPRINTF("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, (sysarg_t) (1000000 * pi), (sysarg_t) (PI_10e8 / 100));
    121121                        atomic_inc(&threads_fault);
    122122                        break;
     
    161161       
    162162        while (atomic_get(&threads_ok) != total) {
    163                 TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
     163                TPRINTF("Threads left: %" PRIua "\n",
     164                    total - atomic_get(&threads_ok));
    164165                thread_sleep(1);
    165166        }
  • kernel/test/fpu/fpu1_x86.c

    r8e58f94 r7bdcc45  
    8282               
    8383                if ((int) (100000000 * e) != E_10e8) {
    84                         TPRINTF("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=%" PRIun " should be %" PRIun "\n",
     85                            THREAD->tid, (sysarg_t) (100000000 * e), (sysarg_t) E_10e8);
    8586                        atomic_inc(&threads_fault);
    8687                        break;
     
    115116               
    116117                if ((int) (100000000 * pi) != PI_10e8) {
    117                         TPRINTF("tid%" PRIu64 ": pi*10e8=%zd should be %" PRIun "\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8);
     118                        TPRINTF("tid%" PRIu64 ": pi*10e8=%" PRIun " should be %" PRIun "\n",
     119                            THREAD->tid, (sysarg_t) (100000000 * pi), (sysarg_t) PI_10e8);
    118120                        atomic_inc(&threads_fault);
    119121                        break;
     
    158160       
    159161        while (atomic_get(&threads_ok) != total) {
    160                 TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
     162                TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_ok));
    161163                thread_sleep(1);
    162164        }
  • kernel/test/fpu/mips2.c

    r8e58f94 r7bdcc45  
    4848{
    4949        int i;
    50         int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
     50        int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
    5151        int after_arg __attribute__((aligned(16)));
    5252       
     
    8080{
    8181        int i;
    82         int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
     82        int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
    8383        int after_arg __attribute__((aligned(16)));
    8484       
     
    123123                thread_t *t;
    124124               
    125                 if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
     125                if (!(t = thread_create(testit1, (void *) ((sysarg_t) 2 * i), TASK, 0, "testit1", false))) {
    126126                        TPRINTF("could not create thread %u\n", 2 * i);
    127127                        break;
     
    130130                total++;
    131131               
    132                 if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
     132                if (!(t = thread_create(testit2, (void *) ((sysarg_t) 2 * i + 1), TASK, 0, "testit2", false))) {
    133133                        TPRINTF("could not create thread %u\n", 2 * i + 1);
    134134                        break;
  • kernel/test/fpu/sse1.c

    r8e58f94 r7bdcc45  
    4848{
    4949        int i;
    50         int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
     50        int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
    5151        int after_arg __attribute__((aligned(16)));
    5252       
     
    7979{
    8080        int i;
    81         int arg __attribute__((aligned(16))) = (int) ((unative_t) data);
     81        int arg __attribute__((aligned(16))) = (int) ((sysarg_t) data);
    8282        int after_arg __attribute__((aligned(16)));
    8383       
     
    121121                thread_t *t;
    122122               
    123                 if (!(t = thread_create(testit1, (void *) ((unative_t) 2 * i), TASK, 0, "testit1", false))) {
     123                if (!(t = thread_create(testit1, (void *) ((sysarg_t) 2 * i), TASK, 0, "testit1", false))) {
    124124                        TPRINTF("could not create thread %u\n", 2 * i);
    125125                        break;
     
    128128                total++;
    129129               
    130                 if (!(t = thread_create(testit2, (void *) ((unative_t) 2 * i + 1), TASK, 0, "testit2", false))) {
     130                if (!(t = thread_create(testit2, (void *) ((sysarg_t) 2 * i + 1), TASK, 0, "testit2", false))) {
    131131                        TPRINTF("could not create thread %u\n", 2 * i + 1);
    132132                        break;
     
    142142       
    143143        while (atomic_get(&threads_ok) != total) {
    144                 TPRINTF("Threads left: %d\n", total - atomic_get(&threads_ok));
     144                TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_ok));
    145145                thread_sleep(1);
    146146        }
  • kernel/test/mm/falloc1.c

    r8e58f94 r7bdcc45  
    6464                               
    6565                                if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) {
    66                                         TPRINTF("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",
     67                                            (void *) frames[allocated], (FRAME_SIZE << order) >> 10);
    6768                                        return "Test failed";
    6869                                }
  • kernel/test/mm/falloc2.c

    r8e58f94 r7bdcc45  
    8585                                for (k = 0; k <= (((size_t) FRAME_SIZE << order) - 1); k++) {
    8686                                        if (((uint8_t *) frames[i])[k] != val) {
    87                                                 TPRINTF("Thread #%" PRIu64 " (cpu%u): Unexpected data (%c) in block %p offset %#" PRIs "\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 %zu\n",
     88                                                    THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);
    8889                                                atomic_inc(&thread_fail);
    8990                                                goto cleanup;
     
    121122       
    122123        while (atomic_get(&thread_count) > 0) {
    123                 TPRINTF("Threads left: %ld\n", atomic_get(&thread_count));
     124                TPRINTF("Threads left: %" PRIua "\n", atomic_get(&thread_count));
    124125                thread_sleep(1);
    125126        }
  • kernel/test/mm/mapping1.c

    r8e58f94 r7bdcc45  
    3939#define PAGE1  (PAGE0 + PAGE_SIZE)
    4040
    41 #define VALUE0  0x01234567
    42 #define VALUE1  0x89abcdef
     41#define VALUE0  UINT32_C(0x01234567)
     42#define VALUE1  UINT32_C(0x89abcdef)
    4343
    4444const char *test_mapping1(void)
     
    5050        frame1 = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_KA);
    5151       
    52         TPRINTF("Writing %#x to physical address %p.\n", VALUE0, KA2PA(frame0));
     52        TPRINTF("Writing %#" PRIx32 " to physical address %p.\n",
     53            (uint32_t) VALUE0, (void *) KA2PA(frame0));
    5354        *((uint32_t *) frame0) = VALUE0;
    5455       
    55         TPRINTF("Writing %#x to physical address %p.\n", VALUE1, KA2PA(frame1));
     56        TPRINTF("Writing %#" PRIx32 " to physical address %p.\n",
     57            (uint32_t) VALUE1, (void *) KA2PA(frame1));
    5658        *((uint32_t *) frame1) = VALUE1;
    5759       
    58         TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE0, KA2PA(frame0));
     60        TPRINTF("Mapping virtual address %p to physical address %p.\n",
     61            (void *) PAGE0, (void *) KA2PA(frame0));
    5962        page_mapping_insert(AS_KERNEL, PAGE0, KA2PA(frame0), PAGE_PRESENT | PAGE_WRITE);
    6063       
    61         TPRINTF("Mapping virtual address %p to physical address %p.\n", PAGE1, KA2PA(frame1));
     64        TPRINTF("Mapping virtual address %p to physical address %p.\n",
     65            (void *) PAGE1, (void *) KA2PA(frame1));
    6266        page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE);
    6367       
    6468        v0 = *((uint32_t *) PAGE0);
    6569        v1 = *((uint32_t *) PAGE1);
    66         TPRINTF("Value at virtual address %p is %#x.\n", PAGE0, v0);
    67         TPRINTF("Value at virtual address %p is %#x.\n", PAGE1, v1);
     70        TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
     71            (void *) PAGE0, v0);
     72        TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
     73            (void *) PAGE1, v1);
    6874       
    6975        if (v0 != VALUE0)
     
    7278                return "Value at v1 not equal to VALUE1";
    7379       
    74         TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE0);
     80        TPRINTF("Writing %#" PRIx32 " to virtual address %p.\n",
     81            (uint32_t) 0, (void *) PAGE0);
    7582        *((uint32_t *) PAGE0) = 0;
    7683       
    77         TPRINTF("Writing %#x to virtual address %p.\n", 0, PAGE1);
     84        TPRINTF("Writing %#" PRIx32 " to virtual address %p.\n",
     85            (uint32_t) 0, (void *) PAGE1);
    7886        *((uint32_t *) PAGE1) = 0;
    7987       
     
    8189        v1 = *((uint32_t *) PAGE1);
    8290       
    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));
     91        TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
     92            (void *) PAGE0, *((uint32_t *) PAGE0));
     93        TPRINTF("Value at virtual address %p is %#" PRIx32 ".\n",
     94            (void *) PAGE1, *((uint32_t *) PAGE1));
    8595       
    8696        if (v0 != 0)
  • kernel/test/mm/slab1.c

    r8e58f94 r7bdcc45  
    123123static void slabtest(void *data)
    124124{
    125         int offs = (int) (unative_t) data;
     125        int offs = (int) (sysarg_t) data;
    126126        int i, j;
    127127       
     
    156156        semaphore_initialize(&thr_sem, 0);
    157157        for (i = 0; i < THREADS; i++) { 
    158                 if (!(t = thread_create(slabtest, (void *) (unative_t) i, TASK, 0, "slabtest", false))) {
     158                if (!(t = thread_create(slabtest, (void *) (sysarg_t) i, TASK, 0, "slabtest", false))) {
    159159                        TPRINTF("Could not create thread %d\n", i);
    160160                } else
  • kernel/test/print/print1.c

    r8e58f94 r7bdcc45  
    4848        TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
    4949       
    50         TPRINTF("Testing printf(\"%%s\", NULL):\n");
    51         TPRINTF("Expected output: \"(NULL)\"\n");
    52         TPRINTF("Real output:     \"%s\"\n\n", NULL);
    53        
    5450        return NULL;
    5551}
  • kernel/test/print/print2.c

    r8e58f94 r7bdcc45  
    3232const char *test_print2(void)
    3333{
    34         TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
    35         TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
    36         TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
     34        TPRINTF("Testing printf(\"%%c\", 'a'):\n");
     35        TPRINTF("Expected output: [a]\n");
     36        TPRINTF("Real output:     [%c]\n\n", 'a');
    3737       
    3838        TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
     
    4848        TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
    4949       
    50         unative_t nat = 0x12345678u;
     50        sysarg_t nat = UINTN_C(0x12345678);
    5151       
    52         TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", 0x1234567887654321ll, 0x12345678, 0x1234, 0x12, nat, 0x1234567887654321ull, \"Lovely string\"):\n");
     52        TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), \"Lovely string\"):\n");
    5353        TPRINTF("Expected output: [0x1234567887654321] [0x12345678] [0x1234] [0x12] [0x12345678] [0x1234567887654321] \"Lovely string\"\n");
    54         TPRINTF("Real output:     [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", 0x1234567887654321ll, 0x12345678, 0x1234, 0x12, nat, 0x1234567887654321ull, "Lovely string");
     54        TPRINTF("Real output:     [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), "Lovely string");
    5555       
    5656        return NULL;
  • kernel/test/print/print4.c

    r8e58f94 r7bdcc45  
    4444                TPRINTF("  ");
    4545                for (index = 0; index < 32; index++)
    46                         TPRINTF("%lc", (wchar_t) ((group << 5) + index));
     46                        TPRINTF("%lc", (wint_t) ((group << 5) + index));
    4747               
    4848                TPRINTF("\n");
     
    5656                uint8_t index;
    5757                for (index = 0; index < 32; index++)
    58                         TPRINTF("%lc", (wchar_t) ((group << 5) + index));
     58                        TPRINTF("%lc", (wint_t) ((group << 5) + index));
    5959               
    6060                TPRINTF("\n");
  • kernel/test/print/print5.c

    r8e58f94 r7bdcc45  
    11/*
    2  * Copyright (c) 2006 Jakub Jermar
     2 * Copyright (c) 2005 Josef Cejka
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup generic
    30  * @{
     29/*
     30 * This test tests several features of the HelenOS
     31 * printf() implementation which go beyond the POSIX
     32 * specification and GNU printf() behaviour.
     33 *
     34 * Therefore we disable printf() argument checking by
     35 * the GCC compiler in this source file to avoid false
     36 * positives.
     37 *
    3138 */
     39#define NVERIFY_PRINTF
    3240
    33 /**
    34  * @file
    35  * @brief Wrapper for explicit 64-bit arguments passed to syscalls.
    36  */
     41#include <print.h>
     42#include <test.h>
    3743
    38 #ifndef KERN_SYSARG64_H_
    39 #define KERN_SYSARG64_H_
    40 
    41 typedef struct {
    42         unsigned long long value;
    43 } sysarg64_t;
    44 
    45 #endif
    46 
    47 /** @}
    48  */
     44const char *test_print5(void)
     45{
     46        TPRINTF("Testing printf(\"%%s\", NULL):\n");
     47        TPRINTF("Expected output: \"(NULL)\"\n");
     48        TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
     49       
     50        TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
     51        TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
     52        TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
     53       
     54        return NULL;
     55}
  • kernel/test/synch/semaphore1.c

    r8e58f94 r7bdcc45  
    8888                producers = (4 - i) * PRODUCERS;
    8989               
    90                 TPRINTF("Creating %d consumers and %d producers...", consumers, producers);
     90                TPRINTF("Creating %" PRIua " consumers and %" PRIua " producers...",
     91                    consumers, producers);
    9192               
    9293                for (j = 0; j < (CONSUMERS + PRODUCERS) / 2; j++) {
     
    113114               
    114115                while ((items_consumed.count != consumers) || (items_produced.count != producers)) {
    115                         TPRINTF("%d consumers remaining, %d producers remaining\n", consumers - items_consumed.count, producers - items_produced.count);
     116                        TPRINTF("%" PRIua " consumers remaining, %" PRIua " producers remaining\n",
     117                            consumers - items_consumed.count, producers - items_produced.count);
    116118                        thread_sleep(1);
    117119                }
  • kernel/test/test.c

    r8e58f94 r7bdcc45  
    5757#include <print/print3.def>
    5858#include <print/print4.def>
     59#include <print/print5.def>
    5960#include <thread/thread1.def>
    6061        {
  • kernel/test/test.h

    r8e58f94 r7bdcc45  
    7676extern const char *test_print3(void);
    7777extern const char *test_print4(void);
     78extern const char *test_print5(void);
    7879extern const char *test_thread1(void);
    7980
  • kernel/test/thread/thread1.c

    r8e58f94 r7bdcc45  
    7676        atomic_set(&finish, 0);
    7777        while (atomic_get(&threads_finished) < total) {
    78                 TPRINTF("Threads left: %d\n", total - atomic_get(&threads_finished));
     78                TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_finished));
    7979                thread_sleep(1);
    8080        }
Note: See TracChangeset for help on using the changeset viewer.