unit test / run test in xfce code (here clipman)?

Sylvain Viart sylvain at opensource-expert.com
Mon Dec 27 08:36:33 CET 2021


Hi Alex,*

*I actually got some email problem, email from the list don't reach me 
anymore, I'm investigating.
I'm grabbing your answer from the webarchive in the meantime.
So you may try to CC to me too, if you think about it. 😉

So sorry I didn't explain: secure Item is a feature I introduced in 
clipman from a personal need, the goal is to hide item content in 
clipman history when sending password to the clipboard. All details are 
explained in the gitlab fork README 
<https://gitlab.xfce.org/Sylvain/xfce4-clipman-plugin/-/blob/dev-refactor-indexes/README.md>. 
The open issue that relates to my need was: xfce issue #25. 
<https://gitlab.xfce.org/panel-plugins/xfce4-clipman-plugin/-/issues/25>
The secure item are them removed automatically from clipman. Though, for 
more versatility it's done outside clipman code from the cli in bash 
example script I wrote.

To achieve my goal I had to hack much more that I though initially, and 
probably I also took much pleasure hacking opensource code too. ;-)
Especially I did introduce dbus remote process call code, for changing 
in memory data from a command line tool.


I would love to discuss more about it, but in another email thread.
Going back to unit testing and automated testing more generally.

> Though it might be relevant to your investigations that "make check" in
> the test-folder generated some binaries which can be executed

Thanks, about this Makefile target, I saw it plus the individual 
binaries target too. But I can't figure out yet how to test it afterward.
I mean if I've to run it manually, it's not the idea I've about an 
automated test suite.

But, I also arrived to the same conclusion:  « most xfce components dont 
have tests »
So I suppose I can start anywhere...

What I found:

gtk testing: https://docs.gtk.org/glib/testing.html 
<https://docs.gtk.org/glib/testing.html>
Which in turn talks about meson or automake configuration to link it to 
the build tool chain, here it seems that the project (and probably most 
xfce projects) is using automake.

So I will try to hack into it.
I found the related documentation in GNU automake doc: 
https://www.gnu.org/software/automake/manual/html_node/Use-TAP-with-the-Automake-test-harness.html 
<https://www.gnu.org/software/automake/manual/html_node/Use-TAP-with-the-Automake-test-harness.html>

It will take me some time to setup my first test, but I can go for it.
I will document everything, so interested developer could reuse my job 
on automating tests.

I also found: xfce-test and behave, but I don't know yet how to use it.
I did successfully start xfce-test and rebuild my clipman version from 
the docker instance, but the GUI Xephyr freeze quite rapidly when it's 
not used.
And the xfce-test behave failed for now. May be a incompatible container 
version.

Thanks for your feedback, I will progressively read all that doc and 
learn what to do, in order to setup a test suite.

Regards,
Sylvain.
***

Alex* acs82 at gmx.de 
<mailto:xfce4-dev%40xfce.org?Subject=Re%3A%20unit%20test%20/%20run%20test%20in%20xfce%20code%20%28here%20clipman%29%3F&In-Reply-To=%3C0a7aa712-167e-3feb-2247-b9495dc4cf8d%40gmx.de%3E>
/Sun Dec 26 23:13:32 CET 2021/

  * Previous message (by thread): unit test / run test in xfce code
    (here clipman)?
    <https://mail.xfce.org/pipermail/xfce4-dev/2021-December/032888.html>
  * *Messages sorted by:* [ date ]
    <https://mail.xfce.org/pipermail/xfce4-dev/2021-December/date.html#32889>
    [ thread ]
    <https://mail.xfce.org/pipermail/xfce4-dev/2021-December/thread.html#32889>
    [ subject ]
    <https://mail.xfce.org/pipermail/xfce4-dev/2021-December/subject.html#32889>
    [ author ]
    <https://mail.xfce.org/pipermail/xfce4-dev/2021-December/author.html#32889>


------------------------------------------------------------------------

Hi Sylvain,

I have not much idea of clipman, nor do I know much about
default-structures for tests (afaik most xfce components dont have tests)

Though it might be relevant to your investigations that "make check" in
the test-folder generated some binaries which can be executed.

It's not clear to me what "secure item feature" is .. is there an open
issue for it ?

Cheers,
Alex

Am 26.12.21 um 08:28 schrieb Sylvain Viart:
>/Hi, />//>/I've produced a consequent code modification in clipman to add secure />/item feature />/<https://gitlab.xfce.org/Sylvain/xfce4-clipman-plugin/-/tree/dev-refactor-indexes 
<https://gitlab.xfce.org/Sylvain/xfce4-clipman-plugin/-/tree/dev-refactor-indexes>>. 
/>/I now test it personally at full time since September 2021, it's />/useful and doesn't crash. />//>/I would like to add test, or more tests, because there's a tests folder. />/But I'm not sure how it should be done, nor how to automate test. />//>/I didn't find Makefile target like: make test />//>/Could you explain me how you add test to the code structure? />//>/What I already get, which doesn't explain about unit-testing strategy. />//>/https://wiki.xfce.org/dev/howto/panel_plugins#testing_and_releasing_the_plugin 
<https://wiki.xfce.org/dev/howto/panel_plugins#testing_and_releasing_the_plugin> 
/>/<https://wiki.xfce.org/dev/howto/panel_plugins#testing_and_releasing_the_plugin 
<https://wiki.xfce.org/dev/howto/panel_plugins#testing_and_releasing_the_plugin>> 
/>//>//>//>/Basically I produced a new data structure to handle index of element, />/an indexed double linked list: />//>/index:   [   0     ,       1   ,       2   ] />/             |             |           | />/list:        |             |           | />/             |             |           | />/             |             | | />/head ->   [item1] <=>  [item2] <=> [item3] />//>/Which allow me to access any element by id, and I also maintain a />/circular indexes, reusing freed index and clipman history resizing. />/I would like to refactor the code and extract the data structure from />/the history and to keep it under tests, because pointer and indexes />/already gave me some strong />/debugging sessions. So I learned remote debugging 😁 />//>/Do you have some rules about testing to follow, or could I introduce />/any Makefile target I want? />/Do you have to project example to give me that introduces testing in />/its code base? So I could borrow the code structure./

-- 
Sylvain Viart - GNU/Linux Sysadmin/Developer/DevOps - France

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.xfce.org/pipermail/xfce4-dev/attachments/20211227/861278ec/attachment.html>


More information about the Xfce4-dev mailing list