Unittests

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Unittests

Johan Ström-3
Hi,

I just commited a very first unit-test, something which the codebase is
lacking today.
Also merged the fix for FS_input_ascii_array, and some other cleanups.

The test is built with libcheck, a pretty simple C unittest library.
It is by no means a decision on a lib to use, but it's a start.

To build, ensure libcheck is installed, re-run configure, and then make
all check.

For the moment there is only a single test case, for
FS_input_ascii_array (which was fixed through with help from this test).
owfs (and C in generall) is a kindof tricky to write tests for, but it
is doable.. at least for some parts..

Of course, this just tests an extremely small portion of the owfs
codebase, but in the future we can add more, especially when debugging
errors.

Johan

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Unittests

Andy Carter
On Thursday 24 Mar 2016 16:12:49 Johan Ström wrote:

> I just commited a very first unit-test, something which the codebase is
> lacking today.
> Also merged the fix for FS_input_ascii_array, and some other cleanups.
>
> The test is built with libcheck, a pretty simple C unittest library.
> It is by no means a decision on a lib to use, but it's a start.
>
> To build, ensure libcheck is installed, re-run configure, and then make
> all check.

debian/raspbian has package 'check' but v0.9.10 I think, stretch version
0.10.0 installs fine

> For the moment there is only a single test case, for
> FS_input_ascii_array (which was fixed through with help from this test).
> owfs (and C in generall) is a kindof tricky to write tests for, but it
> is doable.. at least for some parts..

Way above my level of understanding but builds fine here and I see

PASS: owlib_test
[snip]
==========================
Testsuite summary for
==========================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
==========================

flash by during the build. Should I see/look for anything more?

Andy

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Unittests

Johan Ström-3


On 24/03/16 19:52, Andy Carter wrote:

> On Thursday 24 Mar 2016 16:12:49 Johan Ström wrote:
>
>> I just commited a very first unit-test, something which the codebase is
>> lacking today.
>> Also merged the fix for FS_input_ascii_array, and some other cleanups.
>>
>> The test is built with libcheck, a pretty simple C unittest library.
>> It is by no means a decision on a lib to use, but it's a start.
>>
>> To build, ensure libcheck is installed, re-run configure, and then make
>> all check.
> debian/raspbian has package 'check' but v0.9.10 I think, stretch version
> 0.10.0 installs fine
Thanks for testing! 0.9.10 might work too, not sure if i use anything in
0.10.
Please feel free to test, just change the version in configure.ac (and
re-run bootstrap, configure, make), with the older version installed
instead of 0.10.0

>
>> For the moment there is only a single test case, for
>> FS_input_ascii_array (which was fixed through with help from this test).
>> owfs (and C in generall) is a kindof tricky to write tests for, but it
>> is doable.. at least for some parts..
> Way above my level of understanding but builds fine here and I see
>
> PASS: owlib_test
> [snip]
> ==========================
> Testsuite summary for
> ==========================
> # TOTAL: 1
> # PASS:  1
> # SKIP:  0
> # XFAIL: 0
> # FAIL:  0
> # XPASS: 0
> # ERROR: 0
> ==========================
>
> flash by during the build. Should I see/look for anything more?

Nope, thats it! If it fails, PASS will be be lower than TOTAL, and the
make process aborts here (making it very visible).
In case of failure, it will print a filename with more detailed
contents, but by default it does only outputs such data when errors occur.



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Unittests

Andy Carter
On Thursday 24 Mar 2016 20:22:19 Johan Ström wrote:
> On 24/03/16 19:52, Andy Carter wrote:
> > On Thursday 24 Mar 2016 16:12:49 Johan Ström wrote:

> >> The test is built with libcheck, a pretty simple C unittest library.
> >> It is by no means a decision on a lib to use, but it's a start.
> >>
> >> To build, ensure libcheck is installed, re-run configure, and then make
> >> all check.
> >
> > debian/raspbian has package 'check' but v0.9.10 I think, stretch version
> > 0.10.0 installs fine
>
> Thanks for testing! 0.9.10 might work too, not sure if i use anything in
> 0.10.
> Please feel free to test, just change the version in configure.ac (and
> re-run bootstrap, configure, make), with the older version installed
> instead of 0.10.0

OK, downgraded and debian/raspbian check v0.9.10-6.1 looks to be fine with the
same result.

Thanks for the explanation

Andy

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Unittests

Stefano Miccoli
In reply to this post by Johan Ström-3
Reviewing tha last commits I read a comment on the clean target in Makefile.am

commit ce7d5e6ed7e4a033b5e59c681e0dcd7382ba6727
Author: Johan Str<C3><B6>m <[hidden email]>
Date:   Thu Mar 24 15:39:38 2016 +0100

    clean target: do not try to remove my home dir please (*~)

    

    rm -f wont delete my directory, but should probalby not be there anyway..


'make clean’ should remove only file created by 'make all’. All those 

@RM@ -f *.o *.tmp *.cpp .*~ stamp-* lint_cmac.h

remove backup files created by the editor, or files created by programs not under make control. See also the automake heuristics 

IMHO it is time to start uncluttering configure.ac and Makefile.am from unnecessary local additions (which may have become obsolete in the meantime, or even dangerous.) The same holds true for .gitignore: here we should list only build related files. (Local generated files not linked to the build system, like editor backups, should go in .git/info/exclude )

S.

On 24 Mar 2016, at 16:12, Johan Ström <[hidden email]> wrote:

Hi,

I just commited a very first unit-test, something which the codebase is
lacking today.
Also merged the fix for FS_input_ascii_array, and some other cleanups.

The test is built with libcheck, a pretty simple C unittest library.
It is by no means a decision on a lib to use, but it's a start.

To build, ensure libcheck is installed, re-run configure, and then make
all check.

For the moment there is only a single test case, for
FS_input_ascii_array (which was fixed through with help from this test).
owfs (and C in generall) is a kindof tricky to write tests for, but it
is doable.. at least for some parts..

Of course, this just tests an extremely small portion of the owfs
codebase, but in the future we can add more, especially when debugging
errors.

Johan

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Unittests

Johan Ström-3

On 25/03/16 16:04, Stefano Miccoli wrote:
Reviewing tha last commits I read a comment on the clean target in Makefile.am

commit ce7d5e6ed7e4a033b5e59c681e0dcd7382ba6727
Author: Johan Str<C3><B6>m <[hidden email]>
Date:   Thu Mar 24 15:39:38 2016 +0100

    clean target: do not try to remove my home dir please (*~)

    

    rm -f wont delete my directory, but should probalby not be there anyway..


'make clean’ should remove only file created by 'make all’. All those 

@RM@ -f *.o *.tmp *.cpp .*~ stamp-* lint_cmac.h

remove backup files created by the editor, or files created by programs not under make control. See also the automake heuristics 

IMHO it is time to start uncluttering configure.ac and Makefile.am from unnecessary local additions (which may have become obsolete in the meantime, or even dangerous.) The same holds true for .gitignore: here we should list only build related files. (Local generated files not linked to the build system, like editor backups, should go in .git/info/exclude )

I agree, should only touch what it created.

Regarding .git/info/exclude, nice, did not know about that, thanks!

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers