From b452c2cd2ba17aaf4511d5fb584a1741cead0721 Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Sat, 24 Aug 2024 18:14:04 +0000 Subject: [PATCH 1/2] xtf: init at 0-unstable-2024-07-25 The Xen Test Framework, a comprehensive suite of tests that can be run in a dom0 to test some advanced functionality of the Xen Hypervisor. It's a python script that calls the `xl` binary to run the tests defined in the tests/ directory. Signed-off-by: Fernando Rodrigues --- pkgs/by-name/xt/xtf/package.nix | 78 +++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 pkgs/by-name/xt/xtf/package.nix diff --git a/pkgs/by-name/xt/xtf/package.nix b/pkgs/by-name/xt/xtf/package.nix new file mode 100644 index 000000000000..b30c0a973f9f --- /dev/null +++ b/pkgs/by-name/xt/xtf/package.nix @@ -0,0 +1,78 @@ +{ + lib, + fetchgit, + unstableGitUpdater, + stdenv, + doxygen, + graphviz, + python3Packages, +}: + +stdenv.mkDerivation { + pname = "xtf"; + version = "0-unstable-2024-07-25"; + + outputs = [ + "out" # xtf-runner and test suite. + "doc" # Autogenerated HTML documentation website. + "dev" # Development headers. + ]; + + src = fetchgit { + url = "https://xenbits.xenproject.org/git-http/xtf.git"; + rev = "f37c4574dd79d058c035be989ac6648508556a1a"; + hash = "sha256-3eOKQXdyFX0iY90UruK8lLfnXQt+cOlvyW/KMj2hczQ="; + }; + + nativeBuildInputs = + (with python3Packages; [ + python + wrapPython + ]) + ++ [ + doxygen + graphviz + ]; + + buildFlags = [ "doxygen" ]; + + installFlags = [ + "xtfdir=$(out)/share/xtf" + ]; + + postInstall = + # Much like Xen, XTF installs its files to dist/nix/store/*/*, + # so we need to copy them to the right place. + '' + mkdir -p ''${!outputBin}/share + cp -prvd dist/nix/store/*/* ''${!outputBin} + '' + # The documentation and development headers aren't in the dist/ + # folder, so we copy those too. + + '' + mkdir -p ''${!outputDoc}/share/doc/xtf + cp -prvd docs/autogenerated/html ''${!outputDoc}/share/doc/xtf + + mkdir -p ''${!outputDev}/include + cp -prvd include ''${!outputDev} + '' + # Wrap xtf-runner, and link it to $out/bin. + # This is necessary because the real xtf-runner should + # be in the same directory as the tests/ directory. + + '' + wrapPythonProgramsIn "''${!outputBin}/share/xtf" "''${!outputBin} $pythonPath" + mkdir -p ''${!outputBin}/bin + ln -s ''${!outputBin}/share/xtf/xtf-runner ''${!outputBin}/bin/xtf-runner + ''; + + passthru.updateScript = unstableGitUpdater { }; + + meta = { + description = "Xen Test Framework and Suite for creating microkernel-based tests"; + homepage = "https://xenbits.xenproject.org/docs/xtf/index.html"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ sigmasquadron ]; + mainProgram = "xtf-runner"; + platforms = lib.lists.intersectLists lib.platforms.linux lib.platforms.x86_64; + }; +} From 199115ee3cd36bf04190f57d75c5d0d6b7643616 Mon Sep 17 00:00:00 2001 From: Fernando Rodrigues Date: Sat, 24 Aug 2024 18:14:17 +0000 Subject: [PATCH 2/2] xen: add xtf to README Indicates that XTF should be used as a baseline test suite for any Xen update from now on. Signed-off-by: Fernando Rodrigues --- pkgs/applications/virtualization/xen/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/applications/virtualization/xen/README.md b/pkgs/applications/virtualization/xen/README.md index c059808dcecb..9468bb8d148c 100644 --- a/pkgs/applications/virtualization/xen/README.md +++ b/pkgs/applications/virtualization/xen/README.md @@ -26,6 +26,7 @@ Some other notable packages that compose the Xen Ecosystem include: - `ocamlPackages.xenstore-tool`: XAPI's `oxenstore` utilities. - `xen-guest-agent`: Guest drivers for UNIX domUs. - `win-pvdrivers`: Guest drivers for Windows domUs. +- `xtf`: The Xen Test Framework. ## Updating @@ -99,6 +100,8 @@ open a PR fixing the script, and update Xen manually: ``` Change the value of `xenToEvaluate` to evaluate all relevant Xen packages. +1. Run `xtf --all --host` as root when booted into the Xen update, and make + sure no tests fail. 1. Clean up your changes and commit them, making sure to follow the [Nixpkgs Contribution Guidelines](../../../../CONTRIBUTING.md). 1. Open a PR and await a review from the current maintainers.