[5/6] realtime: only build tests if needed

Message ID 1375729379-16469-6-git-send-email-anders.roxell@linaro.org
State Accepted
Commit 45929dc05359ecedc481fbbdabb05d7d4c0082df
Headers show

Commit Message

Anders Roxell Aug. 5, 2013, 7:02 p.m.
stand alone run scripts can not build from the installed directory.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 testcases/realtime/run.sh                 |   16 ++++++++++------
 testcases/realtime/scripts/run_c_files.sh |    7 +++++--
 testscripts/test_realtime.sh              |   16 ++++++++++------
 3 files changed, 25 insertions(+), 14 deletions(-)

Patch

diff --git a/testcases/realtime/run.sh b/testcases/realtime/run.sh
index 77e8d68..a66e4e5 100755
--- a/testcases/realtime/run.sh
+++ b/testcases/realtime/run.sh
@@ -185,12 +185,16 @@  if [ $# -lt 1 ]; then
 fi
 pushd $TESTS_DIR >/dev/null
 
-#Only build the library, most of the tests depend upon.
-#The Individual tests will be built, just before they run.
-pushd lib
-make
-check_error make
-popd
+# if INSTALL_DIR != top_srcdir assume the individual tests are built and installed.
+# So no need to build lib
+if [[ -d lib ]]; then
+    #Only build the library, most of the tests depend upon.
+    #The Individual tests will be built, just before they run.
+    pushd lib
+    make
+    check_error make
+    popd
+fi
 
 ISLOOP=0
 index=0
diff --git a/testcases/realtime/scripts/run_c_files.sh b/testcases/realtime/scripts/run_c_files.sh
index 3ab52ec..6e73f38 100755
--- a/testcases/realtime/scripts/run_c_files.sh
+++ b/testcases/realtime/scripts/run_c_files.sh
@@ -20,8 +20,11 @@  profile_path=$PROFILES_DIR/$profile
 # Does profile exist?
 [ ! -f "$profile_path" ] && { echo >&2 "$0: Could not find profile ($profile_path)" ; exit 1 ; }
 
-# Compile the test cases to support stand alone runs.
-make
+# if INSTALL_DIR != top_srcdir assume the individual tests are built and installed.
+if [[ -f Makefile ]]; then
+    # Compile the test cases to support stand alone runs.
+    make
+fi
 
 
 # Run the test case
diff --git a/testscripts/test_realtime.sh b/testscripts/test_realtime.sh
index 22c3692..ad5075f 100755
--- a/testscripts/test_realtime.sh
+++ b/testscripts/test_realtime.sh
@@ -176,12 +176,16 @@  if [ ! -e "logs" ]; then
         chmod -R 775 logs
 fi
 
-#Only build the library, most of the tests depend upon.
-#The Individual tests will be built, just before they run.
-pushd lib
-make
-check_error make
-popd
+# if INSTALL_DIR != top_srcdir assume the individual tests are built and installed.
+# So no need to build lib
+if [[ -d lib ]]; then
+    #Only build the library, most of the tests depend upon.
+    #The Individual tests will be built, just before they run.
+    pushd lib
+    make
+    check_error make
+    popd
+fi
 
 ISLOOP=0
 index=0