From 1d549cf6df0af5e72d1e0dfbe5f320a91bebf38e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Jan 2010 16:46:21 +0000 Subject: [PATCH] * Test whether nix-env -i works. svn path=/nixos/trunk/; revision=19265 --- tests/installer.nix | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/installer.nix b/tests/installer.nix index c86654150446..8974121b8241 100644 --- a/tests/installer.nix +++ b/tests/installer.nix @@ -12,11 +12,16 @@ rec { ../modules/testing/test-instrumentation.nix { key = "serial"; 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; + # The test script boots the CD, installs NixOS on an empty hard + # disk, and then reboot from the hard disk. testScript = '' createDisk("harddisk", 4 * 1024); @@ -30,6 +35,13 @@ rec { $machine->waitForJob("rogue"); $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. $machine->mustSucceed( "parted /dev/vda mklabel msdos", @@ -43,6 +55,15 @@ rec { "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; # Now see if we can boot the installation. @@ -50,4 +71,5 @@ rec { $machine->mustSucceed("echo hello"); $machine->shutdown; ''; + }