2 # SPDX-License-Identifier: GPL-2.0-only
4 MMA_LOCAL_DATA_STORAGE
=/usr
/local
/mma
6 # format of MMA_AUTOMATED_TEST_CONFIG file is as below
7 # with 1 or more repeated lines with same format
9 # <testname> <testparam> <#times to run this test>
12 # RMT.efi RMTConfig.bin 2
13 # Margin1D.efi Margin1DCmdAllConfig.bin 1
16 MMA_AUTOMATED_TEST_CONFIG
="${MMA_LOCAL_DATA_STORAGE}"/tests
17 MMA_AUTOMATED_TEST_COUNT
="${MMA_LOCAL_DATA_STORAGE}"/count
18 MMA_SETUP_TEST_TOOL
=mma_setup_test.sh
19 MMA_GET_RESULT_TOOL
=mma_get_result.sh
20 MMA_TEST_RESULTS_PATH
="${MMA_LOCAL_DATA_STORAGE}/results$(date +_%y_%m_%d_%H_%M)"
21 # Clear MMA_TEST_NUMBER just in case it is set in environment
24 # Set a number of global params based on test number
25 # MMA_TEST_NUMBER - test number, stored in MMA_AUTOMATED_TEST_COUNT
26 # MMA_TEST_NAME - test name
27 # MMA_TEST_PARAM - test parameter
28 # MMA_TEST_COUNT - test count, number of times to run the test
29 # MMA_TEST_RESULT_NAME - filename for result
30 get_mma_autotest_params
() {
31 typeset
-i i
=${MMA_TEST_NUMBER}
32 exec 9< "${MMA_AUTOMATED_TEST_CONFIG}"
33 while read -u9 MMA_TEST_NAME MMA_TEST_PARAM MMA_TEST_COUNT
35 case "${MMA_TEST_NAME}" in
36 ("#"*|
"") continue;; # Allow blank lines and comments
38 : $
(( i
-= MMA_TEST_COUNT
))
39 if (( i
<= 0 )) ; then
40 printf -v MMA_TEST_RESULT_NAME \
41 "${MMA_TEST_NAME%.efi}_${MMA_TEST_PARAM%.bin}_%d.bin" \
46 ${MMA_SETUP_TEST_TOOL} reset
47 rm "${MMA_AUTOMATED_TEST_COUNT}"
48 mv "${MMA_AUTOMATED_TEST_CONFIG}" "${MMA_TEST_RESULTS_PATH}"
53 # sleep 30 sec, before we start. This would give some time if we want
56 mkdir
-p "${MMA_LOCAL_DATA_STORAGE}"
57 # Exit if there are no tests
58 [ -e "${MMA_AUTOMATED_TEST_CONFIG}" ] ||
exit 0
60 if [ -e "${MMA_AUTOMATED_TEST_COUNT}" ] ; then
61 .
"${MMA_AUTOMATED_TEST_COUNT}"
64 mkdir
-p "${MMA_TEST_RESULTS_PATH}"
66 if [ "${MMA_TEST_NUMBER}" ] ; then
67 get_mma_autotest_params
68 ${MMA_GET_RESULT_TOOL} \
69 "${MMA_TEST_RESULTS_PATH}"/"${MMA_TEST_RESULT_NAME}"
72 : $
(( MMA_TEST_NUMBER
+= 1 ))
73 printf "MMA_TEST_NUMBER=${MMA_TEST_NUMBER}\n" \
74 > "${MMA_AUTOMATED_TEST_COUNT}"
75 printf "MMA_TEST_RESULTS_PATH=%s" "${MMA_TEST_RESULTS_PATH}" \
76 >> "${MMA_AUTOMATED_TEST_COUNT}"
77 get_mma_autotest_params
78 ${MMA_SETUP_TEST_TOOL} set ${MMA_TEST_NAME} ${MMA_TEST_PARAM}
80 # sync the filesystem, hoping this would minimize
81 # the chances of fs corruption