From c0f7ef32f85717b530167128f842a96005df6852 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Fri, 10 Aug 2018 12:07:57 +0200
Subject: [PATCH] ensure precedence of local modules when testing executables

---
 Makefile.am |  1 +
 t/cli.t     |  2 +-
 t/lib.pm    | 10 ++++++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 t/lib.pm

diff --git a/Makefile.am b/Makefile.am
index 7667f22..e07362f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,4 +17,5 @@ EXTRA_DIST = \
 	README.md \
 	CHANGES.md \
 	t/edugain.xml \
+	t/lib.pm \
 	$(TESTS)
diff --git a/t/cli.t b/t/cli.t
index d016df0..63f808e 100755
--- a/t/cli.t
+++ b/t/cli.t
@@ -214,7 +214,7 @@ sub run_executable {
 
     my @args = $args ? split(/\s+/, $args) : ();
     run(
-        [ $EXECUTABLE_NAME, '-I', 'lib', 'bin/' . $executable, @args ],
+        [ $EXECUTABLE_NAME, '-I', 'lib', '-I', 't', 'bin/' . $executable, @args ],
         \my ($in, $out, $err)
     );
     return ($out, $err, $CHILD_ERROR >> 8);
diff --git a/t/lib.pm b/t/lib.pm
new file mode 100644
index 0000000..1c71697
--- /dev/null
+++ b/t/lib.pm
@@ -0,0 +1,10 @@
+package lib;
+
+# this module overrides the system one, in order to ensure precedence of local
+# module version specificed on command-line over those already installed
+
+sub import {
+    # do nothing
+};
+
+1;
-- 
GitLab