diff options
author | Thomas Abraham <thomas.abraham@arm.com> | 2019-03-01 11:16:07 +0530 |
---|---|---|
committer | Thomas Abraham <thomas.abraham@arm.com> | 2019-03-04 10:21:48 +0530 |
commit | 35a44f5af65a063944a0334bc8e89ad52929e4b6 (patch) | |
tree | bb32fe3378a63a90104f21cad1306b47324ecc0a | |
parent | e95add717c4e9ab364124dfd76d883a9f3a1c473 (diff) |
sgi/sgi_common_util: add helper functions to check for supported platforms
The sgi test scripts have replicated code that validates in the input
parameters with the list of platforms supported. This duplicated code
is now moved into a sgi common code as appropriate functions.
Change-Id: I0cc4ea8b6186adc1e3919f861f009caf09d36df1
Signed-off-by: Thomas Abraham <thomas.abraham@arm.com>
-rw-r--r-- | sgi/sgi_common_util.sh | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/sgi/sgi_common_util.sh b/sgi/sgi_common_util.sh index 2c24ef2..682b896 100644 --- a/sgi/sgi_common_util.sh +++ b/sgi/sgi_common_util.sh @@ -39,11 +39,60 @@ CURRENT_DATE_TIME=`date +%Y-%m-%d_%H.%M.%S` MYPID=$$ # UART Log files -UART0_ARMTF_OUTPUT_FILE_NAME=sgi-${MYPID}-uart-0-armtf_$CURRENT_DATE_TIME -UART1_MM_OUTPUT_FILE_NAME=sgi-${MYPID}-uart-1-mm_$CURRENT_DATE_TIME -UART0_CONSOLE_OUTPUT_FILE_NAME=sgi-${MYPID}-uart-0-console_$CURRENT_DATE_TIME -UART0_SCP_OUTPUT_FILE_NAME=sgi-${MYPID}-uart-0-scp_$CURRENT_DATE_TIME -UART0_MCP_OUTPUT_FILE_NAME=sgi-${MYPID}-uart-0-mcp_$CURRENT_DATE_TIME +UART0_ARMTF_OUTPUT_FILE_NAME=refinfra-${MYPID}-uart-0-armtf_$CURRENT_DATE_TIME +UART1_MM_OUTPUT_FILE_NAME=refinfra-${MYPID}-uart-1-mm_$CURRENT_DATE_TIME +UART0_CONSOLE_OUTPUT_FILE_NAME=refinfra-${MYPID}-uart-0-console_$CURRENT_DATE_TIME +UART0_SCP_OUTPUT_FILE_NAME=refinfra-${MYPID}-uart-0-scp_$CURRENT_DATE_TIME +UART0_MCP_OUTPUT_FILE_NAME=refinfra-${MYPID}-uart-0-mcp_$CURRENT_DATE_TIME + +if [ -z "$refinfra" ] ; then + refinfra="sgi" +fi + +__print_supported_platforms_sgi() +{ + echo "Supported platforms are -" + for plat in "${!platforms_sgi[@]}" ; + do + printf "\t $plat\n" + done + echo +} + +__print_supported_platforms_rdinfra() +{ + echo "Supported platforms are -" + for plat in "${!platforms_rdinfra[@]}" ; + do + printf "\t $plat\n" + done + echo +} + +__print_examples_sgi() +{ + __print_examples "sgi575" +} + +__print_examples_rdinfra() +{ + __print_examples "rdn1edge" +} + +__parse_params_validate() +{ + #Ensure that the platform is supported + if [ -z "$platform" ] ; then + print_usage + exit 1 + fi + if [ -z "${platforms_sgi[$platform]}" -a \ + -z "${platforms_rdinfra[$platform]}" ]; then + echo "[ERROR] Could not deduce which platform to execute on." + __print_supported_platforms_$refinfra + exit 1 + fi +} # search all the available network interfaces and find an available tap # network interface to use. |