Merge pull request #46806 from Ma27/disallow-dash-separators-in-machine-declarations

nixos/testing: disallow special chars in machine names in network expressions
This commit is contained in:
Franz Pletz
2018-12-18 01:03:34 +00:00
committed by GitHub

View File

@@ -156,9 +156,23 @@ in rec {
test = passMeta (runTests driver); test = passMeta (runTests driver);
report = passMeta (releaseTools.gcovReport { coverageRuns = [ test ]; }); report = passMeta (releaseTools.gcovReport { coverageRuns = [ test ]; });
in (if makeCoverageReport then report else test) // { nodeNames = builtins.attrNames nodes;
inherit nodes driver test; invalidNodeNames = lib.filter
}; (node: builtins.match "^[A-z_][A-z0-9_]+$" node == null) nodeNames;
in
if lib.length invalidNodeNames > 0 then
throw ''
Cannot create machines out of (${lib.concatStringsSep ", " invalidNodeNames})!
All machines are references as perl variables in the testing framework which will break the
script when special characters are allowed.
Please stick to alphanumeric chars and underscores as separation.
''
else
(if makeCoverageReport then report else test) // {
inherit nodes driver test;
};
runInMachine = runInMachine =
{ drv { drv