Subversion Repositories HelenOS

Rev

Rev 2039 | Rev 2050 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2039 Rev 2042
Line 54... Line 54...
54
#include <debug.h>
54
#include <debug.h>
55
#include <symtab.h>
55
#include <symtab.h>
56
#include <cpu.h>
56
#include <cpu.h>
57
#include <mm/tlb.h>
57
#include <mm/tlb.h>
58
#include <arch/mm/tlb.h>
58
#include <arch/mm/tlb.h>
59
#include <mm/as.h>
-
 
60
#include <mm/frame.h>
59
#include <mm/frame.h>
61
#include <main/version.h>
60
#include <main/version.h>
62
#include <mm/slab.h>
61
#include <mm/slab.h>
63
#include <proc/scheduler.h>
62
#include <proc/scheduler.h>
64
#include <proc/thread.h>
63
#include <proc/thread.h>
Line 857... Line 856...
857
   
856
   
858
    printf("*\t\tRun all safe tests\n");
857
    printf("*\t\tRun all safe tests\n");
859
    return 1;
858
    return 1;
860
}
859
}
861
 
860
 
862
static void test_wrapper(void *arg)
861
static bool run_test(const test_t *test)
863
{
862
{
864
    test_t *test = (test_t *) arg;
863
    printf("%s\t\t%s\n", test->name, test->desc);
865
   
864
   
866
    /* Update and read thread accounting
865
    /* Update and read thread accounting
867
       for benchmarking */
866
       for benchmarking */
868
    ipl_t ipl = interrupts_disable();
867
    ipl_t ipl = interrupts_disable();
869
    spinlock_lock(&TASK->lock);
868
    spinlock_lock(&TASK->lock);
Line 883... Line 882...
883
   
882
   
884
    printf("Time: %llu cycles\n", dt);
883
    printf("Time: %llu cycles\n", dt);
885
   
884
   
886
    if (ret == NULL) {
885
    if (ret == NULL) {
887
        printf("Test passed\n");
886
        printf("Test passed\n");
888
//      return true;
887
        return true;
889
        return;
-
 
890
    }
888
    }
891
 
889
 
892
    printf("%s\n", ret);
890
    printf("%s\n", ret);
893
//  return false;
-
 
894
}
-
 
895
 
-
 
896
static bool run_test(const test_t *test)
-
 
897
{
-
 
898
    printf("%s\t\t%s\n", test->name, test->desc);
-
 
899
   
-
 
900
    /* Create separate task and thread
-
 
901
       for the test */
-
 
902
    task_t *ta = task_create(AS_KERNEL, "test");
-
 
903
    if (ta == NULL) {
-
 
904
        printf("Unable to create test task\n");
-
 
905
        return false;
891
    return false;
906
    }
-
 
907
   
-
 
908
    thread_t *t = thread_create(test_wrapper, (void *) test, ta, 0, "test_main");
-
 
909
    if (t == NULL) {
-
 
910
        printf("Unable to create test main thread\n");
-
 
911
        task_destroy(ta);
-
 
912
        return false;
-
 
913
    }
-
 
914
   
-
 
915
    /* Run the test */
-
 
916
    thread_ready(t);
-
 
917
    thread_join(t);
-
 
918
    thread_detach(t);
-
 
919
   
-
 
920
    return true;
-
 
921
}
892
}
922
 
893
 
923
/** Command for returning kernel tests
894
/** Command for returning kernel tests
924
 *
895
 *
925
 * @param argv Argument vector.
896
 * @param argv Argument vector.