virtualbox: Change the virtualbox tests to not build the unfree tests by default. (#45415)

authored by Dennis Gosnell and committed by xeji 7d23ffb7 bc09c145

+22 -20
+22 -20
nixos/tests/virtualbox.nix
··· 1 - { system ? builtins.currentSystem, debug ? false }: 1 + { system ? builtins.currentSystem, debug ? false, enableUnfree ? false }: 2 2 3 3 with import ../lib/testing.nix { inherit system; }; 4 4 with pkgs.lib; ··· 378 378 }; 379 379 }; 380 380 381 + unfreeTests = mapAttrs (mkVBoxTest true vboxVMsWithExtpack) { 382 + enable-extension-pack = '' 383 + createVM_testExtensionPack; 384 + vbm("startvm testExtensionPack"); 385 + waitForStartup_testExtensionPack; 386 + $machine->screenshot("cli_started"); 387 + waitForVMBoot_testExtensionPack; 388 + $machine->screenshot("cli_booted"); 389 + 390 + $machine->nest("Checking for privilege escalation", sub { 391 + $machine->fail("test -e '/root/VirtualBox VMs'"); 392 + $machine->fail("test -e '/root/.config/VirtualBox'"); 393 + $machine->succeed("test -e '/home/alice/VirtualBox VMs'"); 394 + }); 395 + 396 + shutdownVM_testExtensionPack; 397 + destroyVM_testExtensionPack; 398 + ''; 399 + }; 400 + 381 401 in mapAttrs (mkVBoxTest false vboxVMs) { 382 402 simple-gui = '' 383 403 createVM_simple; ··· 484 504 destroyVM_test1; 485 505 destroyVM_test2; 486 506 ''; 487 - } // mapAttrs (mkVBoxTest true vboxVMsWithExtpack) { 488 - enable-extension-pack = '' 489 - createVM_testExtensionPack; 490 - vbm("startvm testExtensionPack"); 491 - waitForStartup_testExtensionPack; 492 - $machine->screenshot("cli_started"); 493 - waitForVMBoot_testExtensionPack; 494 - $machine->screenshot("cli_booted"); 495 - 496 - $machine->nest("Checking for privilege escalation", sub { 497 - $machine->fail("test -e '/root/VirtualBox VMs'"); 498 - $machine->fail("test -e '/root/.config/VirtualBox'"); 499 - $machine->succeed("test -e '/home/alice/VirtualBox VMs'"); 500 - }); 501 - 502 - shutdownVM_testExtensionPack; 503 - destroyVM_testExtensionPack; 504 - ''; 505 - } 507 + } // (if enableUnfree then unfreeTests else {})