nixos/fwupd: add test

This commit is contained in:
Jan Tojnar 2018-02-14 05:03:20 +01:00
parent be54e4b07e
commit 201cc158cb
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
4 changed files with 40 additions and 5 deletions

View File

@ -258,6 +258,7 @@ in rec {
tests.firefox = callTest tests/firefox.nix {};
tests.firewall = callTest tests/firewall.nix {};
tests.fleet = callTestOnTheseSystems ["x86_64-linux"] tests/fleet.nix {};
tests.fwupd = callTest tests/fwupd.nix {};
#tests.gitlab = callTest tests/gitlab.nix {};
tests.gitolite = callTest tests/gitolite.nix {};
tests.gocd-agent = callTest tests/gocd-agent.nix {};

19
nixos/tests/fwupd.nix Normal file
View File

@ -0,0 +1,19 @@
# run installed tests
import ./make-test.nix ({ pkgs, ... }: {
name = "fwupd";
meta = {
maintainers = pkgs.fwupd.meta.maintainers;
};
machine = { config, pkgs, ... }: {
services.fwupd.enable = true;
environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
environment.variables.XDG_DATA_DIRS = [ "${pkgs.fwupd.installedTests}/share" ];
virtualisation.memorySize = 768;
};
testScript = ''
$machine->succeed("gnome-desktop-testing-runner");
'';
})

View File

@ -1,12 +1,14 @@
{ stdenv, fetchurl, fetchpatch, gtk_doc, pkgconfig, gobjectIntrospection, intltool
, libgudev, polkit, appstream-glib, gusb, sqlite, libarchive, glib_networking
, libsoup, docbook2x, gpgme, libxslt, elfutils, libsmbios, efivar, glibcLocales
, fwupdate, libyaml, valgrind, meson, libuuid, pygobject3, colord
, pillow, ninja, gcab, gnutls, python3Packages, wrapGAppsHook, json_glib
, fwupdate, libyaml, valgrind, meson, libuuid, colord
, ninja, gcab, gnutls, python3, wrapGAppsHook, json_glib
, shared_mime_info, umockdev
}:
let
version = "1.0.4";
python = python3.withPackages (p: with p; [ pygobject3 pycairo pillow ]);
installedTestsPython = python3.withPackages (p: with p; [ pygobject3 requests ]);
in stdenv.mkDerivation {
name = "fwupd-${version}";
src = fetchurl {
@ -18,11 +20,11 @@ in stdenv.mkDerivation {
nativeBuildInputs = [
meson ninja gtk_doc pkgconfig gobjectIntrospection intltool glibcLocales shared_mime_info
valgrind gcab docbook2x libxslt pygobject3 python3Packages.pycairo wrapGAppsHook
valgrind gcab docbook2x libxslt python wrapGAppsHook
];
buildInputs = [
polkit appstream-glib gusb sqlite libarchive libsoup elfutils libsmbios fwupdate libyaml
libgudev colord gpgme libuuid pillow gnutls glib_networking efivar json_glib umockdev
libgudev colord gpgme libuuid gnutls glib_networking efivar json_glib umockdev
];
LC_ALL = "en_US.UTF-8"; # For po/make-images
@ -34,8 +36,18 @@ in stdenv.mkDerivation {
url = https://github.com/hughsie/fwupd/commit/bd6082574989e4f48b66c7270bb408d439b77a06.patch;
sha256 = "17pixyizkmn6wlsjmr1wwya17ivn770hdv9mp769vifxinya8w9y";
})
# https://github.com/hughsie/fwupd/issues/405
(fetchpatch {
url = https://github.com/hughsie/fwupd/pull/407.patch;
sha256 = "1dxhqps12x7bz0s974xk5hfpk4nwn1gs29vl0dfi9j54wy18f688";
})
];
postPatch = ''
# needs a different set of modules than po/make-images
escapedInterpreterLine=$(echo "${installedTestsPython}/bin/python3" | sed 's|\\|\\\\|g')
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" data/installed-tests/hardware.py
patchShebangs .
substituteInPlace data/installed-tests/fwupdmgr.test.in --subst-var-by installedtestsdir "$installedTests/share/installed-tests/fwupd"
'';
@ -48,6 +60,7 @@ in stdenv.mkDerivation {
mesonFlags = [
"-Dman=false"
"-Dplugin_dummy=true"
"-Dgtkdoc=false"
"-Dbootdir=/boot"
"-Dudevdir=lib/udev"
@ -57,6 +70,8 @@ in stdenv.mkDerivation {
postInstall = ''
moveToOutput share/installed-tests "$installedTests"
wrapProgram $installedTests/share/installed-tests/fwupd/hardware.py \
--prefix GI_TYPELIB_PATH : "$out/lib/girepository-1.0:${libsoup}/lib/girepository-1.0"
'';
enableParallelBuilding = true;

View File

@ -12728,7 +12728,7 @@ with pkgs;
fscrypt-experimental = callPackage ../os-specific/linux/fscrypt { };
fscryptctl-experimental = callPackage ../os-specific/linux/fscryptctl { };
fwupd = callPackage ../os-specific/linux/firmware/fwupd { inherit (gnome2) gtk_doc; inherit (python3Packages) pygobject3 pillow; };
fwupd = callPackage ../os-specific/linux/firmware/fwupd { inherit (gnome2) gtk_doc; };
fwupdate = callPackage ../os-specific/linux/firmware/fwupdate { };