Commit graph

33 commits

Author SHA1 Message Date
Eelco Dolstra 5c1f8cbc70 Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00
Eelco Dolstra 97f087cd44 Turn networking.interfaces into an attribute set
Thus

  networking.interfaces = [ { name = "eth0"; ipAddress = "192.168.15.1"; } ];

can now be written as

  networking.interfaces.eth0.ipAddress = "192.168.15.1";

The old notation still works though.
2012-11-02 17:08:11 +01:00
Shea Levy 1b615f460b Allow overriding all NixOS tests to run with the minimal kernel possible for that test's config(s) (based on requiredKernelConfig) 2012-08-04 09:45:26 -04:00
Eelco Dolstra 29d84af677 * Remove the use of the NIXPKGS and NIXOS environment variables.
Instead use $NIX_PATH.  NIXOS_CONFIG is still supported.

svn path=/nixos/trunk/; revision=32739
2012-03-02 12:38:22 +00:00
Peter Simons eb6e1310b8 strip trailing whitespace; no functional change
svn path=/nixos/trunk/; revision=29285
2011-09-14 18:20:50 +00:00
Eelco Dolstra 8aad8c536f * Make virtualisation.qemu.options a list.
svn path=/nixos/trunk/; revision=28120
2011-08-02 06:52:10 +00:00
Eelco Dolstra 650d14be8d * Remove most references to the "services" tree.
svn path=/nixos/trunk/; revision=26990
2011-04-27 13:16:33 +00:00
Eelco Dolstra 8ce36ffb3a * Use "ip" instead of "ifconfig" for setting up network interfaces,
since the latter is rather deprecated and has been unmaintained
  since 2001.  Note that "ip" doesn't know about classful addressing,
  so you can no longer get away with not specifying the subnet mask
  for explicitly configured interfaces.  So if you had

    networking.interfaces =
      [ { name = "eth0"; ipAddress = "192.168.1.1"; } ];

  this should be changed to

    networking.interfaces =
      [ { name = "eth0";
          ipAddress = "192.168.1.1";
          subnetMask = "255.255.255.0";
        }
     ];

  otherwise you end up with a subnet mask of 255.255.255.255.

svn path=/nixos/trunk/; revision=26279
2011-03-11 14:50:11 +00:00
Sander van der Burg 96b769c979 Removed the backdoor, because it does not work anymore and it has also become obsolete (Disnix uses something else now)
svn path=/nixos/trunk/; revision=25601
2011-01-17 16:15:59 +00:00
Eelco Dolstra 066f76e65f * Remove "nix-build tests -A foo.vms; ./result/bin/run-vms" as a way
to run the VMs of a test.  Instead, you can do

    $ nix-build tests -A foo.driver
    $ ./result/bin/nixos-run-vms

  This uses the test driver infrastructure, which is necessary in
  order to set up the VDE switches.

svn path=/nixos/trunk/; revision=25586
2011-01-16 14:21:47 +00:00
Eelco Dolstra 2e38d8cd31 * ZOMG, fixed a giant bug in the networking of distributed VM tests.
It turns out that all network interfaces in all VMs had the same
  Ethernet address (52:54:00:12:34:56) because we didn't specify any
  with the macaddr=... option.  This can obviously lead to great
  confusion.  For instance, when a router forwards a packet, it can
  actually end up sending the packet to itself because the target
  machine has the same Ethernet address (causing a loop until the TTL
  expires), while the target *also* receives the packet.  It's amazing
  anything worked at all, really.

  So now we just set the Ethernet addresses to 52:54:00:12:<virtual
  network number>:<machine number>.

svn path=/nixos/trunk/; revision=25020
2010-12-07 00:44:29 +00:00
Sander van der Burg 9c722e474d - Added nixos-build-vms command, which builds a virtual network from a network.nix expression (also used by nixos-deploy-network)
- Added a backdoor option to the interactive run-vms script. This allows me to intergrate the virtual network approach with Disnix
- Small documentation fixes

Some explanation:

The nixos-build-vms command line tool can be used to build a virtual network of a network.nix specification.
For example, a network configuration (network.nix) could look like this:

{
  test1 = 
    {pkgs, config, ...}:
 
    {
      services.openssh.enable = true;
      ...
    };

  test2 =
    {pkgs, config, ...}:
    
    {
      services.openssh.enable = true;
      services.xserver.enable = true;
    }

    ;
}

