declare -gA fct_table=(['Test 1']="do_test1"
['Test 2']="do_test2"
['Test 3']="do_test3"
['Test 4']="do_empty_handler"
['Test 5']="do_empty_handler"
['Test6']="do_empty_handler"
)
declare -gA res_table=(['Test 1']="N/A"
['Test 2']="N/A"
['Test 3']="N/A"
['Test 4']="N/A"
['Test 5']="N/A"
['Test 6']="N/A"
)
function do_empty_handler()
{
echo "Test Not Implemented: $1"
return 2
}
function do_test1
{
echo "Test 1"
ret=0
return $ret
}
function do_test2
{
echo "Test 2"
ret=0
return $ret
}
function do_test3
{
echo "Test 1"
ret=0
return $ret
}
function validate_system()
{
for i in "${!fct_table[@]}"; do
echo "Test : $i"
${fct_table[$i]}
res=$?
__update_result_table $res "$i" res_table
done
}
# Main entry point
validate_system
print_result
wwd@think:~/Desktop$ ./board_test.sh
Test : Test 1
Test 1
>>>>> SUCCESS
Test : Test 3
Test 1
>>>>> SUCCESS
Test : Test 2
Test 2
>>>>> SUCCESS
Test : Test 5
Test Not Implemented:
>>>>> N/A
Test : Test 4
Test Not Implemented:
>>>>> N/A
Test : Test6
Test Not Implemented:
>>>>> N/A
TEST RESULTS:
============
Test: Test 1 Result: PASS
Test: Test 3 Result: PASS
Test: Test 2 Result: PASS
Test: Test 5 Result: N/A
Test: Test 4 Result: N/A
Test: Test 6 Result: N/A
Test: Test6 Result: N/A
往期推荐:
废旧板子再利用:搭建无线调试环境!
分享嵌入式软件调试方法及几个有用的工具!
手把手教你使用VSCode + gdb + gdbserver调试ARM程序
嵌入式大杂烩周记 | 第 9 期
嵌入式段错误的3种调试方法汇总!
写国际化的嵌入式代码,时间问题如何处理?
在公众号聊天界面回复1024,可获取嵌入式资源;回复 m ,可查看文章汇总。