<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Meng,</div></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
--- a/testcases/kernel/syscalls/link/link02.c<br>
+++ b/testcases/kernel/syscalls/link/link02.c<br>
@@ -34,23 +34,14 @@<br>
  */<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">For the Copyright & Licence we should respect the original</div><div class="gmail_default" style="font-size:small">author and use SPDX format.  Something like this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">// SPDX-License-Identifier: GPL-2.0-or-later<br>/*<br> * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.<br> *  AUTHOR           : William Roske<br> *  CO-PILOT         : Dave Fenner<br> * Copyright (c) 2014 Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>><br> */<br></div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-int main(int ac, char **av)<br>
-{<br>
-       int lc;<br>
+       TST_EXP_PASS(link(OLDPATH, NEWPATH));<br>
<br>
-       tst_parse_opts(ac, av, NULL, NULL);<br>
+       if (!TST_PASS)<br>
+               return;<br>
<br>
-       setup();<br>
+       SAFE_STAT(OLDPATH, &fbuf);<br>
+       SAFE_STAT(NEWPATH, &lbuf);<br>
<br>
-       for (lc = 0; TEST_LOOPING(lc); lc++) {<br>
-               tst_count = 0;<br>
-               verify_link();<br>
+       if (fbuf.st_nlink > 1 && fbuf.st_nlink == lbuf.st_nlink) {<br>
+               tst_res(TPASS, "link("OLDPATH","NEWPATH") "<br>
+                                 "returned 0 and stat link counts match");<br>
+       } else {<br>
+               tst_res(TFAIL, "link("OLDPATH","NEWPATH") returned 0"<br>
+                                 " but stat link counts do not match %d %d",<br>
+                                 (int)fbuf.st_nlink, (int)lbuf.st_nlink);<br>
        }<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">As I mentioned we have to do unlink() here otherwise</div><div class="gmail_default" style="font-size:small">test can not run pass with -i option.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">        SAFE_UNLINK(NEWPATH);<br></div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small"> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+static struct tst_test test = {<br>
+    .test_all = verify_link,<br>
+    .setup = setup,<br>
+    .needs_tmpdir = 1,<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I'd suggest using tab instead of space to make</div><div class="gmail_default" style="font-size:small">code indent.</div></div></div><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>