From f72a88921d923e414f2fecfdf923f37e31e6da64 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Wed, 22 Jun 2016 18:21:41 +0100
Subject: [PATCH] apparmor-tumbler: allow running from the source tree

We need the compiled LD_PRELOAD hack from the installed tree, but
the rest can come from the source, allowing for quicker test/fix
cycles.

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D3477
---
 apparmor/tumbler/test-tumbler | 2 +-
 apparmor/tumbler/tumbler      | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/apparmor/tumbler/test-tumbler b/apparmor/tumbler/test-tumbler
index 509eacf..84df897 100755
--- a/apparmor/tumbler/test-tumbler
+++ b/apparmor/tumbler/test-tumbler
@@ -1,7 +1,7 @@
 #!/bin/bash
 # vim: tw=0
 
-TEST_DIR="${TEST_DIR:-/usr/lib/apertis-tests/apparmor/tumbler}"
+TEST_DIR=$(cd $(dirname $0); pwd; cd - &>/dev/null)
 # We want to use the pre-existing session bus.
 export LAUNCH_DBUS="no"
 
diff --git a/apparmor/tumbler/tumbler b/apparmor/tumbler/tumbler
index 672ab36..bd68b1f 100755
--- a/apparmor/tumbler/tumbler
+++ b/apparmor/tumbler/tumbler
@@ -10,10 +10,12 @@ fi
 
 export APERTIS_TESTS_NAME_PREFIX="${1}_"
 
+TEST_DIR=$(cd $(dirname $0); pwd; cd - &>/dev/null)
+
 if [[ $1 == "malicious" ]]; then
     LD_PRELOAD="/usr/lib/apertis-tests/apparmor/tumbler/libtumbler-malicious-override.so" \
-    /usr/share/chaiwala-tests/tumbler/automated/run-test.sh
+    $TEST_DIR/../../tumbler/automated/run-test.sh
 else
-    /usr/share/chaiwala-tests/tumbler/automated/run-test.sh
+    $TEST_DIR/../../tumbler/automated/run-test.sh
 fi
 
-- 
GitLab