[Trilinos-Users] Teuchos unit testing support

Bartlett, Roscoe A. bartlettra at ornl.gov
Fri Aug 29 15:03:02 MDT 2014


Nate,

The Teuchos Unit Test software does not assume any build system at all.  It is just headers and libraries that you use.  It is just that the documentation is written assuming you are using TriBITS and/or that you are a Trilinos developer.  You can use TriBITS if you want to but you don't have to.  You can just use raw CMake with raw add_executable() and add_test() commands or any build system and executable test driver you would like.  You can use raw makefiles and then just run the unit test executable yourself by hand.  Whatever.

You just need your own main function which is just:

// UnitTestMain.cpp
#include "Teuchos_UnitTestRepository.hpp"
#include "Teuchos_GlobalMPISession.hpp"
int main( int argc, char* argv[] )
{
   Teuchos::GlobalMPISession mpiSession(&argc, &argv);
    return Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
}

The headers and the libraries you need from Teuchos should all be installed with Trilinos.  Everything else is exactly the same once you get into your code.

However, assuming you are building Trilinos from source yourself and you want to use TriBITS to drive your builds, then you can just tack on your code as an add-on Trilinos TriBITS repository/package.  The other option is that you can use TriBITS as the build system for your project and then just define a single Trilinos TPL that will pull in the parts of Trilinos.

If you are interested in the latter options of using TriBITS please let me know and I will provide more detail.

We are still working on tutorials and examples to demonstrate these types of things.  If you or others are interested, that will be motivation to write these.

Cheers,

-Ross

_______________________________________________________________________________
Dr. Roscoe A. Bartlett, PhD
Oak Ridge National Laboratory
CASL Virtual Reactor Software Engineering Lead
Trilinos Software Engineering Technologies and Integration Lead


From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-users-bounces at software.sandia.gov] On Behalf Of Nate Roberts
Sent: Friday, August 29, 2014 1:14 PM
To: Trilinos-Users at software.sandia.gov
Subject: [Trilinos-Users] Teuchos unit testing support

Hello,

I'm interested in employing Teuchos's unit testing support in my code.  The documentation here:

http://trilinos.org/docs/r11.10/packages/teuchos/doc/html/group__Teuchos__UnitTest__grp.html

suggests using CMake code like:

PACKAGE_ADD_EXECUTABLE_AND_TEST(
MyUnitTests
SOURCES
UnitTestMain.cpp
Int_UnitTests.cpp
... other unit test files ...
STANDARD_PASS_OUTPUT
)

How should I do the PACKAGE_ADD_EXECUTABLE_AND_TEST thing for my own package (which is not part of Trilinos, but is built on top of Trilinos)?  I do see e.g. that at least some of Teuchos's own tests use TRIBITS_ADD_EXECUTABLE_AND_TEST.  Should I make my own version of ADD_EXECUTABLE_AND_TEST, or is there a better way?  (I'm not expert in CMake.)

Thanks and regards,

Nate Roberts

----- Nathan V. Roberts, PhD. ---- Argonne Leadership Computing Facility ---- nvroberts at alcf.anl.gov<mailto:nvroberts at alcf.anl.gov> ---- 630-252-0036 -----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20140829/246fb2f0/attachment.html>


More information about the Trilinos-Users mailing list