<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 30, 2021 at 3:10 PM zhanglianjie <<a href="mailto:zhanglianjie@uniontech.com">zhanglianjie@uniontech.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Add TST_EXP_VAL to determine whether the return value<br>
is equal to the given value.<br>
<br>
Signed-off-by: zhanglianjie <<a href="mailto:zhanglianjie@uniontech.com" target="_blank">zhanglianjie@uniontech.com</a>><br></blockquote><div><span class="gmail_default" style="font-size:small"> Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>></span></div><div><span class="gmail_default" style="font-size:small"></span> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h<br>
index 50598aa15..0ccc01f49 100644<br>
--- a/include/tst_test_macros.h<br>
+++ b/include/tst_test_macros.h<br>
@@ -132,6 +132,34 @@ extern void *TST_RET_PTR;<br>
                        TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__);     \<br>
        } while (0)                                                            \<br>
<br>
+<br>
+#define TST_EXP_VAL_SILENT_(SCALL, SSCALL, VAL, ...)                           \<br>
+       do {                                                                   \<br>
+               TEST(SCALL);                                                   \<br>
+                                                                              \<br>
+               TST_PASS = 0;                                                  \<br>
+                                                                              \<br>
+               if (TST_RET != VAL) {                                          \<br>
+                       TST_MSGP_(TFAIL | TTERRNO, " retval not %ld",          \<br>
+                                 (long )VAL, SSCALL, ##__VA_ARGS__);          \<br>
+                       break;                                                 \<br>
+               }                                                              \<br>
+                                                                              \<br>
+               TST_PASS = 1;                                                  \<br>
+                                                                              \<br>
+       } while (0)<br>
+<br>
+#define TST_EXP_VAL_SILENT(SCALL, VAL, ...) TST_EXP_VAL_SILENT_(SCALL, #SCALL, VAL, ##__VA_ARGS__)<br>
+<br>
+#define TST_EXP_VAL(SCALL, VAL, ...)                                           \<br>
+       do {                                                                   \<br>
+               TST_EXP_VAL_SILENT(SCALL, VAL, ##__VA_ARGS__);                 \<br>
+                                                                              \<br>
+               if (TST_PASS)                                                  \<br>
+                       TST_MSG_(TPASS, " passed", #SCALL, ##__VA_ARGS__);     \<br>
+                                                                              \<br>
+       } while(0)<br>
+<br>
 #define TST_EXP_FAIL_(PASS_COND, SCALL, SSCALL, ERRNO, ...)                    \<br>
        do {                                                                   \<br>
                TEST(SCALL);                                                   \<br>
--<br>
2.20.1<br>
<br>
<br>
<br>
<br>
-- <br>
Mailing list info: <a href="https://lists.linux.it/listinfo/ltp" rel="noreferrer" target="_blank">https://lists.linux.it/listinfo/ltp</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>