[Fuego] [PATCH 1/4] LTP: add support for users to do some customizable configurations

Liu Wenlong liuwl.fnst at cn.fujitsu.com
Sun Mar 11 15:38:38 UTC 2018


Different tests needs different pre-configs on different distro.
Now, I added this feature which can flexibly help users to do
their own configurations before or after one test.

Signed-off-by: Liu Wenlong <liuwl.fnst at cn.fujitsu.com>
---
 engine/tests/Functional.LTP/fuego_test.sh | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/engine/tests/Functional.LTP/fuego_test.sh b/engine/tests/Functional.LTP/fuego_test.sh
index 1617974..2b01b5d 100755
--- a/engine/tests/Functional.LTP/fuego_test.sh
+++ b/engine/tests/Functional.LTP/fuego_test.sh
@@ -324,6 +324,19 @@ function test_deploy {
         done
     fi
 
+    # Generate script for test env setup.
+    # Uses can write their own script to configure the test env before testing, and
+    # they can restore test env after testing.
+    # This script can be specified in "test_operation" of spec.json file.
+    echo "# setup test environment." > ${LOGDIR}/set_env.sh
+    if [ -n "${FUNCTIONAL_LTP_TEST_OPERATION}" ]; then
+        if [ -f "$FUNCTIONAL_LTP_TEST_OPERATION" ]; then
+            cat "$FUNCTIONAL_LTP_TEST_OPERATION" >> ${LOGDIR}/set_env.sh
+        else
+            echo "$FUNCTIONAL_LTP_TEST_OPERATION" >> ${LOGDIR}/set_env.sh
+        fi
+    fi
+
     # make a staging area
     cp -r target_bin ltp
     cp ${LOGDIR}/skiplist.txt ltp
@@ -336,6 +349,9 @@ function test_deploy {
             echo "Removing syscalls binaries"
             awk '/^[^#]/ { print "rm -f ltp/testcases/bin/" $2 }' ltp/runtest/syscalls | sh
         fi
+
+        cp ${LOGDIR}/set_env.sh ltp
+
         put ltp/* $LTP_DESTDIR
     else
         echo "Skipping LTP deploy to board"
@@ -353,10 +369,11 @@ function test_deploy {
 
     # pre-installed LTP needs a few fuego-specific items
     if [ -n "$FUNCTIONAL_LTP_HOMEDIR" ] ; then
-       cmd "mkdir -p $FUNCTIONAL_LTP_HOMEDIR/testcases/realtime/scripts"
-       put testcases/realtime/scripts/setenv.sh $FUNCTIONAL_LTP_HOMEDIR/testcases/realtime/scripts
-       put $TEST_HOME/ltp_target_run.sh $FUNCTIONAL_LTP_HOMEDIR
-       put ${LOGDIR}/skiplist.txt $FUNCTIONAL_LTP_HOMEDIR
+        cmd "mkdir -p $FUNCTIONAL_LTP_HOMEDIR/testcases/realtime/scripts"
+        put testcases/realtime/scripts/setenv.sh $FUNCTIONAL_LTP_HOMEDIR/testcases/realtime/scripts
+        put $TEST_HOME/ltp_target_run.sh $FUNCTIONAL_LTP_HOMEDIR
+        put ${LOGDIR}/skiplist.txt $FUNCTIONAL_LTP_HOMEDIR
+        put ${LOGDIR}/set_env.sh $FUNCTIONAL_LTP_HOMEDIR
     fi
 }
 
-- 
2.7.4





More information about the Fuego mailing list