mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-08 22:57:42 +03:00
* Test using multiple build machines in parallel.
svn path=/nixos/trunk/; revision=23396
This commit is contained in:
parent
3f10cf70f6
commit
bfb2e304dd
@ -12,15 +12,15 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Trivial Nix expression to build remotely.
|
# Trivial Nix expression to build remotely.
|
||||||
expr = config: pkgs.writeText "expr.nix"
|
expr = config: nr: pkgs.writeText "expr.nix"
|
||||||
''
|
''
|
||||||
let utils = builtins.storePath ${config.system.build.extraUtils}; in
|
let utils = builtins.storePath ${config.system.build.extraUtils}; in
|
||||||
derivation {
|
derivation {
|
||||||
name = "hello";
|
name = "hello-${toString nr}";
|
||||||
system = "i686-linux";
|
system = "i686-linux";
|
||||||
PATH = "''${utils}/bin";
|
PATH = "''${utils}/bin";
|
||||||
builder = "''${utils}/bin/sh";
|
builder = "''${utils}/bin/sh";
|
||||||
args = [ "-c" "echo Hello; mkdir $out; cat /proc/sys/kernel/hostname > $out/host" ];
|
args = [ "-c" "echo Hello; mkdir $out; cat /proc/sys/kernel/hostname > $out/host; sleep 3" ];
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ in
|
|||||||
|
|
||||||
nodes =
|
nodes =
|
||||||
{ slave1 = slave;
|
{ slave1 = slave;
|
||||||
#slave2 = slave;
|
slave2 = slave;
|
||||||
|
|
||||||
client =
|
client =
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
@ -43,6 +43,12 @@ in
|
|||||||
system = "i686-linux";
|
system = "i686-linux";
|
||||||
maxJobs = 1;
|
maxJobs = 1;
|
||||||
}
|
}
|
||||||
|
{ hostName = "slave2";
|
||||||
|
sshUser = "root";
|
||||||
|
sshKey = "/root/.ssh/id_dsa";
|
||||||
|
system = "i686-linux";
|
||||||
|
maxJobs = 1;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
virtualisation.writableStore = true;
|
virtualisation.writableStore = true;
|
||||||
virtualisation.pathsInNixDB = [ config.system.build.extraUtils ];
|
virtualisation.pathsInNixDB = [ config.system.build.extraUtils ];
|
||||||
@ -60,14 +66,22 @@ in
|
|||||||
$client->succeed("chmod 600 /root/.ssh/id_dsa");
|
$client->succeed("chmod 600 /root/.ssh/id_dsa");
|
||||||
|
|
||||||
# Install the SSH key on the slaves.
|
# Install the SSH key on the slaves.
|
||||||
$slave1->succeed("mkdir -m 700 /root/.ssh");
|
foreach my $slave ($slave1, $slave2) {
|
||||||
$slave1->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
|
$slave->succeed("mkdir -m 700 /root/.ssh");
|
||||||
$slave1->waitForJob("sshd");
|
$slave->copyFileFromHost("key.pub", "/root/.ssh/authorized_keys");
|
||||||
$client->succeed("ssh -o StrictHostKeyChecking=no slave1 'echo hello world'");
|
$slave->waitForJob("sshd");
|
||||||
|
$client->succeed("ssh -o StrictHostKeyChecking=no " . $slave->name() . " 'echo hello world'");
|
||||||
|
}
|
||||||
|
|
||||||
# Perform a build and check that it was performed on the slave.
|
# Perform a build and check that it was performed on the slave.
|
||||||
my $out = $client->succeed("nix-build ${expr nodes.client.config}");
|
my $out = $client->succeed("nix-build ${expr nodes.client.config 1}");
|
||||||
$slave1->succeed("test -e $out");
|
$slave1->succeed("test -e $out");
|
||||||
|
|
||||||
|
# And a parallel build.
|
||||||
|
my ($out1, $out2) = split /\s/,
|
||||||
|
$client->succeed("nix-store -r \$(nix-instantiate ${expr nodes.client.config 2} ${expr nodes.client.config 3})");
|
||||||
|
$slave1->succeed("test -e $out1 -o -e $out2");
|
||||||
|
$slave2->succeed("test -e $out1 -o -e $out2");
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user