system tests: ensure needed variables are always available 61/200561/3
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 26 Feb 2019 15:34:22 +0000 (16:34 +0100)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 27 Feb 2019 12:36:51 +0000 (13:36 +0100)
Change-Id: Ia4700100cfc849976dd7fa6c84b92b66f393d7d9

tests/system/utils/minicore-utils.sh

index 7100150..6e42d2f 100644 (file)
@@ -60,17 +60,12 @@ function tzplatform_var {
 }
 
 function clean_crash_dump {
-    export CRASH_DUMP_PATH=`tzplatform_var TZ_SYS_CRASH`
 
     killall crash-manager
     killall minicoredumper
 
     sleep 1
 
-    if [ -z ${CRASH_DUMP_PATH} ]; then
-        exit_with_code "Couldn't get TZ_SYS_CRASH or TZ_SYS_CRASH is empty" 1
-    fi
-
     if [ ! -d ${CRASH_DUMP_PATH} ]; then
         exit_with_code "${CRASH_DUMP_PATH} does not exist" 1
     fi
@@ -80,15 +75,9 @@ function clean_crash_dump {
 
 function clean_logdump {
 
-    export LOGDUMP_RESULT_PATH=`tzplatform_var TZ_SYS_CRASH_ROOT`/debug
-
     killall log_dump
     sleep 1
 
-    if [ "x${LOGDUMP_RESULT_PATH}" = 'x/debug' ]; then
-        exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1
-    fi
-
     if [ -d ${LOGDUMP_RESULT_PATH} ]; then
         rm -rf ${LOGDUMP_RESULT_PATH}/*
     fi
@@ -96,12 +85,6 @@ function clean_logdump {
 
 function clean_temp {
 
-    export CRASH_TEMP_PATH=`tzplatform_var TZ_SYS_CRASH_ROOT`/temp
-
-    if [ "x${CRASH_TEMP_PATH}" = 'x/temp' ]; then
-        exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1
-    fi
-
     if [ -d ${CRASH_TEMP_PATH} ]; then
         rm -rf ${CRASH_TEMP_PATH}/*
     fi
@@ -149,3 +132,23 @@ function untar_file {
     tar xf ${2}
     popd
 }
+
+function __export_vars__ {
+
+    export CRASH_TEMP_PATH=`tzplatform_var TZ_SYS_CRASH_ROOT`/temp
+    if [ "x${CRASH_TEMP_PATH}" = 'x/temp' ]; then
+        exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1
+    fi
+
+    export LOGDUMP_RESULT_PATH=`tzplatform_var TZ_SYS_CRASH_ROOT`/debug
+    if [ "x${LOGDUMP_RESULT_PATH}" = 'x/debug' ]; then
+        exit_with_code "Couldn't get TZ_SYS_CRASH_ROOT" 1
+    fi
+
+    export CRASH_DUMP_PATH=`tzplatform_var TZ_SYS_CRASH`
+    if [ -z ${CRASH_DUMP_PATH} ]; then
+        exit_with_code "Couldn't get TZ_SYS_CRASH or TZ_SYS_CRASH is empty" 1
+    fi
+}
+
+__export_vars__