[LLVMdev] [Patch] Adding unit tests to LLVM
Talin
viridia at gmail.com
Fri Dec 26 11:14:02 PST 2008
Thanks for taking a look!
The googletest framework is open source, and licensed under the "new
BSD" license. I'll leave it to the license lawyers to determine
compatibility.
Introductory docs for googletest are here:
http://code.google.com/p/googletest/wiki/GoogleTestPrimer
You might also want to read this (somewhat out of date) comparison of
C++ unit testing frameworks:
"Exploring the C++ Unit Testing Jungle" http://gamesfromwithin.com/?p=29
Note that this doesn't include googletest or UnitTest++, both of which
were developed after the article was written. (The latter was developed
by the author of the above article.) However, the article does give a
good overview of what is desirable in a unit testing framework.
Also note that one additional requirement of a unit test framework for
LLVM is that it should not rely on RTTI or exceptions, since LLVM is
built with both of those features disabled.
Bill Wendling wrote:
> Hi Talin,
>
> I just got around to looking at this. Sorry for the delay.
>
> I like the idea of unit tests *A LOT*. Adequate testing has been a
> major sticking point for LLVM for a long time. In my opinion, once the
> color of the bike shed is agreed upon ;-), this will be a welcome
> addition. I have never worked with Google's unit testing infrastucture
> so I don't know how it works or if its license is compatible with
> ours, etc.
>
> I did a very quick look at your code and it seems fine for a first
> stab. Let's try to get everyone's input before you do a ton of work.
> But I for one think that it will be accepted when people are satisfied
> with the form it takes.
>
> -bw
>
> On Dec 25, 2008, at 11:32 PM, Talin <viridia at gmail.com> wrote:
>
>
>> So, any response on whether this patch is likely to be accepted? I'm
>> willing to substantially rework things if requested.
>>
>> I should note that part of my motivation for doing this is that I have
>> been wanting to do some work on the various LLVM container classes;
>> However, I strongly feel that without some kind of unit test framework
>> in place such work would mostly be a waste of time.
>>
>> Talin wrote:
>>
>>> (Forwarding this to llvm-dev)
>>>
>>> This patch adds a unit test framework to LLVM, along with a sample
>>> unit test
>>> for DenseMap. I don't expect this patch to be accepted as-is, this
>>> is mainly
>>> a trial balloon and proof of concept.
>>> Some notes about the patch:
>>>
>>> 1) For the testing framework, I went with Google Test, since it's
>>> the one I
>>> have the most experience with. I fully expect an extended bikeshed
>>> discussion to result from this.
>>>
>>> 2) Both the test framework and the tests are optional build
>>> targets, they
>>> will not be built with the normal "make all". To build and run the
>>> unit
>>> tests, use "make check-unit".
>>>
>>> 3) I did not actually include the testing framework in the patch;
>>> It will
>>> need to be checked in separately. There are two approaches to this.
>>> One
>>> approach is to use the svn:external feature to create a link to the
>>> googletest svn repository from the LLVM svn repository. The other
>>> approach
>>> is to take a snapshot of googletest and check it in to the LLVM
>>> repository.
>>>
>>> The GoogleTest tar archive is here:
>>> http://code.google.com/p/googletest/downloads/list. I've located it
>>> within
>>> the LLVM source tree in the location "third-party/googletest".
>>>
>>> 4) I've included makefiles for building the test framework and unit
>>> tests. I
>>> had to do a bit of makefile hacking to get this to work,
>>> suggestions on how
>>> to improve this are welcome.
>>>
>>>
>>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
More information about the llvm-dev
mailing list