* A quick hack to enable debugging of VM test scripts: the test script
is now made available in the interactive test driver. For instance, you can do $ nix-build tests/ -A quake3.driver $ ./result/bin/nixos-test-driver > eval $ENV{'testScript'}; ... see VMs + X11 + Quake get started, bots running around ... > So after this you can run commands interactively on the VMs in the state they were in after the conclusion of the test script. svn path=/nixos/trunk/; revision=25158
This commit is contained in:
parent
dac1936869
commit
e90a1cfc59
@ -117,24 +117,38 @@ rec {
|
|||||||
if t ? nodes then t.nodes else
|
if t ? nodes then t.nodes else
|
||||||
if t ? machine then { machine = t.machine; }
|
if t ? machine then { machine = t.machine; }
|
||||||
else { };
|
else { };
|
||||||
|
|
||||||
vms = buildVirtualNetwork { inherit nodes; };
|
vms = buildVirtualNetwork { inherit nodes; };
|
||||||
test = runTests vms
|
|
||||||
|
testScript =
|
||||||
# Call the test script with the computed nodes.
|
# Call the test script with the computed nodes.
|
||||||
(if builtins.isFunction t.testScript then t.testScript { inherit (vms) nodes; } else t.testScript);
|
if builtins.isFunction t.testScript
|
||||||
|
then t.testScript { inherit (vms) nodes; }
|
||||||
|
else t.testScript;
|
||||||
|
|
||||||
|
test = runTests vms testScript;
|
||||||
|
|
||||||
report = makeReport test;
|
report = makeReport test;
|
||||||
|
|
||||||
# Generate a convenience wrapper for running the test driver
|
# Generate a convenience wrapper for running the test driver
|
||||||
# interactively with the specified network.
|
# interactively with the specified network.
|
||||||
driver = runCommand "nixos-test-driver" { buildInputs = [ makeWrapper]; }
|
driver = runCommand "nixos-test-driver"
|
||||||
|
{ buildInputs = [ makeWrapper];
|
||||||
|
inherit testScript;
|
||||||
|
}
|
||||||
''
|
''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
ln -s ${vms}/bin/* $out/bin/
|
ln -s ${vms}/bin/* $out/bin/
|
||||||
ln -s ${testDriver}/bin/* $out/bin/
|
ln -s ${testDriver}/bin/* $out/bin/
|
||||||
wrapProgram $out/bin/nixos-test-driver \
|
wrapProgram $out/bin/nixos-test-driver \
|
||||||
--add-flags "${vms}/vms/*/bin/run-*-vm"
|
--add-flags "${vms}/vms/*/bin/run-*-vm" \
|
||||||
|
--run "testScript=\"\$(cat $out/test-script)\"" \
|
||||||
|
--set testScript '"$testScript"'
|
||||||
|
echo "$testScript" > $out/test-script
|
||||||
''; # "
|
''; # "
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
runInMachine =
|
runInMachine =
|
||||||
{ drv
|
{ drv
|
||||||
, machine
|
, machine
|
||||||
@ -182,6 +196,7 @@ rec {
|
|||||||
origBuilder = attrs.builder;
|
origBuilder = attrs.builder;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
runInMachineWithX = { require ? [], ...}@args :
|
runInMachineWithX = { require ? [], ...}@args :
|
||||||
let
|
let
|
||||||
client =
|
client =
|
||||||
@ -204,6 +219,7 @@ rec {
|
|||||||
'' ;
|
'' ;
|
||||||
} // args );
|
} // args );
|
||||||
|
|
||||||
|
|
||||||
simpleTest = as: (makeTest ({ ... }: as)).test;
|
simpleTest = as: (makeTest ({ ... }: as)).test;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user