Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2785 → Rev 2787

/branches/tracing/uspace/app/tester/tester.c
57,6 → 57,7
#include "ipc/hangup.def"
#include "devmap/devmap1.def"
#include "vfs/vfs1.def"
#include "tdebug/tdebug1.def"
{NULL, NULL, NULL}
};
 
79,9 → 80,10
static void run_safe_tests(void)
{
test_t *test;
int i = 0, n = 0;
unsigned int i = 0;
unsigned int n = 0;
 
printf("\n*** Running all safe tests\n\n");
printf("\n*** Running all safe tests ***\n\n");
 
for (test = tests; test->name != NULL; test++) {
if (test->safe) {
92,7 → 94,7
}
}
 
printf("\nSafe tests completed, %d tests run, %d passed.\n\n", i + n, i);
printf("\nSafe tests completed, %u tests run, %u passed.\n\n", i + n, i);
}
 
static void list_tests(void)
/branches/tracing/uspace/app/tester/tdebug/tdebug1.def
0,0 → 1,6
{
"tdebug1",
"Tdebug interface test",
&test_tdebug1,
true
},
/branches/tracing/uspace/app/tester/tdebug/tdebug1.c
0,0 → 1,147
#include <stdio.h>
#include <unistd.h>
#include <task.h>
#include <tdebug.h>
#include <async.h>
#include <sys/types.h>
#include <time.h>
 
#include "../tester.h"
 
static char *syscall_name[] = {
"sys_io",
"sys_tls_set",
"sys_thread_create",
"sys_thread_exit",
"sys_thread_get_id",
"sys_task_get_id",
"sys_futex_sleep_timeout",
"sys_futex_wakeup",
"sys_as_area_create",
"sys_as_area_resize",
"sys_as_area_destroy",
"sys_ipc_call_sync_fast",
"sys_ipc_call_sync_slow",
"sys_ipc_call_async_fast",
"sys_ipc_call_async_slow",
"sys_ipc_answer_fast",
"sys_ipc_answer_slow",
"sys_ipc_forward_fast",
"sys_ipc_wait_for_call",
"sys_ipc_hangup",
"sys_ipc_register_irq",
"sys_ipc_unregister_irq",
"sys_cap_grant",
"sys_cap_revoke",
"sys_physmem_map",
"sys_iospace_enable",
"sys_preempt_control",
"sys_sysinfo_valid",
"sys_sysinfo_value",
"sys_debug_enable_console",
"sys_tdebug_attach_task",
"sys_tdebug_continue_thread",
"sys_tdebug_get_syscall_args"
"sys_tdebug_set_event_mask",
"sys_tdebug_stop_thread",
"sys_tdebug_stop_task"
};
 
static void event_syscall(thread_id_t tid, sysarg_t syscall_id, sysarg_t rc)
{
sysarg_t sc_args[6];
size_t buf_len;
int res;
 
buf_len = 6;
 
res = tdebug_get_syscall_args(tid, sc_args, &buf_len);
if (res != 0) {
printf("tdebug_get_syscall_args() -> %d\n", res);
}
 
printf("%s(", syscall_name[syscall_id]);
 
switch (syscall_id) {
case SYS_TLS_SET: printf("0x%08x", sc_args[0]); break;
case SYS_IPC_WAIT: printf("0x%08x, %u, %d", sc_args[0], sc_args[1], sc_args[2]); break;
default:
printf("%u, %u, %u, %u, %u, %u",
sc_args[0], sc_args[1], sc_args[2],
sc_args[3], sc_args[4], sc_args[5]);
break;
}
 
printf(") -> %d\n", rc);
}
 
static void event_exception(sysarg_t exc_no)
{
printf("exception %u\n", exc_no);
}
 
 
static void notif_handler(ipc_callid_t iid, ipc_call_t *call)
{
thread_id_t tid;
sysarg_t method;
sysarg_t tid_lo, tid_hi, ev_type, syscall_id, rc;
sysarg_t exc_no;
int res;
 
(void)iid;
 
method = IPC_GET_METHOD(*call);
tid_lo = IPC_GET_ARG1(*call);
tid_hi = IPC_GET_ARG2(*call);
ev_type = IPC_GET_ARG3(*call);
 
tid = (thread_id_t)tid_lo | ((thread_id_t)tid_hi << 32);
 
switch (ev_type) {
case TDEBUG_EV_SYSCALL:
syscall_id = IPC_GET_ARG4(*call);
rc = IPC_GET_ARG5(*call);
event_syscall(tid, syscall_id, rc);
break;
case TDEBUG_EV_EXCEPTION:
exc_no = IPC_GET_ARG4(*call);
event_exception(exc_no);
break;
default:
printf("unknown tdebug event notification %u\n", ev_type);
break;
}
 
res = tdebug_continue_thread(tid);
if (res != 0) {
printf("tdebug_continue_thread() -> %d\n", res);
}
}
 
char *test_tdebug1(bool quiet)
{
task_id_t taskid;
int result;
 
async_set_interrupt_received(notif_handler);
 
printf("test_tdebug1()\n");
taskid = 12;
// tid = task_get_id();
// printf("this task id is %d\n", tid);
printf("attaching...\n");
result = tdebug_attach_task(taskid, 368);
printf("result is %d\n", result);
getchar();
/* printf("setting event mask...\n");
result = tdebug_set_event_mask(taskid, TDEBUG_EVMASK_IAFTER);
printf("result is %d\n", result);
getchar();
*/
printf("detaching...\n");
result = tdebug_detach_task(taskid);
printf("result is %d\n", result);
 
return NULL;
}
/branches/tracing/uspace/app/tester/ipc/hangup.c
37,10 → 37,10
int res;
int phoneid;
 
printf("Select phoneid to hangup: 2-9 (Q to skip)\n");
printf("Select phoneid to hangup: 2-9 (q to skip)\n");
do {
c = getchar();
if (c == 'Q' || c == 'q')
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '2' || c > '9');
phoneid = c - '0';
/branches/tracing/uspace/app/tester/ipc/send_sync.c
38,10 → 38,10
static int msgid = 1;
char c;
 
printf("Select phoneid to send msg: 2-9 (Q to skip)\n");
printf("Select phoneid to send msg: 2-9 (q to skip)\n");
do {
c = getchar();
if (c == 'Q' || c == 'q')
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '2' || c > '9');
phoneid = c - '0';
/branches/tracing/uspace/app/tester/ipc/send_async.c
41,10 → 41,10
static int msgid = 1;
char c;
 
printf("Select phoneid to send msg: 2-9 (Q to skip)\n");
printf("Select phoneid to send msg: 2-9 (q to skip)\n");
do {
c = getchar();
if (c == 'Q' || c == 'q')
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '2' || c > '9');
phoneid = c - '0';
/branches/tracing/uspace/app/tester/ipc/connect.c
36,10 → 36,10
int svc;
int phid;
 
printf("Choose one service: 0:10000....9:10009 (Q to skip)\n");
printf("Choose one service: 0:10000....9:10009 (q to skip)\n");
do {
c = getchar();
if (c == 'Q' || c == 'q')
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '0' || c > '9');
/branches/tracing/uspace/app/tester/tester.h
70,6 → 70,7
extern char * test_hangup(bool quiet);
extern char * test_devmap1(bool quiet);
extern char * test_vfs1(bool quiet);
extern char * test_tdebug1(bool quiet);
 
extern test_t tests[];
 
/branches/tracing/uspace/app/tester/Makefile
53,7 → 53,8
ipc/answer.c \
ipc/hangup.c \
devmap/devmap1.c \
vfs/vfs1.c
vfs/vfs1.c \
tdebug/tdebug1.c
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))