예제 #1
0
파일: main.c 프로젝트: wuwx/simba
int test_log_mask(struct harness_t *harness_p)
{
    char command[64];

    BTASSERT(thrd_get_log_mask() == 0x0f);
    BTASSERT(thrd_set_log_mask(thrd_self(), 0x00) == 0x0f);
    BTASSERT(thrd_get_log_mask() == 0x00);

    strcpy(command, "/kernel/thrd/set_log_mask main 0xff");
    BTASSERT(fs_call(command, NULL, sys_get_stdout(), NULL) == 0);
    BTASSERT(thrd_get_log_mask() == 0xff);

    /* Invalid arguments. */
    strcpy(command, "/kernel/thrd/set_log_mask");
    BTASSERT(fs_call(command, NULL, sys_get_stdout(), NULL) == -EINVAL);
    BTASSERT(thrd_get_log_mask() == 0xff);

    strcpy(command, "/kernel/thrd/set_log_mask foo bar");
    BTASSERT(fs_call(command, NULL, sys_get_stdout(), NULL) == -ESRCH);
    BTASSERT(thrd_get_log_mask() == 0xff);

    strcpy(command, "/kernel/thrd/set_log_mask main foo");
    BTASSERT(fs_call(command, NULL, sys_get_stdout(), NULL) == -EINVAL);
    BTASSERT(thrd_get_log_mask() == 0xff);

    return (0);
}
예제 #2
0
static mp_obj_t module_thrd_get_log_mask(void)
{
    return (MP_OBJ_NEW_SMALL_INT(thrd_get_log_mask()));
}