Index: /trunk/include/iprt/test.h
===================================================================
--- /trunk/include/iprt/test.h	(revision 19951)
+++ /trunk/include/iprt/test.h	(revision 19952)
@@ -348,4 +348,34 @@
          } \
     } while (0)
+/** @def RTTEST_CHECK_RET
+ * Check whether a boolean expression holds true, returns on false.
+ *
+ * If the expression is false, call RTTestFailed giving the line number and expression.
+ *
+ * @param   hTest       The test handle.
+ * @param   expr        The expression to evaluate.
+ * @param   rcRet       What to return on failure.
+ */
+#define RTTEST_CHECK_RET(hTest, expr, rcRet) \
+    do { if (!(expr)) { \
+            RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \
+            return (rcRet); \
+         } \
+    } while (0)
+/** @def RTTEST_CHECK_RETV
+ * Check whether a boolean expression holds true, returns void on false.
+ *
+ * If the expression is false, call RTTestFailed giving the line number and expression.
+ *
+ * @param   hTest       The test handle.
+ * @param   expr        The expression to evaluate.
+ */
+#define RTTEST_CHECK_RETV(hTest, expr) \
+    do { if (!(expr)) { \
+            RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \
+            return; \
+         } \
+    } while (0)
+
 
 /** @def RTTEST_CHECK_MSG
@@ -365,21 +395,4 @@
          } \
     } while (0)
-
-/** @def RTTEST_CHECK_RET
- * Check whether a boolean expression holds true, returns on false.
- *
- * If the expression is false, call RTTestFailed giving the line number and expression.
- *
- * @param   hTest       The test handle.
- * @param   expr        The expression to evaluate.
- * @param   rcRet       What to return on failure.
- */
-#define RTTEST_CHECK_RET(hTest, expr, rcRet) \
-    do { if (!(expr)) { \
-            RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \
-            return (rcRet); \
-         } \
-    } while (0)
-
 /** @def RTTEST_CHECK_MSG_RET
  * Check whether a boolean expression holds true, returns on false.
@@ -400,20 +413,4 @@
          } \
     } while (0)
-
-/** @def RTTEST_CHECK_RETV
- * Check whether a boolean expression holds true, returns void on false.
- *
- * If the expression is false, call RTTestFailed giving the line number and expression.
- *
- * @param   hTest       The test handle.
- * @param   expr        The expression to evaluate.
- */
-#define RTTEST_CHECK_RETV(hTest, expr) \
-    do { if (!(expr)) { \
-            RTTestFailed((hTest), "line %u: %s", __LINE__, #expr); \
-            return; \
-         } \
-    } while (0)
-
 /** @def RTTEST_CHECK_MSG_RET
  * Check whether a boolean expression holds true, returns void on false.
@@ -434,4 +431,5 @@
     } while (0)
 
+
 /** @def RTTEST_CHECK_RC
  * Check whether an expression returns a specific IPRT style status code.
@@ -445,5 +443,5 @@
  *                          more than once by the macro.
  */
-#define RTTEST_CHECK_RC(rcExpr, rcExpect) \
+#define RTTEST_CHECK_RC(hTest, rcExpr, rcExpect) \
     do { \
         int rcCheck = (rcExpr); \
@@ -452,4 +450,44 @@
         } \
     } while (0)
+/** @def RTTEST_CHECK_RC_RET
+ * Check whether an expression returns a specific IPRT style status code.
+ *
+ * If a different status code is return, call RTTestFailed giving the line
+ * number, expression, actual and expected status codes, then return.
+ *
+ * @param   hTest           The test handle.
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ * @param   rcExpect        The expected return code. This may be referenced
+ *                          more than once by the macro.
+ * @param   rcRet           The return code.
+ */
+#define RTTEST_CHECK_RC_RET(hTest, rcExpr, rcExpect, rcRet) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (rcCheck != (rcExpect)) { \
+            RTTestFailed((hTest), "line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \
+            return (rcRet); \
+        } \
+    } while (0)
+/** @def RTTEST_CHECK_RC_RETV
+ * Check whether an expression returns a specific IPRT style status code.
+ *
+ * If a different status code is return, call RTTestFailed giving the line
+ * number, expression, actual and expected status codes, then return.
+ *
+ * @param   hTest           The test handle.
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ * @param   rcExpect        The expected return code. This may be referenced
+ *                          more than once by the macro.
+ */
+#define RTTEST_CHECK_RC_RETV(hTest, rcExpr, rcExpect) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (rcCheck != (rcExpect)) { \
+            RTTestFailed((hTest), "line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \
+            return; \
+        } \
+    } while (0)
+
 
 /** @def RTTEST_CHECK_RC_OK
@@ -467,4 +505,39 @@
         if (RT_FAILURE(rcCheck)) { \
             RTTestFailed((hTest), "line %u: %s: %Rrc", __LINE__, #rcExpr, rc); \
+        } \
+    } while (0)
+/** @def RTTEST_CHECK_RC_OK_RET
+ * Check whether a IPRT style status code indicates success.
+ *
+ * If the status indicates failure, call RTTestFailed giving the line number,
+ * expression and status code, then return with the specified value.
+ *
+ * @param   hTest           The test handle.
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ * @param   rcRet           The return code.
+ */
+#define RTTEST_CHECK_RC_OK_RET(hTest, rcExpr, rcRet) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (RT_FAILURE(rcCheck)) { \
+            RTTestFailed((hTest), "line %u: %s: %Rrc", __LINE__, #rcExpr, rc); \
+            return (rcRet); \
+        } \
+    } while (0)
+/** @def RTTEST_CHECK_RC_OK_RETV
+ * Check whether a IPRT style status code indicates success.
+ *
+ * If the status indicates failure, call RTTestFailed giving the line number,
+ * expression and status code, then return.
+ *
+ * @param   hTest           The test handle.
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ */
+#define RTTEST_CHECK_RC_OK_RETV(hTest, rcExpr) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (RT_FAILURE(rcCheck)) { \
+            RTTestFailed((hTest), "line %u: %s: %Rrc", __LINE__, #rcExpr, rc); \
+            return; \
         } \
     } while (0)
@@ -619,4 +692,34 @@
          } \
     } while (0)
