[LLVMdev] [Patch] Adding unit tests to LLVM
Keir Mierle
mierle at gmail.com
Mon Dec 22 19:09:32 PST 2008
Nice work!
On Mon, Dec 22, 2008 at 4:34 PM, Talin <viridia at gmail.com> 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.
>
+1.
Google test is pretty nice (not that I'm unbiased, as I am a gtest
contributor :)
> 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".
>
"make unittest"? I would never guess 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".
>
I suggest checking a specific version of Google test into the source. There
isn't much clear benfit to tracking upstream gtest. On the other hand, there
is benefit to not having mysterious breakages due to upstream (as unlikely
as that is due to gtest API guarentees). Also, for projects adding the gtest
source directly to their tree, there is a special gtest-all.c which contains
the entire gtest codebase in a single file (it's not that much code).
Keir
>
> 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.
>
> --
> -- Talin
>
>
>
> --
> -- Talin
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20081222/457007f0/attachment.html>
More information about the llvm-dev
mailing list