Subversion Repositories HelenOS

Rev

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

Rev 4343 Rev 4344
Line 512... Line 512...
512
 *
512
 *
513
 * @return 0 on failure, 1 on success.
513
 * @return 0 on failure, 1 on success.
514
 */
514
 */
515
int cmd_help(cmd_arg_t *argv)
515
int cmd_help(cmd_arg_t *argv)
516
{
516
{
517
    link_t *cur;
-
 
518
 
-
 
519
    spinlock_lock(&cmd_lock);
517
    spinlock_lock(&cmd_lock);
520
   
518
   
-
 
519
    link_t *cur;
-
 
520
    size_t len = 0;
521
    for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
521
    for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
522
        cmd_info_t *hlp;
522
        cmd_info_t *hlp;
523
       
-
 
524
        hlp = list_get_instance(cur, cmd_info_t, link);
523
        hlp = list_get_instance(cur, cmd_info_t, link);
-
 
524
       
525
        spinlock_lock(&hlp->lock);
525
        spinlock_lock(&hlp->lock);
-
 
526
        if (strlen(hlp->name) > len)
-
 
527
            len = strlen(hlp->name);
-
 
528
        spinlock_unlock(&hlp->lock);
-
 
529
    }
-
 
530
   
-
 
531
    for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
-
 
532
        cmd_info_t *hlp;
-
 
533
        hlp = list_get_instance(cur, cmd_info_t, link);
526
       
534
       
-
 
535
        spinlock_lock(&hlp->lock);
527
        printf("%s - %s\n", hlp->name, hlp->description);
536
        printf("%-*s %s\n", len, hlp->name, hlp->description);
528
 
-
 
529
        spinlock_unlock(&hlp->lock);
537
        spinlock_unlock(&hlp->lock);
530
    }
538
    }
531
   
539
   
532
    spinlock_unlock(&cmd_lock);
540
    spinlock_unlock(&cmd_lock);
533
 
541
   
534
    return 1;
542
    return 1;
535
}
543
}
536
 
544
 
537
 
545
 
538
/** Reboot the system.
546
/** Reboot the system.
Line 946... Line 954...
946
 *
954
 *
947
 * return Always 1.
955
 * return Always 1.
948
 */
956
 */
949
int cmd_tests(cmd_arg_t *argv)
957
int cmd_tests(cmd_arg_t *argv)
950
{
958
{
-
 
959
    size_t len = 0;
951
    test_t *test;
960
    test_t *test;
-
 
961
    for (test = tests; test->name != NULL; test++) {
-
 
962
        if (strlen(test->name) > len)
-
 
963
            len = strlen(test->name);
-
 
964
    }
952
   
965
   
953
    for (test = tests; test->name != NULL; test++)
966
    for (test = tests; test->name != NULL; test++)
954
        printf("%-10s %s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)"));
967
        printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)"));
955
   
968
   
956
    printf("%-10s Run all safe tests\n", "*");
969
    printf("%-*s Run all safe tests\n", len, "*");
957
    return 1;
970
    return 1;
958
}
971
}
959
 
972
 
960
static bool run_test(const test_t *test)
973
static bool run_test(const test_t *test)
961
{
974
{
962
    printf("%s\t\t%s\n", test->name, test->desc);
975
    printf("%s (%s)\n", test->name, test->desc);
963
   
976
   
964
    /* Update and read thread accounting
977
    /* Update and read thread accounting
965
       for benchmarking */
978
       for benchmarking */
966
    ipl_t ipl = interrupts_disable();
979
    ipl_t ipl = interrupts_disable();
967
    spinlock_lock(&TASK->lock);
980
    spinlock_lock(&TASK->lock);