By typing the following instruction:

$ nixos-build-vms -n network.nix

a virtual network is built, which can be started by typing:

$ ./result/bin/run-vms

It is also possible to enable a backdoor. In this case *.socket files are stored in the current directory
which can be used by the end-user to invoke remote instruction on a VM in the network through a Unix
domain socket.

For example by building the network with the following instructions:

$ nixos-build-vms -n network.nix --use-backdoor

and launching the virtual network:

$ ./result/bin/run-vms

You can find two socket files in your current directory, namely: test1.socket and test2.socket.
These Unix domain sockets can be used to remotely administer the test1 and test2 machine
in the virtual network.

For example by running:

$ socat ./test1.socket stdio
ls /root

You can retrieve the contents of the /root directory of the virtual machine with identifier test1


svn path=/nixos/trunk/; revision=24410
2010-10-21 22:50:12 +00:00
Sander van der Burg 21eb6ed412 Renamed lib.zip into lib.zipTwoLists, since it refers to the wrong function
svn path=/nixos/trunk/; revision=22888
2010-08-02 16:51:33 +00:00
Sander van der Burg 58204f0a8a Changed zip into lib.zip. Sorry :$
svn path=/nixos/trunk/; revision=22884
2010-08-02 16:24:24 +00:00
Sander van der Burg 388c8e0c60 Removed the zip function, since it is in pkgs.lib now
svn path=/nixos/trunk/; revision=22883
2010-08-02 16:11:44 +00:00
Eelco Dolstra 62675aa0cf * Doh, forgot to commit.
svn path=/nixos/trunk/; revision=22005
2010-05-27 13:43:16 +00:00
Eelco Dolstra dd81311714 * Optionally pass the computed `nodes' to the test script as a
function argument, so that the test script can refer to computed
  values such as the assigned IP addresses of the virtual machines.

svn path=/nixos/trunk/; revision=21939
2010-05-21 14:31:05 +00:00
Eelco Dolstra 4dac9e5814 * Allow more complex network topologies in distributed tests. Each
machine can now declare an option `virtualisation.vlans' that causes
  it to have network interfaces connected to each listed virtual
  network.  For instance,

    virtualisation.vlans = [ 1 2 ];

  causes the machine to have two interfaces (in addition to eth0, used
  by the test driver to control the machine): eth1 connected to
  network 1 with IP address 192.168.1.<i>, and eth2 connected to
  network 2 with address 192.168.2.<i> (where <i> is the index of the
  machine in the `nodes' attribute set).  On the other hand,
  
    virtualisation.vlans = [ 2 ];

  causes the machine to only have an eth1 connected to network 2 with
  address 192.168.2.<i>.  So each virtual network <n> is assigned the
  IP range 192.168.<n>.0/24.

  Each virtual network is implemented using a separate multicast
  address on the host, so guests really cannot talk to networks to
  which they are not connected.

* Added a simple NAT test to demonstrate this.

* Added an option `virtualisation.qemu.options' to specify QEMU
  command-line options.  Used to factor out some commonality between
  the test driver script and the interactive test script.

svn path=/nixos/trunk/; revision=21928
2010-05-20 21:07:32 +00:00
Eelco Dolstra 55c349fe20 * Added a test that checks whether users can log in on a virtual
console.  This uses the `sendkey' command in the QEMU monitor.
* For the block/unblock primitives, use the `set_link' command in the
  QEMU monitor.

svn path=/nixos/trunk/; revision=19854
2010-02-06 13:08:15 +00:00
Eelco Dolstra bc238be01a * Factor out the X11 configuration.
svn path=/nixos/trunk/; revision=19241
2010-01-05 17:08:57 +00:00
Eelco Dolstra 51097933ab * Moved test-related stuff from lib/build-vms.nix to lib/testing.nix.
* Factored out some commonality between tests to make them a bit
  simpler to write.  A test is a function { pkgs, ... }: -> { nodes,
  testScript } or { machine, testScript }.  So it's no longer
  necessary to have a "vms" attribute in every test.

svn path=/nixos/trunk/; revision=19220
2010-01-05 11:18:43 +00:00
Rob Vermaas 243bc84f08 ensure nix-support dir before running tests
svn path=/nixos/trunk/; revision=18938
2009-12-14 15:30:57 +00:00
Marc Weber 5cb52cc7cb nixos vms tests: use relative path to services, nixpkgs because this is more like to work if you don't put the repos in /etc/nixos/
svn path=/nixos/trunk/; revision=18330
2009-11-11 23:54:54 +00:00
Nicolas Pierron 81ec373e1e Imports of imported attribute set are not working anymore because this
feature is hard to maintain and because this a potential source of error.

Imports are only accepted inside named modules where the system has some
control over mutual inclusion.

svn path=/nixos/trunk/; revision=17143
2009-09-15 00:18:00 +00:00
Eelco Dolstra c6d4282f25 svn path=/nixos/trunk/; revision=16950 2009-09-02 23:37:58 +00:00
Eelco Dolstra 497760b444 * Use scrot to make screenshots.
* Another X11 test (running Quake 3).

svn path=/nixos/trunk/; revision=16949
2009-09-02 23:16:33 +00:00
Eelco Dolstra 05cb34c6d0 svn path=/nixos/trunk/; revision=16942 2009-09-02 19:59:26 +00:00
Eelco Dolstra 486714bfcc * Make the coverage report more concise.
svn path=/nixos/trunk/; revision=16926
2009-09-02 09:38:16 +00:00
Eelco Dolstra 137c5c65bd * Added a timeout for starting the VM. TODO: handle SIGCHLD from
qemu.
* Do the subversion test on i686-linux.  

svn path=/nixos/trunk/; revision=16923
2009-09-02 08:36:30 +00:00
Eelco Dolstra b1aa227cbd * Use -no-reboot, otherwise kernel panics cause QEMU to get into an
infinite loop trying to start the machine.

svn path=/nixos/trunk/; revision=16922
2009-09-02 07:52:36 +00:00
Eelco Dolstra 4d8d704fba * Run the subversion.nix test with coverage analysis on the kernel.
svn path=/nixos/trunk/; revision=16917
2009-09-01 22:22:45 +00:00
Eelco Dolstra 9359bf11d5 * Build the Subversion test in Hydra (as a regression test for NixOS).
* Pass the location to the services tree around instead of requiring
  it to be in ../services.

svn path=/nixos/trunk/; revision=16901
2009-08-31 14:56:19 +00:00
Eelco Dolstra 27a8e656bc * Stuff for automatic and manual testing of NixOS VMs.
lib/build-vms.nix contains a function `buildVirtualNetwork' that
  takes a specification of a network of machines (as an attribute set
  of NixOS machine configurations) and builds a script that starts
  each configuration in a separate QEMU/KVM VM and connects them
  together in a virtual network.  This script can be run manually to
  test the VMs interactively.  There is also a function `runTests'
  that starts and runs the virtual network in a derivation, and
  then executes a test specification that tells the VMs to do certain
  things (i.e., letting one VM send an HTTP request to a webserver on
  another VM).  The tests are written in Perl (for now).

  tests/subversion.nix shows a simple example, namely a network of two
  machines: a webserver that runs the Subversion subservice, and a
  client.  Apache, Subversion and a few other packages are built with
  coverage analysis instrumentation.  For instance,

    $ nix-build tests/subversion.nix -A vms
    $ ./result/bin/run-vms

  starts two QEMU/KVM instances.  When they have finished booting, the
  webserver can be accessed from the host through
  http://localhost:8081/.

  It also has a small test suite:

    $ nix-build tests/subversion.nix -A report

  This runs the VMs in a derivation, runs the tests, and then produces
  a distributed code coverage analysis report (i.e. it shows the
  combined coverage on both machines).

  The Perl test driver program is in lib/test-driver.  It executes
  commands on the guest machines by connecting to a root shell running
  on port 514 (provided by modules/testing/test-instrumentation.nix).

  The VMs are connected together in a virtual network using QEMU's
  multicast feature.  This isn't very secure.  At the very least,
  other processes on the same machine can listen to or send packets on
  the virtual network.  On the plus side, we don't need to be root to
  set up a multicast virtual network, so we can do it from a
  derivation.  Maybe we can use VDE instead.

  (Moved from the vario repository.)

svn path=/nixos/trunk/; revision=16899
2009-08-31 14:25:12 +00:00