<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 Tue, Jun 18, 2019 at 5:44 AM Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.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"><br>
----- Original Message -----<br>
> Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
> ---<br>
> <a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> | 1 +<br>
> testcases/cve/meltdown.c | 5 +++++<br>
> 2 files changed, 6 insertions(+)<br>
> <br>
> diff --git a/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a> b/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
> index 5ecc92781..521f56541 100644<br>
> --- a/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
> +++ b/<a href="http://configure.ac" rel="noreferrer" target="_blank">configure.ac</a><br>
> @@ -58,6 +58,7 @@ AC_CHECK_HEADERS([ \<br>
> sys/shm.h \<br>
> sys/ustat.h \<br>
> sys/xattr.h \<br>
> + emmintrin.h \<br>
> ])<br>
> <br>
> AC_CHECK_FUNCS([ \<br>
> diff --git a/testcases/cve/meltdown.c b/testcases/cve/meltdown.c<br>
> index 72c9ec907..bc649b893 100644<br>
> --- a/testcases/cve/meltdown.c<br>
> +++ b/testcases/cve/meltdown.c<br>
> @@ -29,6 +29,7 @@<br>
> #include <ctype.h><br>
> #include <sys/utsname.h><br>
> <br>
> +#ifdef HAVE_EMMINTRIN_H<br>
> #include <emmintrin.h><br>
> <br>
> #include "libtsc.h"<br>
> @@ -387,3 +388,7 @@ static struct tst_test test = {<br>
> .cleanup = cleanup,<br>
> .min_kver = "2.6.32"<br>
> };<br>
> +<br>
> +#else /* HAVE_EMMINTRIN_H */<br>
> + TST_TEST_TCONF("<emmintrin.h> is not supported");<br>
> +#endif<br>
<br>
This seems more complicated to me than original - extra autoconf check, extra ifdef.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Indeed.</div><div class="gmail_default" style="font-size:small">I choose meltdown.c as a demo randomly, this patch is to solve the compiling error after removing ifdef __arch__ from code. So, as you can see the tst_test.arch is not perfect, but it could be used for some general situations.<br></div><div class="gmail_default" style="font-size:small"><br></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">
<br>
I can see how tst_on_arch() would be useful. Test is valid on all arches,<br>
but needs different input/constants/code/etc.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">That's the original reason I exported it in patch v1.</div><br></div><div><div class="gmail_default" style="font-size:small">Cyril and I have discussed this part, we think tst_on_arch() is not cleaner than ifdefs, so it's not suggested to use it directly in a test case.</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>
What is the motivation for tst_test.arch? Is it to have some annotation in tst_test struct?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">The first motivation is to save LTP user from arch ifdefs, moves the information from code to tst_test metadata, but seems that it can not be completely replaced because of the specific assembly inline. So I still hope to find a better way for that, even not go with this tst_test.arch.</div></div><div class="gmail_default" style="font-size:small"><br></div></div>-- <br><div dir="ltr" class="m_883723045289643623gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>