+/** @def RTTESTI_CHECK_RET
+ * Check whether a boolean expression holds true, returns on false.
+ *
+ * If the expression is false, call RTTestIFailed giving the line number and
+ * expression.
+ *
+ * @param   expr        The expression to evaluate.
+ * @param   rcRet       What to return on failure.
+ */
+#define RTTESTI_CHECK_RET(expr, rcRet) \
+    do { if (!(expr)) { \
+            RTTestIFailed("line %u: %s", __LINE__, #expr); \
+            return (rcRet); \
+         } \
+    } while (0)
+/** @def RTTESTI_CHECK_RETV
+ * Check whether a boolean expression holds true, returns void on false.
+ *
+ * If the expression is false, call RTTestIFailed giving the line number and
+ * expression.
+ *
+ * @param   expr        The expression to evaluate.
+ */
+#define RTTESTI_CHECK_RETV(expr) \
+    do { if (!(expr)) { \
+            RTTestIFailed("line %u: %s", __LINE__, #expr); \
+            return; \
+         } \
+    } while (0)
+
 
 /** @def RTTESTI_CHECK_MSG
@@ -636,21 +739,4 @@
          } \
     } while (0)
-
-/** @def RTTESTI_CHECK_RET
- * Check whether a boolean expression holds true, returns on false.
- *
- * If the expression is false, call RTTestIFailed giving the line number and
- * expression.
- *
- * @param   expr        The expression to evaluate.
- * @param   rcRet       What to return on failure.
- */
-#define RTTESTI_CHECK_RET(expr, rcRet) \
-    do { if (!(expr)) { \
-            RTTestIFailed("line %u: %s", __LINE__, #expr); \
-            return (rcRet); \
-         } \
-    } while (0)
-
 /** @def RTTESTI_CHECK_MSG_RET
  * Check whether a boolean expression holds true, returns on false.
@@ -671,20 +757,4 @@
          } \
     } while (0)
-
-/** @def RTTESTI_CHECK_RETV
- * Check whether a boolean expression holds true, returns void on false.
- *
- * If the expression is false, call RTTestIFailed giving the line number and
- * expression.
- *
- * @param   expr        The expression to evaluate.
- */
-#define RTTESTI_CHECK_RETV(expr) \
-    do { if (!(expr)) { \
-            RTTestIFailed("line %u: %s", __LINE__, #expr); \
-            return; \
-         } \
-    } while (0)
-
 /** @def RTTESTI_CHECK_MSG_RET
  * Check whether a boolean expression holds true, returns void on false.
@@ -705,4 +775,5 @@
     } while (0)
 
+
 /** @def RTTESTI_CHECK_RC
  * Check whether an expression returns a specific IPRT style status code.
@@ -722,4 +793,42 @@
         } \
     } while (0)
+/** @def RTTESTI_CHECK_RC_RET
+ * Check whether an expression returns a specific IPRT style status code.
+ *
+ * If a different status code is return, call RTTestIFailed giving the line
+ * number, expression, actual and expected status codes, then return.
+ *
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ * @param   rcExpect        The expected return code. This may be referenced
+ *                          more than once by the macro.
+ * @param   rcRet           The return code.
+ */
+#define RTTESTI_CHECK_RC_RET(rcExpr, rcExpect, rcRet) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (rcCheck != (rcExpect)) { \
+            RTTestIFailed("line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \
+            return (rcRet); \
+        } \
+    } while (0)
+/** @def RTTESTI_CHECK_RC_RETV
+ * Check whether an expression returns a specific IPRT style status code.
+ *
+ * If a different status code is return, call RTTestIFailed giving the line
+ * number, expression, actual and expected status codes, then return.
+ *
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ * @param   rcExpect        The expected return code. This may be referenced
+ *                          more than once by the macro.
+ */
+#define RTTESTI_CHECK_RC_RETV(rcExpr, rcExpect) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (rcCheck != (rcExpect)) { \
+            RTTestIFailed("line %u: %s: expected %Rrc, got %Rrc", __LINE__, #rcExpr, (rcExpect), rcCheck); \
+            return; \
+        } \
+    } while (0)
+
 
 /** @def RTTESTI_CHECK_RC_OK
@@ -738,5 +847,37 @@
         } \
     } while (0)
-
+/** @def RTTESTI_CHECK_RC_OK_RET
+ * Check whether a IPRT style status code indicates success.
+ *
+ * If the status indicates failure, call RTTestIFailed giving the line number,
+ * expression and status code, then return with the specified value.
+ *
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ * @param   rcRet           The return code.
+ */
+#define RTTESTI_CHECK_RC_OK_RET(rcExpr, rcRet) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (RT_FAILURE(rcCheck)) { \
+            RTTestIFailed("line %u: %s: %Rrc", __LINE__, #rcExpr, rcCheck); \
+            return (rcRet); \
+        } \
+    } while (0)
+/** @def RTTESTI_CHECK_RC_OK_RETV
+ * Check whether a IPRT style status code indicates success.
+ *
+ * If the status indicates failure, call RTTestIFailed giving the line number,
+ * expression and status code, then return.
+ *
+ * @param   rcExpr          The expression resulting an IPRT status code.
+ */
+#define RTTESTI_CHECK_RC_OK_RETV(rcExpr) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (RT_FAILURE(rcCheck)) { \
+            RTTestIFailed("line %u: %s: %Rrc", __LINE__, #rcExpr, rcCheck); \
+            return; \
+        } \
+    } while (0)
 
 /** @} */
Index: /trunk/src/VBox/Runtime/r3/test.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/test.cpp	(revision 19951)
+++ /trunk/src/VBox/Runtime/r3/test.cpp	(revision 19952)
@@ -993,6 +993,10 @@
         va_copy(va2, va);
 
+        const char *pszEnd = strchr(pszFormat, '\0');
+        bool fHasNewLine = pszFormat != pszEnd
+                        && pszEnd[-1] == '\n';
+
         RTCritSectEnter(&pTest->OutputLock);
-        cch += rtTestPrintf(pTest, "%N\n", pszFormat, &va2);
+        cch += rtTestPrintf(pTest, fHasNewLine ? "%N" : "%N\n", pszFormat, &va2);
         RTCritSectLeave(&pTest->OutputLock);
 
