forked from mirrors/nixpkgs
* Test whether nix-env -i works.
svn path=/nixos/trunk/; revision=19265
This commit is contained in:
parent
cbca2f72df
commit
1d549cf6df
|
@ -12,11 +12,16 @@ rec {
|
||||||
../modules/testing/test-instrumentation.nix
|
../modules/testing/test-instrumentation.nix
|
||||||
{ key = "serial";
|
{ key = "serial";
|
||||||
boot.kernelParams = [ "console=tty1" "console=ttyS0" ];
|
boot.kernelParams = [ "console=tty1" "console=ttyS0" ];
|
||||||
boot.loader.grub.timeout = pkgs.lib.mkOverride 0 {} 0;
|
boot.loader.grub.timeout = pkgs.lib.mkOverride 0 {} 0;
|
||||||
|
# The test cannot access the network, so any sources we
|
||||||
|
# need must be included in the ISO.
|
||||||
|
isoImage.storeContents = [ pkgs.hello.src ];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}).config.system.build.isoImage;
|
}).config.system.build.isoImage;
|
||||||
|
|
||||||
|
# The test script boots the CD, installs NixOS on an empty hard
|
||||||
|
# disk, and then reboot from the hard disk.
|
||||||
testScript =
|
testScript =
|
||||||
''
|
''
|
||||||
createDisk("harddisk", 4 * 1024);
|
createDisk("harddisk", 4 * 1024);
|
||||||
|
@ -30,6 +35,13 @@ rec {
|
||||||
$machine->waitForJob("rogue");
|
$machine->waitForJob("rogue");
|
||||||
$machine->waitForJob("nixos-manual");
|
$machine->waitForJob("nixos-manual");
|
||||||
|
|
||||||
|
# Test nix-env.
|
||||||
|
$machine->mustSucceed("source /etc/profile");
|
||||||
|
$machine->mustFail("hello");
|
||||||
|
$machine->mustSucceed("nix-env -i hello");
|
||||||
|
$machine->mustSucceed("hello") =~ /Hello, world/
|
||||||
|
or die "bad `hello' output";
|
||||||
|
|
||||||
# Partition the disk.
|
# Partition the disk.
|
||||||
$machine->mustSucceed(
|
$machine->mustSucceed(
|
||||||
"parted /dev/vda mklabel msdos",
|
"parted /dev/vda mklabel msdos",
|
||||||
|
@ -43,6 +55,15 @@ rec {
|
||||||
"mount LABEL=nixos /mnt",
|
"mount LABEL=nixos /mnt",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# Create a NixOS configuration.
|
||||||
|
$machine->mustSucceed(
|
||||||
|
"mkdir -p /mnt/etc/nixos",
|
||||||
|
"nixos-hardware-scan > /mnt/etc/nixos/hardware.nix",
|
||||||
|
);
|
||||||
|
|
||||||
|
my $cfg = $machine->mustSucceed("cat /mnt/etc/nixos/hardware.nix");
|
||||||
|
print STDERR "Result of the hardware scan:$cfg\n";
|
||||||
|
|
||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
|
|
||||||
# Now see if we can boot the installation.
|
# Now see if we can boot the installation.
|
||||||
|
@ -50,4 +71,5 @@ rec {
|
||||||
$machine->mustSucceed("echo hello");
|
$machine->mustSucceed("echo hello");
|
||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue