| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 |  | 
| Gunnar Mills | 917ba1a | 2018-04-08 16:42:12 -0500 | [diff] [blame] | 3 | # This program will generate test documentation from the robot test cases. | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 4 |  | 
 | 5 | # Description of argument(s): | 
 | 6 | # test_dir_path            Test directory where robot test cases are available. | 
 | 7 | # test_case_doc_file_path  The test case document file path to be stored. | 
 | 8 |  | 
 | 9 |  | 
| Patrick Williams | 90dfee3 | 2022-12-08 06:52:46 -0600 | [diff] [blame] | 10 | function get_parms() { | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 11 |  | 
| Patrick Williams | 90dfee3 | 2022-12-08 06:52:46 -0600 | [diff] [blame] | 12 |     # Get program parms. | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 13 |  | 
| Patrick Williams | 90dfee3 | 2022-12-08 06:52:46 -0600 | [diff] [blame] | 14 |     test_dir_path="${1}" ; shift | 
 | 15 |     test_case_doc_file_path="${1}" ; shift | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 16 |  | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 17 |     return 0 | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 18 |  | 
| Patrick Williams | 90dfee3 | 2022-12-08 06:52:46 -0600 | [diff] [blame] | 19 | } | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 20 |  | 
| Patrick Williams | 90dfee3 | 2022-12-08 06:52:46 -0600 | [diff] [blame] | 21 |  | 
 | 22 | function validate_parms() { | 
 | 23 |  | 
 | 24 |     # Validate program parameters. | 
 | 25 |  | 
 | 26 |     num_parms="${1}" ; shift | 
 | 27 |  | 
 | 28 |     (( ${num_parms} == 0 )) && return 0 | 
 | 29 |  | 
 | 30 |     if [ -z "${test_dir_path}" ] ; then | 
 | 31 |         echo "**ERROR** You must provide test directory as the first positional" \ | 
 | 32 |             "parameter." >&2 | 
 | 33 |         return 1 | 
 | 34 |     fi | 
 | 35 |  | 
 | 36 |     if [ -z "${test_case_doc_file_path}" ] ; then | 
 | 37 |         echo "**ERROR** You must provide file path as the second positional" \ | 
 | 38 |             "parameter." >&2 | 
 | 39 |         return 1 | 
 | 40 |     fi | 
 | 41 |  | 
 | 42 |     return 0 | 
 | 43 |  | 
 | 44 | } | 
 | 45 |  | 
 | 46 |  | 
 | 47 | function generate_all_test_document() { | 
 | 48 |  | 
 | 49 |     # Generate all test case documents | 
 | 50 |  | 
 | 51 |     local ret_code=0 | 
 | 52 |     python -m robot.testdoc tests testsdirectoryTCdocs.html || ret_code=1 | 
 | 53 |     python -m robot.testdoc extended extendeddirectoryTCdocs.html || ret_code=1 | 
 | 54 |     python -m robot.testdoc gui guidirectoryTCdocs.html || ret_code=1 | 
 | 55 |     python -m robot.testdoc systest systestdirectoryTCdocs.html || ret_code=1 | 
 | 56 |     python -m robot.testdoc xcat xcatdirectoryTCdocs.html || ret_code=1 | 
 | 57 |     python -m robot.testdoc mnfg mnfgdirectoryTCdocs.html || ret_code=1 | 
 | 58 |     python -m robot.testdoc tools toolsdirectoryTCdocs.html || ret_code=1 | 
 | 59 |     python -m robot.testdoc ./openpower/ras rasdirectoryTCdocs.html || ret_code=1 | 
 | 60 |     python -m robot.testdoc ./openpower/secureboot securebootdirectoryTCdocs.html\ | 
 | 61 |         || ret_code=1 | 
 | 62 |     python -m robot.testdoc network networkdirectoryTCdocs.html ||\ | 
 | 63 |         ret_code=1 | 
 | 64 |  | 
 | 65 |     return ${ret_code} | 
 | 66 | } | 
 | 67 |  | 
 | 68 |  | 
 | 69 | function main_function() { | 
 | 70 |  | 
 | 71 |     get_parms "$@" || return 1 | 
 | 72 |  | 
 | 73 |     validate_parms $# || return 1 | 
 | 74 |  | 
 | 75 |     if (( ${num_parms} == 0 )) ; then | 
 | 76 |         generate_all_test_document || return 1 | 
 | 77 |         return 0 | 
 | 78 |     fi | 
 | 79 |  | 
 | 80 |     echo ${test_dir_path} ${test_case_doc_file_path} | 
 | 81 |     python -m robot.testdoc ${test_dir_path} ${test_case_doc_file_path}\ | 
 | 82 |         || return 1 | 
 | 83 |  | 
 | 84 |     return 0 | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 85 |  | 
 | 86 | } | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 87 |  | 
 | 88 |  | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 89 | # Main | 
 | 90 |  | 
| Patrick Williams | 90dfee3 | 2022-12-08 06:52:46 -0600 | [diff] [blame] | 91 | main_function "${@}" | 
 | 92 | rc="${?}" | 
 | 93 | exit "${rc}" | 
| Sivas SRR | 4470957 | 2017-04-28 07:16:46 -0500 | [diff] [blame] | 94 |  |