Index: uspace/app/tester/Makefile
===================================================================
--- uspace/app/tester/Makefile	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/Makefile	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -46,20 +46,18 @@
 	thread/thread1.c \
 	print/print1.c \
+	print/print2.c \
+	print/print3.c \
 	print/print4.c \
-	fault/fault1.c \
-	fault/fault2.c \
-	ipc/register.c \
-	ipc/connect.c \
-	ipc/send_async.c \
-	ipc/send_sync.c \
-	ipc/answer.c \
-	ipc/hangup.c \
-	ipc/ping_pong.c \
-	loop/loop1.c \
-	devmap/devmap1.c \
 	console/console1.c \
 	stdio/stdio1.c \
 	stdio/stdio2.c \
-	vfs/vfs1.c
+	fault/fault1.c \
+	fault/fault2.c \
+	vfs/vfs1.c \
+	ipc/ping_pong.c \
+	ipc/register.c \
+	ipc/connect.c \
+	loop/loop1.c \
+	mm/malloc1.c
 
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
Index: uspace/app/tester/console/console1.c
===================================================================
--- uspace/app/tester/console/console1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/console/console1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -47,26 +47,71 @@
 };
 
-char * test_console1(bool quiet)
+char *test_console1(void)
 {
-	int i, j;
-
-	printf("Style test: ");
-	fflush(stdout);
-	console_set_style(fphone(stdout), STYLE_NORMAL);
-	printf("normal ");
-	fflush(stdout);
-	console_set_style(fphone(stdout), STYLE_EMPHASIS);
-	printf("emphasized");
-	fflush(stdout);
-	console_set_style(fphone(stdout), STYLE_NORMAL);
-	printf(".\n");
-
-	printf("Foreground color test:\n");
-	for (j = 0; j < 2; j++) {
-		for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
+	if (!test_quiet) {
+		printf("Style test: ");
+		fflush(stdout);
+		console_set_style(fphone(stdout), STYLE_NORMAL);
+		printf("normal ");
+		fflush(stdout);
+		console_set_style(fphone(stdout), STYLE_EMPHASIS);
+		printf("emphasized");
+		fflush(stdout);
+		console_set_style(fphone(stdout), STYLE_NORMAL);
+		printf(".\n");
+		
+		unsigned int i;
+		unsigned int j;
+		
+		printf("\nForeground color test:\n");
+		for (j = 0; j < 2; j++) {
+			for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
+				fflush(stdout);
+				console_set_color(fphone(stdout), i, COLOR_WHITE,
+				    j ? CATTR_BRIGHT : 0);
+				printf(" %s ", color_name[i]);
+			}
 			fflush(stdout);
-			console_set_color(fphone(stdout), i, COLOR_WHITE,
-			    j ? CATTR_BRIGHT : 0);
-			printf(" %s ", color_name[i]);
+			console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
+			putchar('\n');
+		}
+		
+		printf("\nBackground color test:\n");
+		for (j = 0; j < 2; j++) {
+			for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
+				fflush(stdout);
+				console_set_color(fphone(stdout), COLOR_WHITE, i,
+				    j ? CATTR_BRIGHT : 0);
+				printf(" %s ", color_name[i]);
+			}
+			fflush(stdout);
+			console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
+			putchar('\n');
+		}
+		
+		printf("\nRGB colors test:\n");
+		
+		for (i = 0; i < 255; i += 16) {
+			fflush(stdout);
+			console_set_rgb_color(fphone(stdout), 0xffffff, i << 16);
+			putchar('X');
+		}
+		fflush(stdout);
+		console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
+		putchar('\n');
+		
+		for (i = 0; i < 255; i += 16) {
+			fflush(stdout);
+			console_set_rgb_color(fphone(stdout), 0xffffff, i << 8);
+			putchar('X');
+		}
+		fflush(stdout);
+		console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
+		putchar('\n');
+		
+		for (i = 0; i < 255; i += 16) {
+			fflush(stdout);
+			console_set_rgb_color(fphone(stdout), 0xffffff, i);
+			putchar('X');
 		}
 		fflush(stdout);
@@ -74,50 +119,5 @@
 		putchar('\n');
 	}
-
-	printf("Background color test:\n");
-	for (j = 0; j < 2; j++) {
-		for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
-			fflush(stdout);
-			console_set_color(fphone(stdout), COLOR_WHITE, i,
-			    j ? CATTR_BRIGHT : 0);
-			printf(" %s ", color_name[i]);
-		}
-		fflush(stdout);
-		console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
-		putchar('\n');
-	}
-
-	printf("Now let's test RGB colors:\n");
-
-	for (i = 0; i < 255; i += 16) {
-		fflush(stdout);
-		console_set_rgb_color(fphone(stdout), 0xffffff, i << 16);
-		putchar('X');
-	}
-	fflush(stdout);
-	console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
-	putchar('\n');
-
-	for (i = 0; i < 255; i += 16) {
-		fflush(stdout);
-		console_set_rgb_color(fphone(stdout), 0xffffff, i << 8);
-		putchar('X');
-	}
-	fflush(stdout);
-	console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
-	putchar('\n');
-
-	for (i = 0; i < 255; i += 16) {
-		fflush(stdout);
-		console_set_rgb_color(fphone(stdout), 0xffffff, i);
-		putchar('X');
-	}
-	fflush(stdout);
-	console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
-	putchar('\n');
-
-	printf("[press a key]\n");
-	getchar();
-
+	
 	return NULL;
 }
