git » libfiu » commit 1ab50f3

tests/utils: Make "wrap" easier to call by hand

author Alberto Bertogli
2018-12-13 13:47:08 UTC
committer Alberto Bertogli
2019-09-09 23:35:20 UTC
parent 38784620e5e873cf08579b8f76df227c84751459

tests/utils: Make "wrap" easier to call by hand

When doing some tests by hand, some times it can be convenient to call
"wrap" from the command line.

Currently this is not as easy, because there are some assumptions about
paths that get in the way.

This patch removes that annoyance by making paths relative to the
utility itself.

As a side-effect, update travis-ci's configuration to be based on
xenial, as this change needs "realpath" which has been a part of
coreutils for a few years.

.travis.yml +3 -0
tests/utils/wrap +8 -4

diff --git a/.travis.yml b/.travis.yml
index 120cbd2..1259383 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,7 @@
 # Configuration for https://travis-ci.org/
 
+dist: xenial
+
 language: c
 
 compiler:
@@ -9,6 +11,7 @@ compiler:
 addons:
     apt:
         packages:
+            - coreutils
             - python-dev
             - python3-dev
 
diff --git a/tests/utils/wrap b/tests/utils/wrap
index ad32b9d..7c68979 100755
--- a/tests/utils/wrap
+++ b/tests/utils/wrap
@@ -5,18 +5,22 @@
 #
 # The first argument is the utility to run.
 
+BASE="$(realpath `dirname ${0}`/../..)"
+
+export LD_LIBRARY_PATH="$BASE/libfiu:$LD_LIBRARY_PATH"
+
 case "$1" in
 "fiu-ctrl")
-	BIN=../../utils/fiu-ctrl
+	BIN=$BASE/utils/fiu-ctrl
 	ARGS=
 	;;
 "fiu-ls")
-	BIN=../../utils/fiu-ls
+	BIN=$BASE/utils/fiu-ls
 	ARGS=
 	;;
 "fiu-run")
-	BIN=../../preload/run/fiu-run
-	ARGS="-l ./libs"
+	BIN=$BASE/preload/run/fiu-run
+	ARGS="-l $BASE/tests/utils/libs"
 	;;
 esac