Changeset 34db7fa in mainline for kernel/generic/src/console/cmd.c


Ignore:
Timestamp:
2006-12-12T12:32:02Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
96348adc
Parents:
df496c5
Message:

cleanup kernel tests infrastructure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    rdf496c5 r34db7fa  
    6868#ifdef CONFIG_TEST
    6969#include <test.h>
     70#endif
     71
     72#ifdef CONFIG_BENCH
     73#include <arch/cycle.h>
    7074#endif
    7175
     
    859863}
    860864
     865static bool run_test(const test_t * test)
     866{
     867        printf("%s\t\t%s\n", test->name, test->desc);
     868#ifdef CONFIG_BENCH
     869        uint64_t t0 = get_cycle();
     870#endif
     871        char * ret = test->entry();
     872#ifdef CONFIG_BENCH
     873        uint64_t dt = get_cycle() - t0;
     874        printf("Time: %llu cycles\n", dt);
     875#endif
     876       
     877        if (ret == NULL) {
     878                printf("Test passed\n");
     879                return true;
     880        }
     881
     882        printf("%s\n", ret);
     883        return false;
     884}
     885
    861886/** Command for returning kernel tests
    862887 *
     
    872897                for (test = tests; test->name != NULL; test++) {
    873898                        if (test->safe) {
    874                                 printf("\n%s\t\t%s\n\n", test->name, test->desc);
    875                                 test->entry();
     899                                printf("\n");
     900                                if (!run_test(test))
     901                                        break;
    876902                        }
    877903                }
     
    882908                        if (strcmp(test->name, argv->buffer) == 0) {
    883909                                fnd = true;
    884                                 test->entry();
     910                                run_test(test);
    885911                                break;
    886912                        }
     
    888914               
    889915                if (!fnd)
    890                         printf("Unknown test.\n");
     916                        printf("Unknown test\n");
    891917        }
    892918       
Note: See TracChangeset for help on using the changeset viewer.