nixosTests.scx: init (#401972)
For now, test only the useful schedulers, there's no need to test all of them. Co-authored-by: Gliczy <129636582+Gliczy@users.noreply.github.com> Signed-off-by: John Titor <50095635+JohnRTitor@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									16b197986e
								
							
						
					
					
						commit
						800908cd55
					
				@ -1192,6 +1192,7 @@ in
 | 
			
		||||
  schleuder = handleTest ./schleuder.nix { };
 | 
			
		||||
  scion-freestanding-deployment = handleTest ./scion/freestanding-deployment { };
 | 
			
		||||
  scrutiny = runTest ./scrutiny.nix;
 | 
			
		||||
  scx = runTest ./scx/default.nix;
 | 
			
		||||
  sddm = handleTest ./sddm.nix { };
 | 
			
		||||
  sdl3 = handleTest ./sdl3.nix { };
 | 
			
		||||
  seafile = handleTest ./seafile.nix { };
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								nixos/tests/scx/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								nixos/tests/scx/default.nix
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,42 @@
 | 
			
		||||
{ pkgs, ... }:
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  name = "scx_full";
 | 
			
		||||
  meta = {
 | 
			
		||||
    inherit (pkgs.scx.full.meta) maintainers;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  nodes.machine = {
 | 
			
		||||
    boot.kernelPackages = pkgs.linuxPackages_latest;
 | 
			
		||||
    services.scx.enable = true;
 | 
			
		||||
 | 
			
		||||
    specialisation = {
 | 
			
		||||
      bpfland.configuration.services.scx.scheduler = "scx_bpfland";
 | 
			
		||||
      central.configuration.services.scx.scheduler = "scx_central";
 | 
			
		||||
      lavd.configuration.services.scx.scheduler = "scx_lavd";
 | 
			
		||||
      rlfifo.configuration.services.scx.scheduler = "scx_rlfifo";
 | 
			
		||||
      rustland.configuration.services.scx.scheduler = "scx_rustland";
 | 
			
		||||
      rusty.configuration.services.scx.scheduler = "scx_rusty";
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  testScript = ''
 | 
			
		||||
    specialisation = [
 | 
			
		||||
      "bpfland",
 | 
			
		||||
      "central",
 | 
			
		||||
      "lavd",
 | 
			
		||||
      "rlfifo",
 | 
			
		||||
      "rustland",
 | 
			
		||||
      "rusty"
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    def activate_specialisation(name: str):
 | 
			
		||||
      machine.succeed(f"/run/booted-system/specialisation/{name}/bin/switch-to-configuration test >&2")
 | 
			
		||||
 | 
			
		||||
    for sched in specialisation:
 | 
			
		||||
      with subtest(f"{sched}"):
 | 
			
		||||
        activate_specialisation(sched)
 | 
			
		||||
        machine.succeed("systemctl restart scx.service")
 | 
			
		||||
        machine.succeed(f"ps -U root -u root u | grep scx_{sched}")
 | 
			
		||||
  '';
 | 
			
		||||
}
 | 
			
		||||
@ -3,6 +3,7 @@
 | 
			
		||||
  stdenv,
 | 
			
		||||
  scx-common,
 | 
			
		||||
  scx,
 | 
			
		||||
  nixosTests,
 | 
			
		||||
}:
 | 
			
		||||
scx.cscheds.overrideAttrs (oldAttrs: {
 | 
			
		||||
  pname = "scx_full";
 | 
			
		||||
@ -12,6 +13,8 @@ scx.cscheds.overrideAttrs (oldAttrs: {
 | 
			
		||||
      cp ${scx.rustscheds}/bin/* ${placeholder "bin"}/bin/
 | 
			
		||||
    '';
 | 
			
		||||
 | 
			
		||||
  passthru.tests.basic = nixosTests.scx;
 | 
			
		||||
 | 
			
		||||
  passthru.updateScript.command = ./update.sh;
 | 
			
		||||
 | 
			
		||||
  meta = oldAttrs.meta // {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user