www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Specifying which Phobos modules to unittest

reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
Hello all,

Is there any way to specify individual Phobos modules to unittest when
building, 
instead of having to do the whole lot?

When working on 1 single module, it'd be nice to be able to unittest that one 
alone and not have to worry about doing the complete set of tests until ready
to 
push back to GitHub.

Can anyone advise?

Thanks & best wishes,

     -- Joe
May 10 2012
next sibling parent reply =?ISO-8859-1?Q?Christian_K=F6stlin?= <christian.koestlin gmail.com> writes:
On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote:
 Hello all,

 Is there any way to specify individual Phobos modules to unittest when
 building, instead of having to do the whole lot?

 When working on 1 single module, it'd be nice to be able to unittest
 that one alone and not have to worry about doing the complete set of
 tests until ready to push back to GitHub.

 Can anyone advise?

 Thanks & best wishes,

 -- Joe
the tests are not executed at compile time but instead at runtime before main(). so you have to compile the modules seperately, and only the modules you want to test with the unittest flag. that means: dmd -c module1.d module2.d module3.d dmd -c -unittest module_with_tests.d dmd module1.o module2.d module3.o module_with_tests.o when you run your linked program your should only get the unittests from moduel_with_tests. regards christian
May 10 2012
next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, May 10, 2012 at 07:05:27PM +0200, Christian Köstlin wrote:
 On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote:
Hello all,

Is there any way to specify individual Phobos modules to unittest when
building, instead of having to do the whole lot?

When working on 1 single module, it'd be nice to be able to unittest
that one alone and not have to worry about doing the complete set of
tests until ready to push back to GitHub.

Can anyone advise?

Thanks & best wishes,

-- Joe
the tests are not executed at compile time but instead at runtime before main(). so you have to compile the modules seperately, and only the modules you want to test with the unittest flag.
[...] This is not true of Phobos; the Phobos makefile has a separate rule for building (and running) unittests. The OP's question is, how to make this run only a single module's tests as opposed to the entire Phobos (which takes a while, since some of the tests are quite extensive). T -- Chance favours the prepared mind. -- Louis Pasteur
May 10 2012
parent =?ISO-8859-1?Q?Christian_K=F6stlin?= <christian.koestlin gmail.com> writes:
sorry ... i did not get this, as i never have developed phobos.
May 10 2012
prev sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Thursday, May 10, 2012 10:14:12 H. S. Teoh wrote:
 On Thu, May 10, 2012 at 07:05:27PM +0200, Christian Köstlin wrote:
 On 05/10/2012 06:21 PM, Joseph Rushton Wakeling wrote:
Hello all,

Is there any way to specify individual Phobos modules to unittest when
building, instead of having to do the whole lot?

When working on 1 single module, it'd be nice to be able to unittest
that one alone and not have to worry about doing the complete set of
tests until ready to push back to GitHub.

Can anyone advise?

Thanks & best wishes,

-- Joe
the tests are not executed at compile time but instead at runtime before main(). so you have to compile the modules seperately, and only the modules you want to test with the unittest flag.
[...] This is not true of Phobos; the Phobos makefile has a separate rule for building (and running) unittests. The OP's question is, how to make this run only a single module's tests as opposed to the entire Phobos (which takes a while, since some of the tests are quite extensive).
I believe that it's possible. I think that Andrei does it (he posted commands related to that at one point, but I couldn't get them to work), but I don't know how. I just always run the whole test suite. This is a question that would probably be better asked on either the main list or the Phobos list, since the ones most likely to know are Phobos devs, and a number of them do not pay attention to D.Learn. - Jonathan M Davis
May 10 2012
prev sibling parent reply "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Thursday, 10 May 2012 at 16:22:11 UTC, Joseph Rushton Wakeling 
wrote:
 Hello all,

 Is there any way to specify individual Phobos modules to 
 unittest when building, instead of having to do the whole lot?

 When working on 1 single module, it'd be nice to be able to 
 unittest that one alone and not have to worry about doing the 
 complete set of tests until ready to push back to GitHub.

 Can anyone advise?

 Thanks & best wishes,

     -- Joe
compile your module with an empty main (that is what the makefile does) or rdmd --main mymod.d -unittest
May 10 2012
next sibling parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 10/05/12 19:33, Jesse Phillips wrote:
 rdmd --main mymod.d -unittest
Thanks muchly. :-)
May 10 2012
prev sibling parent reply Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 10/05/12 19:33, Jesse Phillips wrote:
 rdmd --main mymod.d -unittest
... on second thoughts, that doesn't seem to work. I tested by putting in place a guaranteed-fail unittest; no result. :-(
May 10 2012
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 10.05.2012 22:11, Joseph Rushton Wakeling wrote:
 On 10/05/12 19:33, Jesse Phillips wrote:
 rdmd --main mymod.d -unittest
... on second thoughts, that doesn't seem to work. I tested by putting in place a guaranteed-fail unittest; no result. :-(
mm I've been using this beast for ages with great success. rdmd --main -unittest std\regex.d may it be that -unittest should go first? -- Dmitry Olshansky
May 10 2012
parent Joseph Rushton Wakeling <joseph.wakeling webdrake.net> writes:
On 10/05/12 20:47, Dmitry Olshansky wrote:
 mm I've been using this beast for ages with great success.

 rdmd --main -unittest std\regex.d

 may it be that -unittest should go first?
D'oh! Yup. :-\
May 10 2012