Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3222 → Rev 3386

/branches/network/uspace/app/tester/tester.c
78,6 → 78,22
 
static void run_safe_tests(void)
{
test_t *test;
unsigned int i = 0;
unsigned int n = 0;
 
printf("\n*** Running all safe tests ***\n\n");
 
for (test = tests; test->name != NULL; test++) {
if (test->safe) {
if (run_test(test))
i++;
else
n++;
}
}
 
printf("\nSafe tests completed, %u tests run, %u passed.\n\n", i + n, i);
}
 
static void list_tests(void)
91,8 → 107,17
printf("*\t\t\tRun all safe tests\n");
}
 
int main(void)
int main(int argc, char **argv)
{
printf("Number of arguments: %d\n", argc);
if (argv) {
printf("Arguments:");
while (*argv) {
printf(" '%s'", *argv++);
}
printf("\n");
}
 
while (1) {
char c;
test_t *test;
112,10 → 137,15
printf("Unknown test\n\n");
else
run_test(test);
} else if (c == '*')
} else if (c == '*') {
run_safe_tests();
else
} else if (c < 0) {
/* got EOF */
break;
} else {
printf("Invalid test\n\n");
}
}
}
 
/branches/network/uspace/app/tester/Makefile
59,7 → 59,7
 
.PHONY: all clean depend disasm
 
all: $(OUTPUT) disasm
all: $(OUTPUT) $(OUTPUT).disasm
 
-include Makefile.depend
 
72,9 → 72,11
$(OUTPUT): $(OBJECTS) $(LIBS)
$(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
 
disasm:
$(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
disasm: $(OUTPUT).disasm
 
$(OUTPUT).disasm: $(OUTPUT)
$(OBJDUMP) -d $< >$@
 
%.o: %.S
$(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
 
/branches/network/uspace/app/tester/devmap/devmap1.c
32,7 → 32,7
#include <ipc/services.h>
#include <async.h>
#include <errno.h>
#include <../../../srv/devmap/devmap.h>
#include <ipc/devmap.h>
#include "../tester.h"
 
#include <time.h>
/branches/network/uspace/app/tester/vfs/vfs1.c
30,7 → 30,7
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vfs.h>
#include <vfs/vfs.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
43,11 → 43,24
 
char *test_vfs1(bool quiet)
{
if (mount("tmpfs", "/", "nulldev0") != EOK)
return "mount() failed.\n";
if (!quiet)
printf("mounted tmpfs on /.\n");
int rc;
 
rc = mount("tmpfs", "/", "nulldev0");
switch (rc) {
case EOK:
if (!quiet)
printf("mounted tmpfs on /\n");
break;
case EBUSY:
if (!quiet)
printf("(INFO) something is already mounted on /\n");
break;
default:
if (!quiet)
printf("(INFO) IPC returned errno %d\n", rc);
return "mount() failed.";
}
 
if (mkdir("/mydir", 0) != 0)
return "mkdir() failed.\n";
if (!quiet)
73,23 → 86,57
 
char buf[10];
 
cnt = read(fd0, buf, sizeof(buf));
if (cnt < 0)
return "read() failed.\n";
while ((cnt = read(fd0, buf, sizeof(buf)))) {
if (cnt < 0)
return "read() failed.\n";
if (!quiet)
printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt,
buf, fd0);
}
 
if (!quiet)
printf("read %d bytes: \"%.*s\", fd=%d\n", cnt, cnt, buf, fd0);
close(fd0);
 
DIR *dirp;
struct dirent *dp;
 
if (!quiet)
printf("scanning the root directory...\n");
 
dirp = opendir("/");
if (!dirp)
return "opendir() failed.";
return "opendir() failed\n";
while ((dp = readdir(dirp)))
printf("discovered node %s in /\n", dp->d_name);
closedir(dirp);
 
if (rename("/mydir/myfile", "/mydir/yourfile"))
return "rename() failed.\n";
 
if (!quiet)
printf("renamed /mydir/myfile to /mydir/yourfile\n");
 
if (unlink("/mydir/yourfile"))
return "unlink() failed.\n";
if (!quiet)
printf("unlinked file /mydir/yourfile\n");
 
if (rmdir("/mydir"))
return "rmdir() failed.\n";
 
if (!quiet)
printf("removed directory /mydir\n");
if (!quiet)
printf("scanning the root directory...\n");
 
dirp = opendir("/");
if (!dirp)
return "opendir() failed\n";
while ((dp = readdir(dirp)))
printf("discovered node %s in /\n", dp->d_name);
closedir(dirp);
 
return NULL;
}
 
/branches/network/uspace/app/tester/ipc/hangup.c
37,9 → 37,11
int res;
int phoneid;
 
printf("Select phoneid to hangup: 2-9\n");
printf("Select phoneid to hangup: 2-9 (q to skip)\n");
do {
c = getchar();
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '2' || c > '9');
phoneid = c - '0';
/branches/network/uspace/app/tester/ipc/send_sync.c
38,9 → 38,11
static int msgid = 1;
char c;
 
printf("Select phoneid to send msg: 2-9\n");
printf("Select phoneid to send msg: 2-9 (q to skip)\n");
do {
c = getchar();
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '2' || c > '9');
phoneid = c - '0';
/branches/network/uspace/app/tester/ipc/send_async.c
41,9 → 41,11
static int msgid = 1;
char c;
 
printf("Select phoneid to send msg: 2-9\n");
printf("Select phoneid to send msg: 2-9 (q to skip)\n");
do {
c = getchar();
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '2' || c > '9');
phoneid = c - '0';
 
/branches/network/uspace/app/tester/ipc/connect.c
36,9 → 36,11
int svc;
int phid;
 
printf("Choose one service: 0:10000....9:10009\n");
printf("Choose one service: 0:10000....9:10009 (q to skip)\n");
do {
c = getchar();
if ((c == 'Q') || (c == 'q'))
return TEST_SKIPPED;
} while (c < '0' || c > '9');
svc = IPC_TEST_START + c - '0';
/branches/network/uspace/app/tester/tester.h
42,6 → 42,7
#define IPC_TEST_START 10000
#define MAX_PHONES 20
#define MAX_CONNECTIONS 50
#define TEST_SKIPPED "Test Skipped"
 
extern int myservice;
extern int phones[MAX_PHONES];