nixpkgs/nixos/tests/mpich.nix
Eelco Dolstra abe218950c Make it easier to run the tests
You can now run a test in the nixos/tests directory directly using
nix-build, e.g.

  $ nix-build '<nixos/tests/login.nix>' -A test

This gets rid of having to add the test to nixos/tests/default.nix.
(Of course, you still need to add it to nixos/release.nix if you want
Hydra to run the test.)
2014-04-14 14:02:44 +02:00

37 lines
1.1 KiB
Nix

# Simple example to showcase distributed tests using NixOS VMs.
import ./make-test.nix {
nodes = {
master =
{ config, pkgs, ... }: {
environment.systemPackages = [ gcc mpich2 ];
#boot.kernelPackages = pkgs.kernelPackages_2_6_29;
};
slave =
{ config, pkgs, ... }: {
environment.systemPackages = [ gcc mpich2 ];
};
};
# Start master/slave MPI daemons and compile/run a program that uses both
# nodes.
testScript =
''
startAll;
$master->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
$master->succeed("chmod 600 /etc/mpd.conf");
$master->succeed("mpd --daemon --ifhn=master --listenport=4444");
$slave->succeed("echo 'MPD_SECRETWORD=secret' > /etc/mpd.conf");
$slave->succeed("chmod 600 /etc/mpd.conf");
$slave->succeed("mpd --daemon --host=master --port=4444");
$master->succeed("mpicc -o example -Wall ${./mpich-example.c}");
$slave->succeed("mpicc -o example -Wall ${./mpich-example.c}");
$master->succeed("mpiexec -n 2 ./example >&2");
'';
}