<div dir="ltr"><div><div><div><div><div><div>I would propose WL_PRIVATE, because it's logical to me to store the declarations<br>into wayland-private.h (it has been already used - or even created - for this purpose).<br>
</div>Moreover it states that the function is private (static) in the terms of Wayland.<br><br></div>Also, the UNIT_TEST define (or it's renamed alternative) have to be defined in both<br></div>src/Makefile.am and tests/Makefile.am. Wouldn't it be better to handle this define<br>
</div>via <a href="http://configure.ac">configure.ac</a> in this case?<br><br></div>Thanks,<br></div>Marek Ch<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 2 December 2013 22:18, Bryce W. Harrington <span dir="ltr"><<a href="mailto:b.harrington@samsung.com" target="_blank">b.harrington@samsung.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Nov 29, 2013 at 04:36:56PM +0200, Pekka Paalanen wrote:<br>
> On Fri, 29 Nov 2013 14:52:30 +0100<br>
> Marek Ch <<a href="mailto:mchqwerty@gmail.com">mchqwerty@gmail.com</a>> wrote:<br>
><br>
> ><br>
> > Hi!<br>
> ><br>
> > I was looking into wayland's code and I saw static wl_buffer_*<br>
> > functions and I thought: These would use a test.. But how to do it<br>
> > when they are static? I can take the code and copy it into test<br>
> > manually, but that is not good. The code can change..<br>
> ><br>
> > I solved it by writting simple scanner that is invoked, just like<br>
> > the wayland-scanner, when compiling the code. It searches for<br>
> > definitions marked by WL_EXPORT_TEST and if it finds one, it<br>
> > copies it into tests-private.c (.h, respectively).<br>
> > Test can then be linked together with this file, so it is<br>
> > guaranteed, that the test will use the code from current HEAD.<br>
> ><br>
> > The adventage is that in order to test static function there's<br>
> > no need to delete the static keyword and thus make it public.<br>
> > The disadvantage is that if the to-be-tested function uses<br>
> > any other static function, it must be exported too.<br>
> ><br>
> > To sum it up: this is more like experiment but since it worked<br>
> > for me, I'd like to ask you for your comments.<br>
> ><br>
> > P.S.<br>
> > The first patch included is not important for the scanner but<br>
> > I wrote the code having it applied so I attached it too<br>
> > (it's a patch a sent to devel-list some time ago).<br>
> > The third patch is simple example test of wl_buffer_put.<br>
><br>
> Hi,<br>
><br>
> instead of writing a C language parser to copy stuff around, how about<br>
> doing what was done with Weston matrix code? See:<br>
><br>
> <a href="http://cgit.freedesktop.org/wayland/weston/tree/tests/Makefile.am" target="_blank">http://cgit.freedesktop.org/wayland/weston/tree/tests/Makefile.am</a><br>
> <a href="http://cgit.freedesktop.org/wayland/weston/tree/shared/matrix.c" target="_blank">http://cgit.freedesktop.org/wayland/weston/tree/shared/matrix.c</a><br>
> <a href="http://cgit.freedesktop.org/wayland/weston/tree/tests/matrix-test.c" target="_blank">http://cgit.freedesktop.org/wayland/weston/tree/tests/matrix-test.c</a><br>
><br>
> and note UNIT_TEST and MATRIX_TEST_EXPORT that give the test code<br>
> access to otherwise static functions.<br>
<br>
</div></div>I agree this looks like a better approach.  I wonder if the define could<br>
be named differently to more clearly indicate that the function is<br>
normally static?  So maybe like WL_STATIC_TESTABLE or some such?<br>
<span class="HOEnZb"><font color="#888888"><br>
Bryce</font></span></blockquote></div><br></div>