Index: uspace/lib/pcut/tests/abort.c
===================================================================
--- uspace/lib/pcut/tests/abort.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/abort.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2012-2013 Vojtech Horky
+ * 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 <pcut/pcut.h>
+#include <stdlib.h>
+
+PCUT_INIT
+
+PCUT_TEST(access_null_pointer) {
+	abort();
+}
+
+PCUT_MAIN()
Index: uspace/lib/pcut/tests/abort.expected
===================================================================
--- uspace/lib/pcut/tests/abort.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/abort.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,4 @@
+1..1
+#> Starting suite Default.
+not ok 1 access_null_pointer aborted
+#> Finished suite Default (failed 1 of 1).
Index: uspace/lib/pcut/tests/alloc.c
===================================================================
--- uspace/lib/pcut/tests/alloc.c	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * 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 <pcut/pcut.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-PCUT_INIT
-
-static char *buffer = NULL;
-#define BUFFER_SIZE 512
-
-PCUT_TEST_SUITE(suite_with_setup_and_teardown)
-
-PCUT_TEST_BEFORE {
-	buffer = malloc(BUFFER_SIZE);
-	PCUT_ASSERT_NOT_NULL(buffer);
-}
-
-PCUT_TEST_AFTER {
-	free(buffer);
-	buffer = NULL;
-}
-
-PCUT_TEST(snprintf) {
-	snprintf(buffer, BUFFER_SIZE - 1, "%d-%s", 56, "abcd");
-	PCUT_ASSERT_STR_EQUALS("56-abcd", buffer);
-}
-
-PCUT_TEST_SUITE(another_without_setup)
-
-PCUT_TEST(whatever) {
-	PCUT_ASSERT_NULL(buffer);
-}
-
-
-PCUT_MAIN()
Index: uspace/lib/pcut/tests/alloc.expected
===================================================================
--- uspace/lib/pcut/tests/alloc.expected	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ 	(revision )
@@ -1,7 +1,0 @@
-1..2
-#> Starting suite suite_with_setup_and_teardown.
-ok 1 snprintf
-#> Finished suite suite_with_setup_and_teardown (failed 0 of 1).
-#> Starting suite another_without_setup.
-ok 2 whatever
-#> Finished suite another_without_setup (failed 0 of 1).
Index: uspace/lib/pcut/tests/beforeafter.c
===================================================================
--- uspace/lib/pcut/tests/beforeafter.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/beforeafter.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012-2013 Vojtech Horky
+ * 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.
+ */
+
+#define _BSD_SOURCE
+
+#include <pcut/pcut.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+/*
+ * Use sprintf_s in Windows but only with Microsoft compiler.
+ * Namely, let MinGW use snprintf.
+ */
+#if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
+#define snprintf sprintf_s
+#endif
+
+PCUT_INIT
+
+static char *buffer = NULL;
+#define BUFFER_SIZE 512
+
+PCUT_TEST_SUITE(suite_with_setup_and_teardown);
+
+PCUT_TEST_BEFORE {
+	buffer = malloc(BUFFER_SIZE);
+	PCUT_ASSERT_NOT_NULL(buffer);
+}
+
+PCUT_TEST_AFTER {
+	free(buffer);
+	buffer = NULL;
+}
+
+PCUT_TEST(test_with_setup_and_teardown) {
+	snprintf(buffer, BUFFER_SIZE - 1, "%d-%s", 56, "abcd");
+	PCUT_ASSERT_STR_EQUALS("56-abcd", buffer);
+}
+
+PCUT_TEST_SUITE(another_without_setup);
+
+PCUT_TEST(test_without_any_setup_or_teardown) {
+	PCUT_ASSERT_NULL(buffer);
+}
+
+
+PCUT_MAIN()
Index: uspace/lib/pcut/tests/beforeafter.expected
===================================================================
--- uspace/lib/pcut/tests/beforeafter.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/beforeafter.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,7 @@
+1..2
+#> Starting suite suite_with_setup_and_teardown.
+ok 1 test_with_setup_and_teardown
+#> Finished suite suite_with_setup_and_teardown (failed 0 of 1).
+#> Starting suite another_without_setup.
+ok 2 test_without_any_setup_or_teardown
+#> Finished suite another_without_setup (failed 0 of 1).
Index: uspace/lib/pcut/tests/errno.expected
===================================================================
--- uspace/lib/pcut/tests/errno.expected	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ uspace/lib/pcut/tests/errno.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -2,6 +2,6 @@
 #> Starting suite Default.
 not ok 1 errno_value failed
-# error: errno.c:46: Expected error 0 (EOK, Success) but got error 2 (No such file or directory)
+# error: errno.c:46: Expected error 0 (EOK, *****) but got error ***** (*****)
 not ok 2 errno_variable failed
-# error: errno.c:54: Expected error 0 (EOK, Success) but got error 2 (No such file or directory)
+# error: errno.c:54: Expected error 0 (EOK, *****) but got error ***** (*****)
 #> Finished suite Default (failed 2 of 2).
Index: uspace/lib/pcut/tests/inithook.c
===================================================================
--- uspace/lib/pcut/tests/inithook.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/inithook.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014 Vojtech Horky
+ * 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 <pcut/pcut.h>
+#include "tested.h"
+
+PCUT_INIT
+
+static int init_counter = 0;
+
+static void init_hook(void) {
+	init_counter++;
+}
+
+PCUT_TEST_BEFORE {
+	PCUT_ASSERT_INT_EQUALS(1, init_counter);
+	init_counter++;
+}
+
+PCUT_TEST(check_init_counter) {
+	PCUT_ASSERT_INT_EQUALS(2, init_counter);
+}
+
+PCUT_TEST(check_init_counter_2) {
+	PCUT_ASSERT_INT_EQUALS(2, init_counter);
+}
+
+
+PCUT_CUSTOM_MAIN(
+	PCUT_MAIN_SET_INIT_HOOK(init_hook)
+)
+
Index: uspace/lib/pcut/tests/inithook.expected
===================================================================
--- uspace/lib/pcut/tests/inithook.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/inithook.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,5 @@
+1..2
+#> Starting suite Default.
+ok 1 check_init_counter
+ok 2 check_init_counter_2
+#> Finished suite Default (failed 0 of 2).
Index: uspace/lib/pcut/tests/null.c
===================================================================
--- uspace/lib/pcut/tests/null.c	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * 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 <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST(access_null_pointer) {
-	int a = 5;
-	int *p = &a;
-	PCUT_ASSERT_INT_EQUALS(5, *p);
-	p = NULL;
-	PCUT_ASSERT_INT_EQUALS(5, *p);
-}
-
-PCUT_MAIN()
Index: uspace/lib/pcut/tests/null.expected
===================================================================
--- uspace/lib/pcut/tests/null.expected	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ 	(revision )
@@ -1,4 +1,0 @@
-1..1
-#> Starting suite Default.
-not ok 1 access_null_pointer aborted
-#> Finished suite Default (failed 1 of 1).
Index: uspace/lib/pcut/tests/nullteardown.c
===================================================================
--- uspace/lib/pcut/tests/nullteardown.c	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * 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 <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST_AFTER {
-	int a = 5;
-	int *p = &a;
-	PCUT_ASSERT_INT_EQUALS(5, *p);
-	p = NULL;
-	PCUT_ASSERT_INT_EQUALS(5, *p);
-}
-
-PCUT_TEST(print_and_fail) {
-	printf("Tear-down will cause null pointer access...\n");
-	PCUT_ASSERT_NOT_NULL(NULL);
-}
-
-PCUT_MAIN()
Index: uspace/lib/pcut/tests/nullteardown.expected
===================================================================
--- uspace/lib/pcut/tests/nullteardown.expected	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ 	(revision )
@@ -1,6 +1,0 @@
-1..1
-#> Starting suite Default.
-not ok 1 print_and_fail aborted
-# error: nullteardown.c:45: Pointer <NULL> ought not to be NULL
-# stdio: Tear-down will cause null pointer access...
-#> Finished suite Default (failed 1 of 1).
Index: uspace/lib/pcut/tests/preinithook.c
===================================================================
--- uspace/lib/pcut/tests/preinithook.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/preinithook.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014 Vojtech Horky
+ * 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 <pcut/pcut.h>
+#include "tested.h"
+
+PCUT_INIT
+
+static int init_counter = 1;
+
+static void init_hook(void) {
+	init_counter++;
+}
+
+static void pre_init_hook(int *argc, char **argv[]) {
+	(void) argc;
+	(void) argv;
+	init_counter *= 2;
+}
+
+PCUT_TEST_BEFORE {
+	PCUT_ASSERT_INT_EQUALS(4, init_counter);
+	init_counter++;
+}
+
+PCUT_TEST(check_init_counter) {
+	PCUT_ASSERT_INT_EQUALS(5, init_counter);
+}
+
+PCUT_TEST(check_init_counter_2) {
+	PCUT_ASSERT_INT_EQUALS(5, init_counter);
+}
+
+
+PCUT_CUSTOM_MAIN(
+	PCUT_MAIN_SET_INIT_HOOK(init_hook),
+	PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
+)
+
Index: uspace/lib/pcut/tests/preinithook.expected
===================================================================
--- uspace/lib/pcut/tests/preinithook.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/preinithook.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,5 @@
+1..2
+#> Starting suite Default.
+ok 1 check_init_counter
+ok 2 check_init_counter_2
+#> Finished suite Default (failed 0 of 2).
Index: uspace/lib/pcut/tests/teardown.c
===================================================================
--- uspace/lib/pcut/tests/teardown.c	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ uspace/lib/pcut/tests/teardown.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -50,5 +50,5 @@
 
 
-PCUT_TEST_SUITE(with_failing_teardown)
+PCUT_TEST_SUITE(with_failing_teardown);
 
 PCUT_TEST_AFTER {
Index: uspace/lib/pcut/tests/teardownaborts.c
===================================================================
--- uspace/lib/pcut/tests/teardownaborts.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/teardownaborts.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012-2013 Vojtech Horky
+ * 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 <pcut/pcut.h>
+#include <stdlib.h>
+
+PCUT_INIT
+
+PCUT_TEST_AFTER {
+	abort();
+}
+
+PCUT_TEST(print_and_fail) {
+	printf("Tear-down will cause null pointer access...\n");
+	PCUT_ASSERT_NOT_NULL(NULL);
+}
+
+PCUT_MAIN()
Index: uspace/lib/pcut/tests/teardownaborts.expected
===================================================================
--- uspace/lib/pcut/tests/teardownaborts.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/teardownaborts.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,6 @@
+1..1
+#> Starting suite Default.
+not ok 1 print_and_fail aborted
+# error: teardownaborts.c:41: Pointer <NULL> ought not to be NULL
+# stdio: Tear-down will cause null pointer access...
+#> Finished suite Default (failed 1 of 1).
Index: uspace/lib/pcut/tests/testlist.c
===================================================================
--- uspace/lib/pcut/tests/testlist.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/testlist.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014 Vojtech Horky
+ * 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 <pcut/pcut.h>
+#include "tested.h"
+
+PCUT_INIT
+
+static char *argv_patched[] = {
+	NULL, /* Will be patched at run-time. */
+	(char *) "-l",
+	NULL
+};
+
+static void pre_init_hook(int *argc, char **argv[]) {
+	argv_patched[0] = (*argv)[0];
+	*argc = 2;
+	*argv = argv_patched;
+}
+
+PCUT_TEST(unreachable) {
+	PCUT_ASSERT_TRUE(0 && "unreachable code");
+}
+
+
+PCUT_CUSTOM_MAIN(
+	PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
+)
+
Index: uspace/lib/pcut/tests/testlist.expected
===================================================================
--- uspace/lib/pcut/tests/testlist.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/testlist.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,2 @@
+*****Suite `Default' [1]
+*****Test `unreachable' [2]
Index: uspace/lib/pcut/tests/timeout.c
===================================================================
--- uspace/lib/pcut/tests/timeout.c	(revision 8db09e4ffaee17ba3226367a0a44dd24c32fa0a3)
+++ uspace/lib/pcut/tests/timeout.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -28,7 +28,23 @@
 
 #include <pcut/pcut.h>
+
+#ifdef __unix
 #include <unistd.h>
+#endif
+#if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
+#include <windows.h>
+#endif
+
 #include <stdio.h>
 #include "tested.h"
+
+static void my_sleep(int sec) {
+#ifdef __unix
+	sleep(sec);
+#endif
+#if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
+	Sleep(1000 * sec);
+#endif
+}
 
 PCUT_INIT
@@ -36,5 +52,5 @@
 PCUT_TEST(shall_time_out) {
 	printf("Text before sleeping.\n");
-	sleep(PCUT_DEFAULT_TEST_TIMEOUT * 5);
+	my_sleep(PCUT_DEFAULT_TEST_TIMEOUT * 5);
 	printf("Text after the sleep.\n");
 }
@@ -43,5 +59,5 @@
 		PCUT_TEST_SET_TIMEOUT(PCUT_DEFAULT_TEST_TIMEOUT * 3)) {
 	printf("Text before sleeping.\n");
-	sleep(PCUT_DEFAULT_TEST_TIMEOUT * 2);
+	my_sleep(PCUT_DEFAULT_TEST_TIMEOUT * 2);
 	printf("Text after the sleep.\n");
 }
Index: uspace/lib/pcut/tests/xmlreport.c
===================================================================
--- uspace/lib/pcut/tests/xmlreport.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/xmlreport.c	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014 Vojtech Horky
+ * 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 <pcut/pcut.h>
+#include "tested.h"
+
+#include <pcut/pcut.h>
+#include "tested.h"
+
+PCUT_INIT
+
+PCUT_TEST(zero_exponent) {
+	PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
+}
+
+PCUT_TEST(one_exponent) {
+	PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
+	PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
+}
+
+PCUT_TEST(same_strings) {
+	const char *p = "xyz";
+	PCUT_ASSERT_STR_EQUALS("xyz", p);
+	PCUT_ASSERT_STR_EQUALS("abc", "XXXabd" + 3);
+}
+
+PCUT_CUSTOM_MAIN(
+	PCUT_MAIN_SET_XML_REPORT
+)
Index: uspace/lib/pcut/tests/xmlreport.expected
===================================================================
--- uspace/lib/pcut/tests/xmlreport.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
+++ uspace/lib/pcut/tests/xmlreport.expected	(revision 9b201262edcb92c27cf4a25a8379320113426ab7)
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<report tests-total="3">
+	<suite name="Default">
+		<testcase name="zero_exponent" status="fail">
+			<error-message><![CDATA[xmlreport.c:38: Expected <1> but got <0> (1 != intpow(2, 0))
+]]></error-message>
+		</testcase><!-- zero_exponent -->
+		<testcase name="one_exponent" status="fail">
+			<error-message><![CDATA[xmlreport.c:42: Expected <2> but got <0> (2 != intpow(2, 1))
+]]></error-message>
+		</testcase><!-- one_exponent -->
+		<testcase name="same_strings" status="fail">
+			<error-message><![CDATA[xmlreport.c:49: Expected <abc> but got <abd> ("abc" != "XXXabd" + 3)
+]]></error-message>
+		</testcase><!-- same_strings -->
+	</suite><!-- Default: 3 / 3 -->
+</report>
