Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  Testing of nifs

Guest
Posted: Sat Oct 01, 2011 8:49 am Reply with quote
Guest
Hello,

How to test NIFs?
I need to run different vms for each test case. Is there a test
framework which allows this?

--
Best regards,
Uvarov Michael
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist
Guest
Posted: Sat Oct 01, 2011 2:58 pm Reply with quote
Guest
I'm not aware of any test frameworks for doing this sort of thing automatically.

The stdlib's slave application is one (easy) way to implement your own framework.

Here is a recipe for starting, restarting, and stopping slave nodes.

https://github.com/norton/qc/blob/dev/src/qc_slave.erl

Your test case(s) can then use the kernel's rpc application to invoke tests and/or commands on slave node(s).

regards,

Joe N.


Joseph Norton
norton@alum.mit.edu



On Oct 1, 2011, at 5:48 PM, Michael Uvarov wrote:

> Hello,
>
> How to test NIFs?
> I need to run different vms for each test case. Is there a test
> framework which allows this?
>
> --
> Best regards,
> Uvarov Michael
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist
Guest
Posted: Sat Oct 01, 2011 7:45 pm Reply with quote
Guest
I had pretty awesome experience with PropEr on testing NIFs, so I can recommend it to you.
Post received from mailinglist
Guest
Posted: Sun Oct 02, 2011 10:18 am Reply with quote
Guest
On 1 October 2011 20:45, Dmitry Groshev <lambdadmitry@gmail.com (lambdadmitry@gmail.com)> wrote:
Quote:
I had pretty awesome experience with PropEr on testing NIFs, so I can recommend it to you.



Would you be willing to share some of your experiences, as I'm certain there are a great many of us that would like to know more about good ways of testing NIFs and drivers! What in particular was good about PropEr for example? I've been thinking that PropEr's state machine testing support should be good for testing linked-in drivers, especially when the various calls to it are tucked away in a gen_server.


Cheers,


Tim



Post received from mailinglist
Guest
Posted: Sun Oct 02, 2011 9:27 pm Reply with quote
Guest
Well, it's about hidden details. Erlang is pretty straightforward language; C is a lot more tricky to make right. So there is a lot of non obvious bugs that I can't foresee when I write unit tests; PropEr's *random* tests are way better in this sense, because you just describe the domain of your task, not particular cases. You can also test your NIF incrementally, writing property after property (or command after command if there is some state involved).Speaking about my experience — I'm using PropEr to test this library
Guest
Posted: Mon Oct 03, 2011 7:52 am Reply with quote
Guest
On 2 October 2011 22:27, Dmitry Groshev <lambdadmitry@gmail.com (lambdadmitry@gmail.com)> wrote:
Quote:
Well, it's about hidden details. Erlang is pretty straightforward language; C is a lot more tricky to make right. So there is a lot of non obvious bugs that I can't foresee when I write unit tests; PropEr's *random* tests are way better in this sense, because you just describe the domain of your task, not particular cases. You can also test your NIF incrementally, writing property after property (or command after command if there is some state involved). Speaking about my experience
Guest
Posted: Mon Oct 03, 2011 12:47 pm Reply with quote
Guest
Hi!

There are also built-in functions within common_test which allows you to
start erlang slaves. See http://www.erlang.org/doc/man/ct_slave.html for
details.

You could create tests in common_test which in the init_per_testcase
function start the slave node and then kills it in the end_per_testcase
function. We use this extensively to test common_test and lots of other
functionality within Erlang/OTP.

Lukas

On 01/10/11 16:57, Joseph Norton wrote:
> I'm not aware of any test frameworks for doing this sort of thing automatically.
>
> The stdlib's slave application is one (easy) way to implement your own framework.
>
> Here is a recipe for starting, restarting, and stopping slave nodes.
>
> https://github.com/norton/qc/blob/dev/src/qc_slave.erl
>
> Your test case(s) can then use the kernel's rpc application to invoke tests and/or commands on slave node(s).
>
> regards,
>
> Joe N.
>
>
> Joseph Norton
> norton@alum.mit.edu
>
>
>
> On Oct 1, 2011, at 5:48 PM, Michael Uvarov wrote:
>
>> Hello,
>>
>> How to test NIFs?
>> I need to run different vms for each test case. Is there a test
>> framework which allows this?
>>
>> --
>> Best regards,
>> Uvarov Michael
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@erlang.org
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Post received from mailinglist
Guest
Posted: Wed Oct 05, 2011 9:08 am Reply with quote
Guest
On 10/03/11 10:51, Tim Watson wrote:
> On 2 October 2011 22:27, Dmitry Groshev <lambdadmitry@gmail.com
> <mailto:lambdadmitry@gmail.com>> wrote:
>
> Well, it's about hidden details. Erlang is pretty straightforward
> language; C is a lot more tricky to make right. So there is a lot of
> non obvious bugs that I can't foresee when I write unit tests;
> PropEr's *random* tests are way better in this sense, because you
> just describe the domain of your task, not particular cases. You can
> also test your NIF incrementally, writing property after property
> (or command after command if there is some state involved).
> Speaking about my experience

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum