lib: Add new test library API

The main features are:

o The cleanup callback is not passed directly to various library functions but
  is set once globally in the structure that describes a test

   - this makes the test API easier to use

   - also fixes a few common mistakes such as passing cleanup callback
     to functions executed from a cleanup

o Most of the boilerplate code is moved to library

  - no more copying standard looping code around :)

o Various resources are initialized and freed automatically when requested

  - this means much less race conditions and ordering problems in cleanups

o The result reporting functions now use shared memory to propagate
  test results from child processes

  - writing tests in child processes is now easier than ever

+ The test-writing-guidelines.txt were updated

Many thanks to Jan who reviewed numerous respins of this patches and
provided valuable suggestions and also to Alexey who pointed out some
stupid mistakes of mine.

Reviewed-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/safe_file_ops.c b/lib/safe_file_ops.c
index a46939a..dff85cd 100644
--- a/lib/safe_file_ops.c
+++ b/lib/safe_file_ops.c
@@ -31,7 +31,8 @@
 #include <unistd.h>
 #include <utime.h>
 
-#include "safe_file_ops.h"
+#include "test.h"
+#include "safe_file_ops_fn.h"
 
 /*
  * Count number of expected assigned conversions. Any conversion starts with '%'.