[LTP] [PATCH 3/4] newlib: Allow SAFE_MACROS to be called from cleanup

Cyril Hrubis chrubis@suse.cz
Tue Feb 14 14:52:31 CET 2017


Hi!
OK to commit the patchset with fixed warnings and this addition to the docs?

 -------------------------------------------------------------------------------
 static void cleanup(void)
 {
-       if (fd1 > 0 && close(fd1))
-               tst_res(TWARN | TERRNO, "close(fd1)");
+       if (fd1 > 0)
+               SAFE_CLOSE(fd1);
 
-       if (fd0 > 0 && close(fd0))
-               tst_res(TWARN | TERRNO, "close(fd0)");
+       if (fd0 > 0)
+               SAFE_CLOSE(fd0);
 
        if (mount_flag && tst_umouont(MNTPOINT))
-               tst_res(TBROK | TERRNO, "umount(%s)", MNTPOINT);
+               tst_res(TWARN | TERRNO, "umount(%s)", MNTPOINT);
 }
 -------------------------------------------------------------------------------
 
+IMPORTANT: 'SAFE_MACROS()' used in cleanup *do not* exit the test. Failure
+           only produces a warning and the 'cleanup()' carries on. This is
+          intentional as we want to execute as much 'cleanup()' as possible.
+
+WARNING: Calling tst_brk() in test 'cleanup()' does not exit the test as well
+         and 'TBROK' is converted to 'TWARN'.
+


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list