summary refs log tree commit diff
path: root/pkgs/development/libraries/glib-networking
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-09-02 19:06:54 +0200
committerJan Tojnar <jtojnar@gmail.com>2019-09-03 16:11:38 +0200
commitecf6f4aeb1f82d869a52a1cf414a6b02caec1538 (patch)
tree6150dd40d9d7e4cc299ad765276d159a6f016c8d /pkgs/development/libraries/glib-networking
parentce4036177bfb716cdc89d565c5dd57fac7b2116a (diff)
downloadnixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.tar
nixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.tar.gz
nixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.tar.bz2
nixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.tar.lz
nixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.tar.xz
nixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.tar.zst
nixpkgs-ecf6f4aeb1f82d869a52a1cf414a6b02caec1538.zip
glib-networking: add installed tests
Diffstat (limited to 'pkgs/development/libraries/glib-networking')
-rw-r--r--pkgs/development/libraries/glib-networking/default.nix24
-rw-r--r--pkgs/development/libraries/glib-networking/installed-tests-path.patch25
2 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index 21fbd94d1bc..ae386f46bff 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -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; {
diff --git a/pkgs/development/libraries/glib-networking/installed-tests-path.patch b/pkgs/development/libraries/glib-networking/installed-tests-path.patch
new file mode 100644
index 00000000000..942ca053dd4
--- /dev/null
+++ b/pkgs/development/libraries/glib-networking/installed-tests-path.patch
@@ -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')