Unit testing and GPL

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
Number Theoretic
Padawan Learner
Posts: 187
Joined: 2011-09-04 08:53am
Location: Joeyray's Bar

Unit testing and GPL

Post by Number Theoretic »

Suppose that there was a library containing an algorithm that i wanted to use in a program for which i intend to use MIT or BSD license, but this library has GPL license. Of course, i would then not use the library and implement the algorithm myself.

And here is where my question comes in:

As far as i know, the GPL is "contagious", so any code that uses GPL code also becomes GPL code automatically. If i wanted to write unit tests for my self-implemented version of the algorithm that use the GPL-ed library's version of the algorithm to check if my version's output is correct, would that mean that my implementation of the algorithm becomes GPL-ed? Or does this merely apply to the unit tests, because my algorithm per se doesn't use any GPL code anywhere?
rapidsquirrel
Youngling
Posts: 80
Joined: 2008-09-12 11:18am

Re: Unit testing and GPL

Post by rapidsquirrel »

Code that uses GPL doesn't become GPL'ed automatically, it's only if you wish to distributed said code to other people. If you are just using GPL code to test other code, then you have nothing to worry about. If your final product doesn't contain any GPL code then you are in the free and clear to license it how ever you wish.
User avatar
Sarevok
The Fearless One
Posts: 10681
Joined: 2002-12-24 07:29am
Location: The Covenants last and final line of defense

Re: Unit testing and GPL

Post by Sarevok »

I thought algorithms are not covered under GPL ?
I have to tell you something everything I wrote above is a lie.
User avatar
Dave
Jedi Knight
Posts: 901
Joined: 2004-02-06 11:55pm
Location: Kansas City, MO

Re: Unit testing and GPL

Post by Dave »

Sarevok wrote:I thought algorithms are not covered under GPL ?
Well, no, the algorithm itself is not protected because it's just mathematics, but if you incorporate code (including code that implements the algorithm) that uses GPL copyrighted code, and distribute it, you have to make the rest of your source code available under the same license.

I believe that the GPL 2 code will let you use it for unit testing without forcing you to distribute (especially since you are not distributing your unit-testing code). I'm not sure if that's true for GPL 3 or the Affero General Public License.

I am not a lawyer, nor do I play one on TV.
User avatar
TronPaul
Padawan Learner
Posts: 232
Joined: 2011-12-05 12:12pm

Re: Unit testing and GPL

Post by TronPaul »

As long as you don't distribute the GPL'd algorithm you should be ok. From my understanding your code doesn't become GPL if you work with GPL'd code, only if you package and distribute your code and the GPL'd code together. If you're using the GPL'd code for internal, private test cases you shouldn't have to worry.

Some links from a quick Google. It'd be best to ask a lawyer and the owner of the GPL'd software in question.
http://stackoverflow.com/questions/3332 ... test-cases
http://windyroad.org/2006/04/20/using-g ... tory-code/
If it waddles like a duck and it quacks like a duck, it's a KV-5.
Vote Electron Standard, vote Tron Paul 2012
User avatar
Number Theoretic
Padawan Learner
Posts: 187
Joined: 2011-09-04 08:53am
Location: Joeyray's Bar

Re: Unit testing and GPL

Post by Number Theoretic »

Thanks for all the replies. So, in a nutshell, i can use the GPL library to construct unit tests and verify my own implementations, but if i wanted to publish the unit tests, i should do so in a separate package, which then becomes GPL, while my own implementation can stay e.g. MIT as long as i don't include the unit tests in the same package. And, when in doubt, talk to a lawyer. Should work for me.
User avatar
Beowulf
The Patrician
Posts: 10619
Joined: 2002-07-04 01:18am
Location: 32ULV

Re: Unit testing and GPL

Post by Beowulf »

When in doubt, talk to a lawyer. You may be able avoid having any of your code GPL though, if your test harness only uses staticly generated data in the test case, rather than hooking the GPL'd code into the harness.
"preemptive killing of cops might not be such a bad idea from a personal saftey[sic] standpoint..." --Keevan Colton
"There's a word for bias you can't see: Yours." -- William Saletan
Post Reply