<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 Thu, Oct 24, 2019 at 12:06 AM Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</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">Hi!<br>
> Sorry, thanks for the reminder.<br>
> [I copied the below code to gmail, it always lost the indent]<br>
> <br>
> static void print_failure_hints(void)<br>
> {<br>
> unsigned int i;<br>
> int hint_printed = 0;<br>
> const struct tst_tag *tags = tst_test->tags;<br>
> <br>
> if (!tags)<br>
> return;<br>
> <br>
> for (i = 0; tags[i].name; i++) {<br>
> if (!strcmp(tags[i].name, "linux-git")) {<br>
> if (hint_printed != 1) {<br>
> hint_printed = 1;<br>
> print_colored("\nHINT: ");<br>
> printf("You _MAY_ be missing kernel fixes,<br>
> see:\n\n");<br>
> }<br>
> <br>
> printf(LINUX_GIT_URL "%s\n", tags[i].value);<br>
> } else if (!strcmp(tags[i].name, "CVE")) {<br>
> if (hint_printed != 2) {<br>
> hint_printed = 2;<br>
> print_colored("\nHINT: ");<br>
> printf("You _MAY_ be vunerable to CVE(s),<br>
> see:\n\n");<br>
> }<br>
> <br>
> printf(CVE_DB_URL "%s\n", tags[i].value);<br>
<br>
This would produce intermixed CVE and linux-git lines unless the tags<br>
are sorted correctly in the source code, I do not want to depend on the<br>
order hence the two loops.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Yes. But personally I suggest the tags sorted in order. I'm OK with two loops, it depends on you.</div></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">
<br>
> } else {<br>
> print_colored("\nERROR: ");<br>
> printf("tags[%d].name should be linux-git or<br>
> CVE\n", i);<br>
> return;<br>
<br>
I've tried to explain to pvorel already that this is a wrong place to<br>
assert the tag names. If nothing else this piece of code will be rarely<br>
triggered and the error would end up ignored.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Agree, it seems like too late to see this error in a test fails.</div></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">
<br>
I plan to assert the tag names in the docparse tool that will build the<br>
test metadata during the LTP build, so that wrong metadata will actually<br>
fail the LTP build.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Cool~ That sounds better.</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Reviewed-by: Li Wang <<a href="mailto:liwang@redhat.com">liwang@redhat.com</a>></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>