glib-networking: add installed tests

This commit is contained in:
Jan Tojnar 2019-09-02 19:06:54 +02:00
parent ce4036177b
commit ecf6f4aeb1
No known key found for this signature in database
GPG key ID: 7FAB2A15F7A607A4
4 changed files with 67 additions and 0 deletions

View file

@ -94,6 +94,7 @@ in
gitlab = handleTest ./gitlab.nix {};
gitolite = handleTest ./gitolite.nix {};
gjs = handleTest ./gjs.nix {};
glib-networking = handleTest ./glib-networking.nix {};
glusterfs = handleTest ./glusterfs.nix {};
gnome3-xorg = handleTest ./gnome3-xorg.nix {};
gnome3 = handleTest ./gnome3.nix {};

View file

@ -0,0 +1,17 @@
# run installed tests
import ./make-test.nix ({ pkgs, ... }:
{
name = "glib-networking";
meta = {
maintainers = pkgs.glib-networking.meta.maintainers;
};
machine = { pkgs, ... }: {
environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
};
testScript = ''
$machine->succeed("gnome-desktop-testing-runner -d '${pkgs.glib-networking.installedTests}/share'");
'';
})

View file

@ -3,9 +3,11 @@
, substituteAll
, meson
, ninja
, nixosTests
, pkgconfig
, glib
, gettext
, makeWrapper
, python3
, gnutls
, p11-kit
@ -18,6 +20,8 @@ stdenv.mkDerivation rec {
pname = "glib-networking";
version = "2.60.3";
outputs = [ "out" "installedTests" ];
src = fetchurl {
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm";
@ -28,6 +32,8 @@ stdenv.mkDerivation rec {
src = ./hardcode-gsettings.patch;
gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas;
})
./installed-tests-path.patch
];
postPatch = ''
@ -40,6 +46,7 @@ stdenv.mkDerivation rec {
ninja
pkgconfig
gettext
makeWrapper
python3 # for install_script
];
@ -53,10 +60,27 @@ stdenv.mkDerivation rec {
doCheck = false; # tests need to access the certificates (among other things)
mesonFlags = [
"-Dinstalled_tests=true"
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
];
postFixup = ''
find "$installedTests/libexec" "$out/libexec" -type f -executable -print0 \
| while IFS= read -r -d "" file; do
echo "Wrapping program '$file'"
wrapProgram "$file" --prefix GIO_EXTRA_MODULES : "$out/lib/gio/modules"
done
'';
passthru = {
updateScript = gnome3.updateScript {
packageName = pname;
};
tests = {
installedTests = nixosTests.glib-networking;
};
};
meta = with stdenv.lib; {

View file

@ -0,0 +1,25 @@
diff --git a/meson.build b/meson.build
index 4d91677..aaaeb2b 100644
--- a/meson.build
+++ b/meson.build
@@ -12,8 +12,8 @@
libexecdir = join_paths(prefix, get_option('libexecdir'))
localedir = join_paths(prefix, get_option('localedir'))
-installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name())
-installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name())
+installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', meson.project_name())
+installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', meson.project_name())
cc = meson.get_compiler('c')
host_system = host_machine.system()
diff --git a/meson_options.txt b/meson_options.txt
index 3a525dd..fc86302 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,4 +3,5 @@
option('libproxy', type: 'feature', value: 'auto', description: 'support for libproxy proxy configration')
option('gnome_proxy', type: 'feature', value: 'auto', description: 'support for GNOME desktop proxy configuration')
option('installed_tests', type: 'boolean', value: false, description: 'enable installed tests')
+option('installed_test_prefix', type: 'string', value: '', description: 'Prefix for installed tests')
option('static_modules', type: 'boolean', value: false, description: 'build static modules')