Index: uspace/app/tester/devmap/devmap1.c
===================================================================
--- uspace/app/tester/devmap/devmap1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/*
- * Copyright (c) 2007 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <ipc/ipc.h>
-#include <ipc/services.h>
-#include <async.h>
-#include <errno.h>
-#include <devmap.h>
-#include "../tester.h"
-
-#include <time.h>
-
-#define TEST_DEVICE1 "TestDevice1"
-#define TEST_DEVICE2 "TestDevice2"
-
-/** Handle requests from clients 
- *
- */
-static void driver_client_connection(ipc_callid_t iid, ipc_call_t *icall)
-{
-	ipc_callid_t callid;
-	ipc_call_t call;
-	int retval;
-	
-	printf("connected: method=%u arg1=%u, arg2=%u arg3=%u.\n",
-	    IPC_GET_METHOD(*icall), IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall),
-	    IPC_GET_ARG3(*icall));
-
-	printf("driver_client_connection.\n");
-	ipc_answer_0(iid, EOK);
-
-	/* Ignore parameters, the connection is already opened */
-	while (1) {
-		callid = async_get_call(&call);
-		retval = EOK;
-		printf("method=%u arg1=%u, arg2=%u arg3=%u.\n",
-		    IPC_GET_METHOD(call), IPC_GET_ARG1(call),
-		    IPC_GET_ARG2(call), IPC_GET_ARG3(call));
-		switch (IPC_GET_METHOD(call)) {
-		case IPC_M_PHONE_HUNGUP:
-			/* TODO: Handle hangup */
-			return;
-		default:
-			printf("Unknown device method %u.\n",
-			    IPC_GET_METHOD(call));
-			retval = ENOENT;
-		}
-		ipc_answer_0(callid, retval);
-	}
-	return;
-}
-
-static int device_client_fibril(void *arg)
-{
-	int handle;
-	int device_phone;
-
-	handle = (int)arg;
-
-	device_phone = devmap_device_connect(handle, 0);
-	if (device_phone < 0) {
-		printf("Failed to connect to device (handle = %u).\n",
-		    handle);
-		return -1;
-	}
-
-	printf("Connected to device.\n");
-	ipc_hangup(device_phone);
-
-	return EOK;
-}
-
-/** Communication test with device.
- * @param handle handle to tested instance.
- */
-static int device_client(int handle)
-{
-/*	fid_t fid;
-	ipc_call_t call;
-	ipc_callid_t callid;
-
-	fid = fibril_create(device_client_fibril, (void *)handle);
-	fibril_add_ready(fid);
-
-*/
-	return EOK;
-}
-
-/** Test DevMap from the driver's point of view.
- *
- *
- */
-char * test_devmap1(bool quiet)
-{
-	const char *retval = NULL;
-	
-	/* Register new driver */
-	int rc = devmap_driver_register("TestDriver", driver_client_connection);
-	if (rc < 0) {
-		retval = "Error: Cannot register driver.\n";
-		goto out;
-	}
-	
-	/* Register new device dev1. */
-	dev_handle_t dev1_handle;
-	rc = devmap_device_register(TEST_DEVICE1, &dev1_handle);
-	if (rc != EOK) {
-		retval = "Error: cannot register device.\n";
-		goto out;
-	}
-	
-	/*
-	 * Get handle for dev2 (Should fail unless device is already registered
-	 * by someone else).
-	 */
-	dev_handle_t handle;
-	rc = devmap_device_get_handle(TEST_DEVICE2, &handle, 0);
-	if (rc == EOK) {
-		retval = "Error: got handle for dev2 before it was registered.\n";
-		goto out;
-	}
-	
-	/* Register new device dev2. */
-	dev_handle_t dev2_handle;
-	rc = devmap_device_register(TEST_DEVICE2, &dev2_handle);
-	if (rc != EOK) {
-		retval = "Error: cannot register device dev2.\n";
-		goto out;
-	}
-	
-	/* Register device dev1 again. */
-	dev_handle_t dev3_handle;
-	rc = devmap_device_register(TEST_DEVICE1, &dev3_handle);
-	if (rc == EOK) {
-		retval = "Error: dev1 registered twice.\n";
-		goto out;
-	}
-	
-	/* Get handle for dev1. */
-	rc = devmap_device_get_handle(TEST_DEVICE1, &handle, 0);
-	if (rc != EOK) {
-		retval = "Error: cannot get handle for 'DEVMAP_DEVICE1'.\n";
-		goto out;
-	}
-	
-	if (handle != dev1_handle) {
-		retval = "Error: cannot get handle for 'DEVMAP_DEVICE1'.\n";
-		goto out;
-	}
-	
-	if (device_client(dev1_handle) != EOK) {
-		retval = "Error: failed client test for 'DEVMAP_DEVICE1'.\n";
-		goto out;
-	}
-	
-out:
-	devmap_hangup_phone(DEVMAP_DRIVER);
-	devmap_hangup_phone(DEVMAP_CLIENT);
-	
-	return NULL;
-}
-
-char *test_devmap2(bool quiet)
-{
-	/*TODO: Full automatic test */
-	return NULL;
-}
-
-char *test_devmap3(bool quiet)
-{
-	/* TODO: allow user to call test functions in random order */
-	return NULL;
-}
-
Index: uspace/app/tester/devmap/devmap1.def
===================================================================
--- uspace/app/tester/devmap/devmap1.def	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"devmap1",
-	"DevMap test",
-	&test_devmap1,
-	true
-},
Index: uspace/app/tester/fault/fault1.c
===================================================================
--- uspace/app/tester/fault/fault1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/fault/fault1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -30,5 +30,5 @@
 #include "../tester.h"
 
