[CMake] CTest in a cross-compiling environment

Michael Wild themiwi at gmail.com
Fri Feb 18 11:07:41 EST 2011


On 02/18/2011 04:36 PM, James Amundson wrote:
> Hi,
> 
> Are there any CMake solutions for running tests in a cross-compiling
> environment? Right now I have a lovely test suite that runs over sixty
> different executables using the standard CMake and CTest setup. It works
> exactly as I want under Linux, but now I need to run it on a
> cross-compiling platform (in fact, two cross-compiling platforms: BG/P
> and Cray XT5). I don't have cmake compiled for the target platform, so I
> can't just run "ctest." Surely there must be other people with this
> problem, but this mornings Google searches aren't turning up anything
> for me.
> 
> Thanks for any help,
> Jim Amundson
> 
> P.S. The tests themselves are either Boost Test executables or python
> scripts to be run with nose. Running the tests themselves shouldn't
> present any problem.

Mhhm, that's a problem I've also been thinking about just recently.
Probably you'll have to invoke the tests through a wrapper script which
invokes aprun appropriately on the XT5 and whatever is required on the
BG/P. Something like this:

add_test(NAME test1
  COMMAND "${TEST_LAUNCHER}" -N 6 -n 12 -d 2 "$<TARGET_FILE:test1>")

Where TEST_LAUNCHER points to said script which parses the options (e.g.
-N number of ranks per node, -n total number of ranks, -d number of
threads), sets required environment variables (e.g. OMP_NUM_THREADS=2)
and calls the appropriate launcher for the platform it's running on.

Like this, CTest only runs on the login node and runs the tests on the
compute nodes.

Probably it would be best to run this from an interactive session (with
SLURM use salloc, other queuing systems will have similar possibilities).

Michael


More information about the CMake mailing list