[mutter/gbsneto/installed-tests: 3/6] cogl/tests: Use tmp file to dump test results



commit 05ab8eebe8f37d437fb915a2dafe0c0bb68e3950
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Dec 17 13:12:29 2018 -0200

    cogl/tests: Use tmp file to dump test results
    
    When running installed tests, the working directory for Cogl
    tests is /usr/libexec/installed-tests/mutter-cogl-4/conform,
    which isn't writable by normal users.
    
    To avoid the adding stray hidden files to the current directory,
    adapt the runner script to fallback to $(mktemp) - which is
    available on all platform we care about - and avoid adding
    hidden files everywhere.

 cogl/tests/run-tests.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/cogl/tests/run-tests.sh b/cogl/tests/run-tests.sh
index 6934bccd6..7caa2bcb3 100755
--- a/cogl/tests/run-tests.sh
+++ b/cogl/tests/run-tests.sh
@@ -21,6 +21,8 @@ shift
 
 set +m
 
+LOG=$(mktemp)
+
 trap "" ERR
 trap "" SIGABRT
 trap "" SIGFPE
@@ -65,17 +67,17 @@ get_status()
 
 run_test()
 {
-  $("$TEST_BINARY" "$1" &>.log)
+  $("$TEST_BINARY" "$1" &> "$LOG")
   TMP=$?
   var_name=$2_result
   eval "$var_name=$TMP"
-  if grep -q "$MISSING_FEATURE" .log; then
+  if grep -q "$MISSING_FEATURE" "$LOG"; then
     if test "$TMP" -ne 0; then
       eval "$var_name=500"
     else
       eval "$var_name=400"
     fi
-  elif grep -q "$KNOWN_FAILURE" .log; then
+  elif grep -q "$KNOWN_FAILURE" "$LOG"; then
     if test $TMP -ne 0; then
       eval "$var_name=300"
     else
@@ -156,4 +158,6 @@ do
   echo ""
 done
 
+rm "$LOG"
+
 exit "$EXIT"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]