summary refs log tree commit diff
path: root/pkgs/development/libraries/gcab
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-11-07 13:59:11 +0100
committerJan Tojnar <jtojnar@gmail.com>2019-11-07 14:07:19 +0100
commite253d015a187aa51f85f9f1dfb926b7889c5731b (patch)
tree13c3d5dc6774b7ab0259f24fe2a20dd2340900cb /pkgs/development/libraries/gcab
parentc88e084ecb73c72d966423084ab13adf98376b83 (diff)
downloadnixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.tar
nixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.tar.gz
nixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.tar.bz2
nixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.tar.lz
nixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.tar.xz
nixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.tar.zst
nixpkgs-e253d015a187aa51f85f9f1dfb926b7889c5731b.zip
gcab: run & install tests
also add nixosTests.installed-tests.gcab for running the installed tests
Diffstat (limited to 'pkgs/development/libraries/gcab')
-rw-r--r--pkgs/development/libraries/gcab/default.nix17
-rw-r--r--pkgs/development/libraries/gcab/installed-tests-path.patch21
2 files changed, 36 insertions, 2 deletions
diff --git a/pkgs/development/libraries/gcab/default.nix b/pkgs/development/libraries/gcab/default.nix
index b4e941eab39..2598b85269f 100644
--- a/pkgs/development/libraries/gcab/default.nix
+++ b/pkgs/development/libraries/gcab/default.nix
@@ -13,19 +13,25 @@
 , glib
 , zlib
 , gnome3
+, nixosTests
 }:
 
 stdenv.mkDerivation rec {
   pname = "gcab";
   version = "1.3";
 
-  outputs = [ "bin" "out" "dev" "devdoc" ];
+  outputs = [ "bin" "out" "dev" "devdoc" "installedTests" ];
 
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
     sha256 = "1rv81b37d5ya7xpfdxrfk173jjcwabxyng7vafgwyl5myv44qc0h";
   };
 
+  patches = [
+    # allow installing installed tests to a separate output
+    ./installed-tests-path.patch
+  ];
+
   nativeBuildInputs = [
     meson
     ninja
@@ -45,14 +51,21 @@ stdenv.mkDerivation rec {
   ];
 
   mesonFlags = [
-    "-Dtests=false"
+    "-Dinstalled_tests=true"
+    "-Dinstalled_test_prefix=${placeholder ''installedTests''}"
   ];
 
+  doCheck = true;
+
   passthru = {
     updateScript = gnome3.updateScript {
       packageName = pname;
       versionPolicy = "none";
     };
+
+    tests = {
+      installedTests = nixosTests.installed-tests.gcab;
+    };
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/gcab/installed-tests-path.patch b/pkgs/development/libraries/gcab/installed-tests-path.patch
new file mode 100644
index 00000000000..ab3b6b3fae3
--- /dev/null
+++ b/pkgs/development/libraries/gcab/installed-tests-path.patch
@@ -0,0 +1,21 @@
+diff --git a/meson_options.txt b/meson_options.txt
+index c1b1da1..9b76022 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -4,3 +4,4 @@
+ option('vapi', type : 'boolean', value : true, description: 'generate Vala bindings (requires introspection)')
+ option('tests', type : 'boolean', value : true, description : 'enable tests')
+ option('installed_tests', type : 'boolean', value : false, description : 'install tests for "as-installed" testing')
++option('installed_test_prefix', type: 'string', value: '', description: 'Prefix for installed tests')
+diff --git a/tests/meson.build b/tests/meson.build
+index 1e46e2a..aa780d0 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -1,5 +1,5 @@
+-installed_tests_metadir = join_paths(get_option('datadir'), 'installed-tests', 'libgcab-1.0')
+-installed_tests_execdir = join_paths(get_option('libexecdir'), 'installed-tests', 'libgcab-1.0')
++installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', 'libgcab-1.0')
++installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', 'libgcab-1.0')
+ installed_tests_enabled = get_option('installed_tests')
+ installed_tests_template_tap = files('template-tap.test.in')
+ abs_installed_tests_execdir = join_paths(get_option('prefix'), installed_tests_execdir)