-char * test_fault1(bool quiet)
+char *test_fault1(void)
 {
 	((int *)(0))[1] = 0;
Index: uspace/app/tester/fault/fault2.c
===================================================================
--- uspace/app/tester/fault/fault2.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/fault/fault2.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -30,5 +30,5 @@
 #include "../tester.h"
 
-char * test_fault2(bool quiet)
+char *test_fault2(void)
 {
 	volatile long long var;
Index: uspace/app/tester/ipc/answer.c
===================================================================
--- uspace/app/tester/ipc/answer.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include "../tester.h"
-
-char * test_answer(bool quiet)
-{
-	int i,cnt, errn = 0;
-	char c;
-
-	cnt = 0;
-	for (i = 0;i < 50; i++) {
-		if (callids[i]) {
-			printf("%d: %P\n", cnt, callids[i]);
-			cnt++;
-		}
-		if (cnt >= 10)
-			break;
-	}
-	if (!cnt)
-		return NULL;
-	printf("Choose message:\n");
-	do {
-		c = getchar();
-	} while (c < '0' || (c-'0') >= cnt);
-	cnt = c - '0' + 1;
-	
-	for (i = 0; cnt; i++)
-		if (callids[i])
-			cnt--;
-	i -= 1;
-
-	printf("Normal (n) or hangup (h) or error(e) message?\n");
-	do {
-		c = getchar();
-	} while (c != 'n' && c != 'h' && c != 'e');
-	if (c == 'n')
-		errn = 0;
-	else if (c == 'h')
-		errn = EHANGUP;
-	else if (c == 'e')
-		errn = ENOENT;
-	printf("Answering %P\n", callids[i]);
-	ipc_answer_0(callids[i], errn);
-	callids[i] = 0;
-	
-	return NULL;
-}
Index: uspace/app/tester/ipc/answer.def
===================================================================
--- uspace/app/tester/ipc/answer.def	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"answer",
-	"IPC answer message test",
-	&test_answer,
-	true
-},
Index: uspace/app/tester/ipc/connect.c
===================================================================
--- uspace/app/tester/ipc/connect.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/ipc/connect.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -29,30 +29,44 @@
 #include <stdio.h>
 #include <unistd.h>
+#include <atomic.h>
 #include "../tester.h"
 
-char * test_connect(bool quiet)
+static atomic_t finish;
+
+static void callback(void *priv, int retval, ipc_call_t *data)
 {
-	char c;
-	int svc;
-	int phid;
+	atomic_set(&finish, 1);
+}
 
-	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');
+char *test_connect(void)
+{
+	TPRINTF("Connecting to %u...", IPC_TEST_SERVICE);
+	int phone = ipc_connect_me_to(PHONE_NS, IPC_TEST_SERVICE, 0, 0);
+	if (phone > 0) {
+		TPRINTF("phoneid %d\n", phone);
+	} else {
+		TPRINTF("\n");
+		return "ipc_connect_me_to() failed";
+	}
 	
-	svc = IPC_TEST_START + c - '0';
-	if (svc == myservice)
-		return "Currently cannot connect to myself, update test";
+	printf("Sending synchronous message...\n");
+	int retval = ipc_call_sync_0_0(phone, IPC_TEST_METHOD);
+	TPRINTF("Received response to synchronous message\n");
 	
-	printf("Connecting to %d..", svc);
-	phid = ipc_connect_me_to(PHONE_NS, svc, 0, 0);
-	if (phid > 0) {
-		printf("phoneid: %d\n", phid);
-		phones[phid] = 1;
-	} else
-		return "Error";
+	TPRINTF("Sending asynchronous message...\n");
+	atomic_set(&finish, 0);
+	ipc_call_async_0(phone, IPC_TEST_METHOD, NULL, callback, 1);
+	while (atomic_get(&finish) != 1)
+		TPRINTF(".");
+	TPRINTF("Received response to asynchronous message\n");
+	
+	TPRINTF("Hanging up...");
+	retval = ipc_hangup(phone);
+	if (retval == 0) {
+		TPRINTF("OK\n");
+	} else {
+		TPRINTF("\n");
+		return "ipc_hangup() failed";
+	}
 	
 	return NULL;
Index: uspace/app/tester/ipc/hangup.c
===================================================================
--- uspace/app/tester/ipc/hangup.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include "../tester.h"
-
-char * test_hangup(bool quiet)
-{
-	char c;
-	int res;
-	int phoneid;
-
-	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';
-	
-	printf("Hanging up...");
-	res = ipc_hangup(phoneid);
-	printf("done: %d\n", phoneid);	
-	
-	return NULL;
-}
Index: uspace/app/tester/ipc/hangup.def
===================================================================
--- uspace/app/tester/ipc/hangup.def	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"hangup",
-	"IPC hangup test",
-	&test_hangup,
-	true
-},
Index: uspace/app/tester/ipc/ping_pong.c
===================================================================
--- uspace/app/tester/ipc/ping_pong.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/ipc/ping_pong.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -38,18 +38,21 @@
 #define COUNT_GRANULARITY  100
 
-char *test_ping_pong(bool quiet)
+char *test_ping_pong(void)
 {
-	printf("Pinging ns server for %d seconds...\n", DURATION_SECS);
+	TPRINTF("Pinging ns server for %d seconds...", DURATION_SECS);
 	
 	struct timeval start;
-	if (gettimeofday(&start, NULL) != 0)
-		return "Failed getting the time.";
+	if (gettimeofday(&start, NULL) != 0) {
+		TPRINTF("\n");
+		return "Failed getting the time";
+	}
 	
 	uint64_t count = 0;
-	
 	while (true) {
 		struct timeval now;
-		if (gettimeofday(&now, NULL) != 0)
-			return "Failed getting the time.";
+		if (gettimeofday(&now, NULL) != 0) {
+			TPRINTF("\n");
+			return "Failed getting the time";
+		}
 		
 		if (tv_sub(&now, &start) >= DURATION_SECS * 1000000L)
@@ -60,6 +63,8 @@
 			int retval = async_req_0_0(PHONE_NS, NS_PING);
 			
-			if (retval != EOK)
-				return "Failed to send ping message.";
+			if (retval != EOK) {
+				TPRINTF("\n");
+				return "Failed to send ping message";
+			}
 		}
 		
@@ -67,5 +72,5 @@
 	}
 	
-	printf("Completed %lu round trips in %u seconds, %lu RT/s.\n",
+	TPRINTF("OK\nCompleted %llu round trips in %u seconds, %llu rt/s.\n",
 	    count, DURATION_SECS, count / DURATION_SECS);
 	
Index: uspace/app/tester/ipc/register.c
===================================================================
--- uspace/app/tester/ipc/register.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/ipc/register.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -33,56 +33,56 @@
 #include "../tester.h"
 
+#define MAX_CONNECTIONS  50
+
+static int connections[MAX_CONNECTIONS];
+
 static void client_connection(ipc_callid_t iid, ipc_call_t *icall)
 {
-	ipc_callid_t callid;
-	ipc_call_t call;
-	ipcarg_t phonehash = icall->in_phone_hash;
-	int retval;
-	int i;
-
-	printf("Connected phone: %P, accepting\n", icall->in_phone_hash);
+	unsigned int i;
+	
+	TPRINTF("Connected phone %#x accepting\n", icall->in_phone_hash);
 	ipc_answer_0(iid, EOK);
-	for (i = 0; i < 1024; i++)
+	for (i = 0; i < MAX_CONNECTIONS; i++) {
 		if (!connections[i]) {
-			connections[i] = phonehash;
+			connections[i] = icall->in_phone_hash;
 			break;
 		}
+	}
 	
-	while (1) {
-		callid = async_get_call(&call);
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+		int retval;
+		
 		switch (IPC_GET_METHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
-			printf("Phone (%P) hung up.\n", phonehash);
+			TPRINTF("Phone %#x hung up\n", icall->in_phone_hash);
 			retval = 0;
 			break;
+		case IPC_TEST_METHOD:
+			TPRINTF("Received well known message from %#x: %#x\n",
+			    icall->in_phone_hash, callid);
+			ipc_answer_0(callid, EOK);
+			break;
 		default:
-			printf("Received message from %P: %X\n", phonehash,
-			    callid);
-			for (i = 0; i < 1024; i++)
-				if (!callids[i]) {
-					callids[i] = callid;
-					break;
-				}
-			continue;
+			TPRINTF("Received unknown message from %#x: %#x\n",
+			    icall->in_phone_hash, callid);
+			ipc_answer_0(callid, ENOENT);
+			break;
 		}
-		ipc_answer_0(callid, retval);
 	}
 }
 
-char * test_register(bool quiet)
+char *test_register(void)
 {
-	int i;
+	async_set_client_connection(client_connection);
 	
-	async_set_client_connection(client_connection);
-
-	for (i = IPC_TEST_START; i < IPC_TEST_START + 10; i++) {
-		ipcarg_t phonead;
-		int res = ipc_connect_to_me(PHONE_NS, i, 0, 0, &phonead);
-		if (!res)
-			break;
-		printf("Failed registering as %d..:%d\n", i, res);
-	}
-	printf("Registered as service: %d\n", i);
-	myservice = i;
+	ipcarg_t phonead;
+	int res = ipc_connect_to_me(PHONE_NS, IPC_TEST_SERVICE, 0, 0, &phonead);
+	if (res != 0)
+		return "Failed registering IPC service";
+	
+	TPRINTF("Registered as service %u, accepting connections\n", IPC_TEST_SERVICE);
+	async_manager();
 	
 	return NULL;
Index: uspace/app/tester/ipc/send_async.c
===================================================================
--- uspace/app/tester/ipc/send_async.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include "../tester.h"
-
-static void callback(void *_private, int retval, ipc_call_t *data)
-{
-	printf("Received response to msg %d - retval: %d.\n", _private, retval);
-}
-
-char * test_send_async(bool quiet)
-{
-	int phoneid;
-	static int msgid = 1;
-	char c;
-
-	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';
-
-	ipc_call_async_0(phoneid, 2000, (void *) msgid, callback, 1);
-	printf("Async sent - msg %d\n", msgid);
-	msgid++;
-	
-	return NULL;
-}
Index: uspace/app/tester/ipc/send_async.def
===================================================================
--- uspace/app/tester/ipc/send_async.def	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"send_async",
-	"IPC send async message test",
-	&test_send_async,
-	true
-},
Index: uspace/app/tester/ipc/send_sync.c
===================================================================
--- uspace/app/tester/ipc/send_sync.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include "../tester.h"
-#include <ipc/ipc.h>
-
-char * test_send_sync(bool quiet)
-{
-	int phoneid;
-	int res;
-	char c;
-
-	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';
-	
-	printf("Sending msg...");
-	res = ipc_call_sync_0_0(phoneid, 2000);
-	printf("done: %d\n", res);
-	
-	return NULL;
-}
Index: uspace/app/tester/ipc/send_sync.def
===================================================================
--- uspace/app/tester/ipc/send_sync.def	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"send_sync",
-	"IPC send sync message test",
-	&test_send_sync,
-	true
-},
Index: uspace/app/tester/loop/loop1.c
===================================================================
--- uspace/app/tester/loop/loop1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/loop/loop1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -31,11 +31,10 @@
 #include "../tester.h"
 
-char *test_loop1(bool quiet)
+char *test_loop1(void)
 {
-	printf("Looping...\n");
-	while (1);
-	printf("Survived endless loop?!!\n");
-
-	return NULL;
+	TPRINTF("Looping...");
+	while (true);
+	TPRINTF("\n");
+	
+	return "Survived endless loop";
 }
-
Index: uspace/app/tester/print/print1.c
===================================================================
--- uspace/app/tester/print/print1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/print/print1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -31,42 +31,25 @@
 #include "../tester.h"
 
-#define BUFFER_SIZE 32
-
-char * test_print1(bool quiet)
+char *test_print1(void)
 {
-	if (!quiet) {
-		int retval;
-		unsigned int nat = 0x12345678u;
-		
-		char buffer[BUFFER_SIZE];
-		
-		printf(" text 10.8s %*.*s \n", 5, 3, "text");
-		printf(" very long text 10.8s %10.8s \n", "very long text");
-		printf(" text 8.10s %8.10s \n", "text");
-		printf(" very long text 8.10s %8.10s \n", "very long text");
-		
-		printf(" char: c '%c', 3.2c '%3.2c', -3.2c '%-3.2c', 2.3c '%2.3c', -2.3c '%-2.3c' \n",'a', 'b', 'c', 'd', 'e' );
-		printf(" int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",1, 1, 1, 1, 1 );
-		printf(" -int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",-1, -1, -1, -1, -1 );
-		printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 );
-		
-		printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, unative_t '%#zx'. '%#llx' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" );
-		
-		printf(" Print to NULL '%s'\n", NULL);
-		
-		retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters.");
-		printf("Result is: '%s', retval = %d\n", buffer, retval);
-		
-		retval = snprintf(buffer, BUFFER_SIZE, "Very very very long text without parameters.");
-		printf("Result is: '%s', retval = %d\n", buffer, retval);
-		
-		printf("Print short text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
-		retval = snprintf(buffer, BUFFER_SIZE, "Short %s", "text");
-		printf("Result is: '%s', retval = %d\n", buffer, retval);
-		
-		printf("Print long text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
-		retval = snprintf(buffer, BUFFER_SIZE, "Very long %s. This text`s length is more than %d. We are interested in the result.", "text" , BUFFER_SIZE);
-		printf("Result is: '%s', retval = %d\n", buffer, retval);
-	}
+	TPRINTF("Testing printf(\"%%*.*s\", 5, 3, \"text\"):\n");
+	TPRINTF("Expected output: \"  tex\"\n");
+	TPRINTF("Real output:     \"%*.*s\"\n\n", 5, 3, "text");
+	
+	TPRINTF("Testing printf(\"%%10.8s\", \"very long text\"):\n");
+	TPRINTF("Expected output: \"  very lon\"\n");
+	TPRINTF("Real output:     \"%10.8s\"\n\n", "very long text");
+	
+	TPRINTF("Testing printf(\"%%8.10s\", \"text\"):\n");
+	TPRINTF("Expected output: \"text\"\n");
+	TPRINTF("Real output:     \"%8.10s\"\n\n", "text");
+	
+	TPRINTF("Testing printf(\"%%8.10s\", \"very long text\"):\n");
+	TPRINTF("Expected output: \"very long \"\n");
+	TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
+	
+	TPRINTF("Testing printf(\"%%s\", NULL):\n");
+	TPRINTF("Expected output: \"(NULL)\"\n");
+	TPRINTF("Real output:     \"%s\"\n\n", NULL);
 	
 	return NULL;
Index: uspace/app/tester/print/print1.def
===================================================================
--- uspace/app/tester/print/print1.def	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/print/print1.def	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -1,5 +1,5 @@
 {
 	"print1",
-	"Printf test",
+	"String printf test",
 	&test_print1,
 	true
Index: uspace/app/tester/print/print2.c
===================================================================
--- uspace/app/tester/print/print2.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
+++ uspace/app/tester/print/print2.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2005 Josef Cejka
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include "../tester.h"
+
+char *test_print2(void)
+{
+	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
+	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
+	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
+	
+	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
+	TPRINTF("Expected output: [1] [ 02] [03 ] [004] [005]\n");
+	TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", 1, 2, 3, 4, 5);
+	
+	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", -1, -2, -3, -4, -5):\n");
+	TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
+	TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", -1, -2, -3, -4, -5);
+	
+	TPRINTF("Testing printf(\"%%#x %%5.3#x %%-5.3#x %%3.5#x %%-3.5#x\", 17, 18, 19, 20, 21):\n");
+	TPRINTF("Expected output: [0x11] [0x012] [0x013] [0x00014] [0x00015]\n");
+	TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
+	
+	return NULL;
+}
Index: uspace/app/tester/print/print2.def
===================================================================
--- uspace/app/tester/print/print2.def	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
+++ uspace/app/tester/print/print2.def	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -0,0 +1,6 @@
+{
+	"print2",
+	"Numeric printf test",
+	&test_print2,
+	true
+},
Index: uspace/app/tester/print/print3.c
===================================================================
--- uspace/app/tester/print/print3.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
+++ uspace/app/tester/print/print3.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2005 Josef Cejka
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <macros.h>
+#include "../tester.h"
+
+#define BUFFER_SIZE  32
+
+char *test_print3(void)
+{
+	char buffer[BUFFER_SIZE];
+	int retval;
+	
+	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short text without parameters.\"):\n");
+	TPRINTF("Expected result: retval=30 buffer=\"Short text without parameters.\"\n");
+	retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters.");
+	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
+	
+	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very very very long text without parameters.\"):\n");
+	TPRINTF("Expected result: retval=44 buffer=\"Very very very long text withou\"\n");
+	retval = snprintf(buffer, BUFFER_SIZE, "Very very very long text without parameters.");
+	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
+	
+	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short %%s.\", \"text\"):\n");
+	TPRINTF("Expected result: retval=11 buffer=\"Short text.\"\n");
+	retval = snprintf(buffer, BUFFER_SIZE, "Short %s.", "text");
+	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
+	
+	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very long %%s. This text's length is more than %%d. We are interested in the result.\", \"text\", " STRING(BUFFER_SIZE) "):\n");
+	TPRINTF("Expected result: retval=84 buffer=\"Very long text. This text's len\"\n");
+	retval = snprintf(buffer, BUFFER_SIZE, "Very long %s. This text's length is more than %d. We are interested in the result.", "text", BUFFER_SIZE);
+	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
+	
+	return NULL;
+}
Index: uspace/app/tester/print/print3.def
===================================================================
--- uspace/app/tester/print/print3.def	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
+++ uspace/app/tester/print/print3.def	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -0,0 +1,6 @@
+{
+	"print3",
+	"Buffered printf test",
+	&test_print3,
+	true
+},
Index: uspace/app/tester/print/print4.c
===================================================================
--- uspace/app/tester/print/print4.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/print/print4.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -31,61 +31,52 @@
 #include "../tester.h"
 
