Explorar o código

Ship invercargill-1.deps and run the test suite via meson test and usm

The vapi shipped without a .deps file, so every consumer had to know
invercargill-1's own closure (glib-2.0, gobject-2.0). The file is now
generated into vapi/ and installed to share/vala/vapi alongside the
vapi; the vapi leaks no other namespaces, so those two entries are the
complete closure (verified by compiling a consumer against a scratch
prefix with only the .deps chain).

The 602-test suite was built but never registered with meson test(), so
nothing ran it: it is now registered with a 180s timeout (the full suite
takes about 65s; the 30s meson default times out), and usm-scripts/test.sh
plus the manifest test exec run it through ninja. test.sh scrubs
LD_LIBRARY_PATH: a system-wide value there (this saddle exports
/opt/usm/lib) overrides the build tree's RUNPATH and links the tests
against a stale installed copy of the library, which shows up as bogus
ownership failures in a perfectly good build.

MANIFEST.usm declares the .deps in provides and the test exec.
goal-38 task agent hai 2 semanas
pai
achega
3d19e9212a
Modificáronse 5 ficheiros con 32 adicións e 3 borrados
  1. 3 1
      MANIFEST.usm
  2. 11 1
      src/meson.build
  3. 4 1
      src/tests/meson.build
  4. 12 0
      usm-scripts/test.sh
  5. 2 0
      vapi/invercargill-1.deps

+ 3 - 1
MANIFEST.usm

@@ -8,6 +8,7 @@
     "lib:libinvercargill-1.so": "as-expected",
     "inc:invercargill-1.h": "as-expected",
     "vapi:invercargill-1.vapi": "as-expected",
+    "vapi:invercargill-1.deps": "as-expected",
     "gir:invercargill-1.gir": "as-expected",
     "typelib:invercargill-1.typelib": "as-expected",
     "pc:invercargill-1.pc": "as-expected"
@@ -33,6 +34,7 @@
   "execs": {
     "build": "usm-scripts/build.sh",
     "install": "usm-scripts/install.sh",
-    "postInstall": "usm-scripts/post-install.sh"
+    "postInstall": "usm-scripts/post-install.sh",
+    "test": "usm-scripts/test.sh"
   }
 }

+ 11 - 1
src/meson.build

@@ -1,4 +1,14 @@
 project('invercargill', 'vala', 'c')
 subdir('lib')
 dependencies += invercargill_dep
-subdir('tests')
+subdir('tests')
+
+# --- Install surface for consumers -------------------------------------
+# A consumer compiles with `valac --pkg invercargill-1`; valac reads
+# invercargill-1.deps from share/vala/vapi and resolves every entry there.
+# The vapi leaks no backend namespaces (checked: only GLib/GObject types),
+# so glib-2.0 + gobject-2.0 is the complete closure.
+install_data(
+    '../vapi/invercargill-1.deps',
+    install_dir: get_option('datadir') / 'vala' / 'vapi',
+)

+ 4 - 1
src/tests/meson.build

@@ -43,4 +43,7 @@ sources += files('Speed/Set.vala')
 sources += files('Speed/SortedSeries.vala')
 sources += files('Speed/Buffer.vala')
 
-executable('invercargill-test-suite', sources, dependencies: dependencies, install: false)
+invercargill_test_suite = executable('invercargill-test-suite', sources, dependencies: dependencies, install: false)
+
+# The full suite runs in ~65s (default 30s meson timeout is too tight).
+test('invercargill', invercargill_test_suite, timeout: 180)

+ 12 - 0
usm-scripts/test.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+# Runs the test suite inside an already-built tree. ninja's test target
+# exits 0 even when no tests are defined, so this stays uniform across
+# the family. $1 is the build directory (set by usm).
+#
+# LD_LIBRARY_PATH is scrubbed: a system-wide path here (e.g. /opt/usm/lib)
+# takes precedence over the build tree's RUNPATH and silently links the
+# tests against a stale installed copy of the library instead of the one
+# just built — failures then reflect the old lib, not this source.
+LD_LIBRARY_PATH= ninja -C "$1" test

+ 2 - 0
vapi/invercargill-1.deps

@@ -0,0 +1,2 @@
+glib-2.0
+gobject-2.0