-#define PRIx8 "x"
-
-char *test_print4(bool quiet)
+char *test_print4(void)
 {
-	if (!quiet) {
-		printf("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n");
+	TPRINTF("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n");
+	
+	uint8_t group;
+	for (group = 1; group < 4; group++) {
+		TPRINTF("%#x: ", group << 5);
 		
-		uint8_t group;
-		for (group = 1; group < 4; group++) {
-			printf("%#" PRIx8 ": ", group << 5);
-			
-			uint8_t index;
-			for (index = 0; index < 32; index++)
-				printf("%c", (char) ((group << 5) + index));
-			
-			printf("  ");
-			for (index = 0; index < 32; index++)
-				printf("%lc", (wchar_t) ((group << 5) + index));
-			
-			printf("\n");
-		}
+		uint8_t index;
+		for (index = 0; index < 32; index++)
+			TPRINTF("%c", (char) ((group << 5) + index));
 		
-		printf("\nExtended ASCII characters (128 - 255) using printf(\"%%lc\"):\n");
+		TPRINTF("  ");
+		for (index = 0; index < 32; index++)
+			TPRINTF("%lc", (wchar_t) ((group << 5) + index));
 		
-		for (group = 4; group < 8; group++) {
-			printf("%#" PRIx8 ": ", group << 5);
-			
-			uint8_t index;
-			for (index = 0; index < 32; index++)
-				printf("%lc", (wchar_t) ((group << 5) + index));
-			
-			printf("\n");
-		}
+		TPRINTF("\n");
+	}
+	
+	TPRINTF("\nExtended ASCII characters (128 - 255) using printf(\"%%lc\"):\n");
+	
+	for (group = 4; group < 8; group++) {
+		TPRINTF("%#x: ", group << 5);
 		
-		printf("\nUTF-8 strings using printf(\"%%s\"):\n");
-		printf("English:  %s\n", "Quick brown fox jumps over the lazy dog");
-		printf("Czech:    %s\n", "Příliš žluťoučký kůň úpěl ďábelské ódy");
-		printf("Greek:    %s\n", "Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
-		printf("Hebrew:   %s\n", "משוואת ברנולי היא משוואה בהידרודינמיקה");
-		printf("Arabic:   %s\n", "التوزيع الجغرافي للحمل العنقودي");
-		printf("Russian:  %s\n", "Леннон познакомился с художницей-авангардисткой");
-		printf("Armenian: %s\n", "Սկսեց հրատարակվել Երուսաղեմի հայկական");
+		uint8_t index;
+		for (index = 0; index < 32; index++)
+			TPRINTF("%lc", (wchar_t) ((group << 5) + index));
 		
-		printf("\nUTF-32 strings using printf(\"%%ls\"):\n");
-		printf("English:  %ls\n", L"Quick brown fox jumps over the lazy dog");
-		printf("Czech:    %ls\n", L"Příliš žluťoučký kůň úpěl ďábelské ódy");
-		printf("Greek:    %ls\n", L"Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
-		printf("Hebrew:   %ls\n", L"משוואת ברנולי היא משוואה בהידרודינמיקה");
-		printf("Arabic:   %ls\n", L"التوزيع الجغرافي للحمل العنقودي");
-		printf("Russian:  %ls\n", L"Леннон познакомился с художницей-авангардисткой");
-		printf("Armenian: %ls\n", L"Սկսեց հրատարակվել Երուսաղեմի հայկական");
-
-		printf("Test: [%d] '%lc'\n", L'\x0161', L'\x0161');
+		TPRINTF("\n");
 	}
-
-	printf("[Press a key]\n");
-	getchar();
+	
+	TPRINTF("\nUTF-8 strings using printf(\"%%s\"):\n");
+	TPRINTF("English:  %s\n", "Quick brown fox jumps over the lazy dog");
+	TPRINTF("Czech:    %s\n", "Příliš žluťoučký kůň úpěl ďábelské ódy");
+	TPRINTF("Greek:    %s\n", "Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
+	TPRINTF("Hebrew:   %s\n", "משוואת ברנולי היא משוואה בהידרודינמיקה");
+	TPRINTF("Arabic:   %s\n", "التوزيع الجغرافي للحمل العنقودي");
+	TPRINTF("Russian:  %s\n", "Леннон познакомился с художницей-авангардисткой");
+	TPRINTF("Armenian: %s\n", "Սկսեց հրատարակվել Երուսաղեմի հայկական");
+	
+	TPRINTF("\nUTF-32 strings using printf(\"%%ls\"):\n");
+	TPRINTF("English:  %ls\n", L"Quick brown fox jumps over the lazy dog");
+	TPRINTF("Czech:    %ls\n", L"Příliš žluťoučký kůň úpěl ďábelské ódy");
+	TPRINTF("Greek:    %ls\n", L"Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
+	TPRINTF("Hebrew:   %ls\n", L"משוואת ברנולי היא משוואה בהידרודינמיקה");
+	TPRINTF("Arabic:   %ls\n", L"التوزيع الجغرافي للحمل العنقودي");
+	TPRINTF("Russian:  %ls\n", L"Леннон познакомился с художницей-авангардисткой");
+	TPRINTF("Armenian: %ls\n", L"Սկսեց հրատարակվել Երուսաղեմի հայկական");
 	
 	return NULL;
Index: uspace/app/tester/stdio/stdio1.c
===================================================================
--- uspace/app/tester/stdio/stdio1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/stdio/stdio1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -32,54 +32,59 @@
 #include "../tester.h"
 
-#define BUF_SIZE 32
+#define BUF_SIZE  32
+
 static char buf[BUF_SIZE + 1];
 
-char * test_stdio1(bool quiet)
+char *test_stdio1(void)
 {
-	FILE *f;
+	FILE *file;
 	char *file_name = "/readme";
-	size_t n;
-	int c;
-
-	printf("Open file '%s'\n", file_name);
+	
+	TPRINTF("Open file \"%s\"...", file_name);
 	errno = 0;
-	f = fopen(file_name, "rt");
-
-	if (f == NULL) printf("errno = %d\n", errno);
-
-	if (f == NULL)
-		return "Failed opening file.";
-
-	n = fread(buf, 1, BUF_SIZE, f);
-	if (ferror(f)) {
-		fclose(f);
-		return "Failed reading file.";
+	file = fopen(file_name, "rt");
+	if (file == NULL) {
+		TPRINTF("errno = %d\n", errno);
+		return "Failed opening file";
+	} else
+		TPRINTF("OK\n");
+	
+	TPRINTF("Read file...");
+	size_t cnt = fread(buf, 1, BUF_SIZE, file);
+	if (ferror(file)) {
+		TPRINTF("errno = %d\n", errno);
+		fclose(file);
+		return "Failed reading file";
+	} else
+		TPRINTF("OK\n");
+	
+	buf[cnt] = '\0';
+	TPRINTF("Read %u bytes, string \"%s\"\n", cnt, buf);
+	
+	TPRINTF("Seek to beginning...");
+	if (fseek(file, 0, SEEK_SET) != 0) {
+		TPRINTF("errno = %d\n", errno);
+		fclose(file);
+		return "Failed seeking in file";
+	} else
+		TPRINTF("OK\n");
+	
+	TPRINTF("Read using fgetc()...");
+	while (true) {
+		int c = fgetc(file);
+		if (c == EOF)
+			break;
+		
+		TPRINTF(".");
 	}
-
-	printf("Read %d bytes.\n", n);
-
-	buf[n] = '\0';
-	printf("Read string '%s'.\n", buf);
-
-	printf("Seek to beginning.\n");
-	if (fseek(f, 0, SEEK_SET) != 0) {
-		fclose(f);
-		return "Failed seeking.";
-	}
-
-	printf("Read using fgetc().\n");
-	while (true) {
-		c = fgetc(f);
-		if (c == EOF) break;
-
-		printf("'%c'", c);
-	}
-
-	printf("[EOF]\n");
-	printf("Closing.\n");
-
-	if (fclose(f) != 0)
-		return "Failed closing.";
-
+	TPRINTF("[EOF]\n");
+	
+	TPRINTF("Close...");
+	if (fclose(file) != 0) {
+		TPRINTF("errno = %d\n", errno);
+		return "Failed closing file";
+	} else
+		TPRINTF("OK\n");
+	
 	return NULL;
 }
Index: uspace/app/tester/stdio/stdio2.c
===================================================================
--- uspace/app/tester/stdio/stdio2.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/stdio/stdio2.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -32,37 +32,52 @@
 #include "../tester.h"
 
-char * test_stdio2(bool quiet)
+char *test_stdio2(void)
 {
-	FILE *f;
+	FILE *file;
 	char *file_name = "/test";
-	int c;
-
-	printf("Open file '%s' for writing\n", file_name);
+	
+	TPRINTF("Open file \"%s\" for writing...", file_name);
 	errno = 0;
-	f = fopen(file_name, "wt");
-
-	if (f == NULL)
-		return "Failed opening file.";
-
-	fprintf(f, "Integer: %d, string: '%s'\n", 42, "Hello!");
-	if (fclose(f) != 0)
-		return "Failed closing file.";
-
-	printf("Open file '%s' for reading\n", file_name);
-
-	f = fopen(file_name, "rt");
-	if (f == NULL)
-		return "Failed opening file.";
-
-	printf("File contains:\n");
+	file = fopen(file_name, "wt");
+	if (file == NULL) {
+		TPRINTF("errno = %d\n", errno);
+		return "Failed opening file";
+	} else
+		TPRINTF("OK\n");
+	
+	TPRINTF("Write to file...");
+	fprintf(file, "integer: %u, string: \"%s\"", 42, "Hello!");
+	TPRINTF("OK\n");
+	
+	TPRINTF("Close...");
+	if (fclose(file) != 0) {
+		TPRINTF("errno = %d\n", errno);
+		return "Failed closing file";
+	} else
+		TPRINTF("OK\n");
+	
+	TPRINTF("Open file \"%s\" for reading...", file_name);
+	file = fopen(file_name, "rt");
+	if (file == NULL) {
+		TPRINTF("errno = %d\n", errno);
+		return "Failed opening file";
+	} else
+		TPRINTF("OK\n");
+	
+	TPRINTF("File contains:\n");
 	while (true) {
-		c = fgetc(f);
-		if (c == EOF) break;
-		putchar(c);
+		int c = fgetc(file);
+		if (c == EOF)
+			break;
+		TPRINTF("%c", c);
 	}
-
-	if (fclose(f) != 0)
-		return "Failed closing file.";
-
+	
+	TPRINTF("\nClose...");
+	if (fclose(file) != 0) {
+		TPRINTF("errno = %d\n", errno);
+		return "Failed closing file";
+	} else
+		TPRINTF("OK\n");
+	
 	return NULL;
 }
Index: uspace/app/tester/tester.c
===================================================================
--- uspace/app/tester/tester.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/tester.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -28,8 +28,8 @@
  */
 
-/** @addtogroup tester User space Tester
- * @brief	User space testing infrastructure.
+/** @addtogroup tester User space tester
+ * @brief User space testing infrastructure.
  * @{
- */ 
+ */
 /**
  * @file
@@ -38,46 +38,42 @@
 #include <unistd.h>
 #include <stdio.h>
+#include <string.h>
 #include "tester.h"
 
-int myservice = 0;
-int phones[MAX_PHONES];
-int connections[MAX_CONNECTIONS];
-ipc_callid_t callids[MAX_CONNECTIONS];
+bool test_quiet;
+int test_argc;
+char **test_argv;
 
 test_t tests[] = {
 #include "thread/thread1.def"
 #include "print/print1.def"
+#include "print/print2.def"
+#include "print/print3.def"
 #include "print/print4.def"
-#include "fault/fault1.def"
-#include "fault/fault2.def"
-#include "ipc/register.def"
-#include "ipc/connect.def"
-#include "ipc/send_async.def"
-#include "ipc/send_sync.def"
-#include "ipc/answer.def"
-#include "ipc/hangup.def"
-#include "ipc/ping_pong.def"
-#include "devmap/devmap1.def"
-#include "loop/loop1.def"
-#include "vfs/vfs1.def"
 #include "console/console1.def"
 #include "stdio/stdio1.def"
 #include "stdio/stdio2.def"
-	{NULL, NULL, NULL}
+#include "fault/fault1.def"
+#include "fault/fault2.def"
+#include "vfs/vfs1.def"
+#include "ipc/ping_pong.def"
+#include "ipc/register.def"
+#include "ipc/connect.def"
+#include "loop/loop1.def"
+#include "mm/malloc1.def"
+	{NULL, NULL, NULL, false}
 };
 
 static bool run_test(test_t *test)
 {
-	printf("%s\t\t%s\n", test->name, test->desc);
-	
 	/* Execute the test */
-	char * ret = test->entry(false);
+	char *ret = test->entry();
 	
 	if (ret == NULL) {
-		printf("Test passed\n\n");
+		printf("\nTest passed\n");
 		return true;
 	}
-
-	printf("%s\n\n", ret);
+	
+	printf("\n%s\n", ret);
 	return false;
 }
@@ -88,9 +84,10 @@
 	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) {
+			printf("%s (%s)\n", test->name, test->desc);
 			if (run_test(test))
 				i++;
@@ -99,62 +96,50 @@
 		}
 	}
-
-	printf("\nSafe tests completed, %u tests run, %u passed.\n\n", i + n, i);
+	
+	printf("\nCompleted, %u tests run, %u passed.\n", i + n, i);
 }
 
 static void list_tests(void)
 {
+	size_t len = 0;
 	test_t *test;
-	char c = 'a';
+	for (test = tests; test->name != NULL; test++) {
+		if (str_length(test->name) > len)
+			len = str_length(test->name);
+	}
 	
-	for (test = tests; test->name != NULL; test++, c++)
-		printf("%c\t%s\t\t%s%s\n", c, test->name, test->desc, (test->safe ? "" : " (unsafe)"));
+	for (test = tests; test->name != NULL; test++)
+		printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)"));
 	
-	printf("*\t\t\tRun all safe tests\n");
+	printf("%-*s Run all safe tests\n", len, "*");
 }
 
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
 {
-	printf("Number of arguments: %d\n", argc);
-	if (argv) {
-		printf("Arguments:");
-		while (*argv) {
-			printf(" '%s'", *argv++);
+	if (argc < 2) {
+		printf("Usage:\n\n");
+		printf("%s <test> [args ...]\n\n", argv[0]);
+		list_tests();
+		return 0;
+	}
+	
+	test_quiet = false;
+	test_argc = argc - 2;
+	test_argv = argv + 2;
+	
+	if (str_cmp(argv[1], "*") == 0) {
+		run_safe_tests();
+		return 0;
+	}
+	
+	test_t *test;
+	for (test = tests; test->name != NULL; test++) {
+		if (str_cmp(argv[1], test->name) == 0) {
+			return (run_test(test) ? 0 : -1);
 		}
-		printf("\n");
 	}
-
-	while (1) {
-		char c;
-		test_t *test;
-		
-		list_tests();
-		printf("> ");
-		fflush(stdout);
-		
-		c = getchar();
-		printf("%c\n", c);
-		
-		if ((c >= 'a') && (c <= 'z')) {
-			for (test = tests; test->name != NULL; test++, c--)
-				if (c == 'a')
-					break;
-			
-			if (test->name == NULL)
-				printf("Unknown test\n\n");
-			else
-				run_test(test);
-		} else if (c == '*') {
-			run_safe_tests();
-		} else if (c < 0) {
-			/* got EOF */
-			break;
-		} else {
-			printf("Invalid test\n\n");
-		}
-			
-	}
-
-	return 0;
+	
+	printf("Unknown test \"%s\"\n", argv[1]);
+	return -2;
 }
 
Index: uspace/app/tester/tester.h
===================================================================
--- uspace/app/tester/tester.h	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/tester.h	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -40,41 +40,43 @@
 #include <ipc/ipc.h>
 
-#define IPC_TEST_START	10000
-#define MAX_PHONES		20
-#define MAX_CONNECTIONS 50
-#define TEST_SKIPPED    "Test Skipped"
+#define IPC_TEST_SERVICE  10240
+#define IPC_TEST_METHOD   2000
 
-extern int myservice;
-extern int phones[MAX_PHONES];
-extern int connections[MAX_CONNECTIONS];
-extern ipc_callid_t callids[MAX_CONNECTIONS];
+extern bool test_quiet;
+extern int test_argc;
+extern char **test_argv;
 
-typedef char * (* test_entry_t)(bool);
+#define TPRINTF(format, ...) \
+	{ \
+		if (!test_quiet) { \
+			fprintf(stderr, format, ##__VA_ARGS__); \
+		} \
+	}
+
+typedef char *(*test_entry_t)(void);
 
 typedef struct {
-	char * name;
-	char * desc;
+	char *name;
+	char *desc;
 	test_entry_t entry;
 	bool safe;
 } test_t;
 
-extern char * test_thread1(bool quiet);
-extern char * test_print1(bool quiet);
-extern char * test_print4(bool quiet);
-extern char * test_fault1(bool quiet);
-extern char * test_fault2(bool quiet);
-extern char * test_register(bool quiet);
-extern char * test_connect(bool quiet);
-extern char * test_send_async(bool quiet);
-extern char * test_send_sync(bool quiet);
-extern char * test_answer(bool quiet);
-extern char * test_hangup(bool quiet);
-extern char * test_ping_pong(bool quiet);
-extern char * test_devmap1(bool quiet);
-extern char * test_loop1(bool quiet);
-extern char * test_vfs1(bool quiet);
-extern char * test_console1(bool quiet);
-extern char * test_stdio1(bool quiet);
-extern char * test_stdio2(bool quiet);
+extern char *test_thread1(void);
+extern char *test_print1(void);
+extern char *test_print2(void);
+extern char *test_print3(void);
+extern char *test_print4(void);
+extern char *test_console1(void);
+extern char *test_stdio1(void);
+extern char *test_stdio2(void);
+extern char *test_fault1(void);
+extern char *test_fault2(void);
+extern char *test_vfs1(void);
+extern char *test_ping_pong(void);
+extern char *test_register(void);
+extern char *test_connect(void);
+extern char *test_loop1(void);
+extern char *test_malloc1(void);
 
 extern test_t tests[];
Index: uspace/app/tester/thread/thread1.c
===================================================================
--- uspace/app/tester/thread/thread1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/thread/thread1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -28,5 +28,6 @@
  */
 
-#define THREADS 5
+#define THREADS  20
+#define DELAY    10
 
 #include <atomic.h>
@@ -43,38 +44,36 @@
 {
 	thread_detach(thread_get_id());
-
-	while (atomic_get(&finish)) {
-		if (!sh_quiet)
-			printf("%llu ", thread_get_id());
+	
+	while (atomic_get(&finish))
 		usleep(100000);
-	}
+	
 	atomic_inc(&threads_finished);
 }
 
-char * test_thread1(bool quiet)
+char *test_thread1(void)
 {
-	unsigned int i, total = 0;
-	sh_quiet = quiet;
+	unsigned int i;
+	unsigned int total = 0;
 	
 	atomic_set(&finish, 1);
 	atomic_set(&threads_finished, 0);
-
-	for (i = 0; i < THREADS; i++) {  
+	
+	TPRINTF("Creating threads");
+	for (i = 0; i < THREADS; i++) {
 		if (thread_create(threadtest, NULL, "threadtest", NULL) < 0) {
-			if (!quiet)
-				printf("Could not create thread %d\n", i);
+			TPRINTF("\nCould not create thread %u\n", i);
 			break;
 		}
+		TPRINTF(".");
 		total++;
 	}
 	
-	if (!quiet)
-		printf("Running threads for 10 seconds...\n");
-	sleep(10);
+	TPRINTF("\nRunning threads for %u seconds...", DELAY);
+	sleep(DELAY);
+	TPRINTF("\n");
 	
 	atomic_set(&finish, 0);
 	while (atomic_get(&threads_finished) < total) {
-		if (!quiet)
-			printf("Threads left: %d\n", total - atomic_get(&threads_finished));
+		TPRINTF("Threads left: %u\n", total - atomic_get(&threads_finished));
 		sleep(1);
 	}
Index: uspace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision 82346c504086538f88eec017a9b53a173d3f0325)
+++ uspace/app/tester/vfs/vfs1.c	(revision d68e4d573ccb8f5b2c980725f2f3c84831e0c8b5)
@@ -35,108 +35,117 @@
 #include <fcntl.h>
 #include <dirent.h>
+#include <devmap.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include "../tester.h"
 
-char text[] = "O xein', angellein Lakedaimoniois hoti teide "
-	"keimetha tois keinon rhemasi peithomenoi.";
+#define FS_TYPE      "tmpfs"
+#define MOUNT_POINT  "/tmp"
+#define OPTIONS      ""
+#define FLAGS        0
 
-char *test_vfs1(bool quiet)
+#define TEST_DIRECTORY  MOUNT_POINT "/testdir"
+#define TEST_FILE       TEST_DIRECTORY "/testfile"
+#define TEST_FILE2      TEST_DIRECTORY "/nextfile"
+
+#define MAX_DEVICE_NAME  32
+#define BUF_SIZE         16
+
+static char text[] = "Lorem ipsum dolor sit amet, consectetur adipisicing elit";
+
+static char *read_root(void)
 {
-	int rc;
-
-	rc = mount("tmpfs", "/", "nulldev0", "", 0);
-	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)
-		printf("created directory /mydir\n");
+	TPRINTF("Opening the root directory...");
 	
-	int fd0 = open("/mydir/myfile", O_CREAT);
-	if (fd0 < 0)
-		return "open() failed.\n";
-	if (!quiet)
-		printf("created file /mydir/myfile, fd=%d\n", fd0);
-
-	ssize_t cnt;
-	size_t size = sizeof(text);
-	cnt = write(fd0, text, size);
-	if (cnt < 0)
-		return "write() failed.\n";
-	if (!quiet)
-		printf("written %d bytes, fd=%d\n", cnt, fd0);
-	if (lseek(fd0, 0, SEEK_SET) != 0)
-		return "lseek() failed.\n";
-	if (!quiet)
-		printf("sought to position 0, fd=%d\n", fd0);
-
-	char buf[10];
-
-	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);
-	}
-
-	close(fd0);
-
-	DIR *dirp;
+	DIR *dirp = opendir("/");
+	if (!dirp) {
+		TPRINTF("\n");
+		return "opendir() failed";
+	} else
+		TPRINTF("OK\n");
+	
 	struct dirent *dp;
-
-	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);
+		TPRINTF(" node \"%s\"\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;
 }
 
+char *test_vfs1(void)
+{
+	if (mkdir(MOUNT_POINT, 0) != 0)
+		return "mkdir() failed";
+	TPRINTF("Created directory %s\n", MOUNT_POINT);
+	
+	char null[MAX_DEVICE_NAME];
+	int null_id = devmap_null_create();
+	
+	if (null_id == -1)
+		return "Unable to create null device";
+	
+	snprintf(null, MAX_DEVICE_NAME, "null%d", null_id);
+	int rc = mount(FS_TYPE, MOUNT_POINT, null, OPTIONS, FLAGS);
+	switch (rc) {
+	case EOK:
+		TPRINTF("Mounted /dev/%s as %s on %s\n", null, FS_TYPE, MOUNT_POINT);
+		break;
+	case EBUSY:
+		TPRINTF("(INFO) Filesystem already mounted on %s\n", MOUNT_POINT);
+		break;
+	default:
+		TPRINTF("(ERR) IPC returned errno %d (is tmpfs loaded?)\n", rc);
+		return "mount() failed";
+	}
+	
+	if (mkdir(TEST_DIRECTORY, 0) != 0)
+		return "mkdir() failed";
+	TPRINTF("Created directory %s\n", TEST_DIRECTORY);
+	
+	int fd0 = open(TEST_FILE, O_CREAT);
+	if (fd0 < 0)
+		return "open() failed";
+	TPRINTF("Created file %s (fd=%d)\n", TEST_FILE, fd0);
+	
+	size_t size = sizeof(text);
+	ssize_t cnt = write(fd0, text, size);
+	if (cnt < 0)
+		return "write() failed";
+	TPRINTF("Written %d bytes\n", cnt);
+	
+	if (lseek(fd0, 0, SEEK_SET) != 0)
+		return "lseek() failed";
+	TPRINTF("Sought to position 0\n");
+	
+	char buf[BUF_SIZE];
+	while ((cnt = read(fd0, buf, BUF_SIZE))) {
+		if (cnt < 0)
+			return "read() failed";
+		
+		TPRINTF("Read %d bytes: \".*s\"\n", cnt, cnt, buf);
+	}
+	
+	close(fd0);
+	
+	char *rv = read_root();
+	if (rv != NULL)
+		return rv;
+	
+	if (rename(TEST_FILE, TEST_FILE2))
+		return "rename() failed";
+	TPRINTF("Renamed %s to %s\n", TEST_FILE, TEST_FILE2);
+	
+	if (unlink(TEST_FILE2))
+		return "unlink() failed";
+	TPRINTF("Unlinked %s\n", TEST_FILE2);
+	
+	if (rmdir(TEST_DIRECTORY))
+		return "rmdir() failed";
+	TPRINTF("Removed directory %s\n", TEST_DIRECTORY);
+	
+	rv = read_root();
+	if (rv != NULL)
+		return rv;
+	
+	return NULL;
+}
