已开启
update translation for \mugen\README.md at c4520a2 #43
AtomGit-Bot创建于 2022年5月23日
update translation for \mugen\README.md at c4520a2 #43
已开启
从refs/pull/43/head合入到master
共 1 个文件变更+171-0
| @@ -0,0 +1,171 @@ | |||
| 1 | +# mugen | ||
| 2 | + | ||
| 3 | +## mugen Introduction | ||
| 4 | + | ||
| 5 | +mugen is an open test framework in the openEuler community. It provides public configurations and methods for community developers to compile and execute test code. | ||
| 6 | + | ||
| 7 | +## mugen Use Guide | ||
| 8 | + | ||
| 9 | +Run the **mugen.sh** script to use the mugen framework. You can still use the **runoet.sh** script, which is available in the repository. The script is described as follows: | ||
| 10 | + | ||
| 11 | +- Parameters | ||
| 12 | +\-c: Sets the test environment. | ||
| 13 | +\-d: Downloads open source test scripts of the openEuler community. | ||
| 14 | +\-a: Executes all test cases. | ||
| 15 | +\-f: Runs a specified test suite. | ||
| 16 | +\-r: Executes a test case in a specified test suite. Currently, only one test case can be specified. | ||
W | |||
| 17 | +\-C: Does not check the mapping between test cases and test suites. | ||
| 18 | +\-x: Runs the test cases in debugging mode. | ||
| 19 | + | ||
| 20 | +- Command Examples | ||
| 21 | + - Configuring test environment. | ||
| 22 | + `bash mugen.sh -c $ip $user $password` | ||
| 23 | + - Downloading open source test scripts of the openEuler community. | ||
| 24 | + `bash mugen.sh -d` | ||
| 25 | + - Running all test cases. | ||
| 26 | + - Normal mode: | ||
| 27 | + `bash mugen.sh -a` | ||
| 28 | + - Debugging mode: | ||
| 29 | + `bash mugen.sh -xa` | ||
| 30 | + - Running all test cases in a specified test suite. | ||
| 31 | + - Normal mode: | ||
| 32 | + `bash mugen.sh -f "xxx"` | ||
| 33 | + - Debugging mode: | ||
| 34 | + `bash mugen.sh -xf "xxx"` | ||
| 35 | + - Running a specified test case. | ||
| 36 | + - Normal mode: | ||
| 37 | + `bash mugen.sh -f "xxx" -r "yyy"` | ||
| 38 | + - Normal mode without checking the mapping file: | ||
| 39 | + `bash mugen.sh -f "xxx" -Cr "yyy"` | ||
| 40 | + - Debugging mode: | ||
| 41 | + `bash mugen.sh -xf "xxx" -r "yyy"` | ||
| 42 | + - Debugging mode without checking the mapping file: | ||
| 43 | + `bash mugen.sh -xf "xxx" -Cr "yyy"` | ||
| 44 | + | ||
| 45 | +- Usage Instructions | ||
| 46 | + - Environment variables must be configured before executing the test cases. | ||
| 47 | + - All test cases are stored in the **testcases** directory. | ||
| 48 | + - The mapping between test suites and test cases must be defined in a file in the **suite2cases** directory. | ||
| 49 | + - <font color="#660000">You can develop more test cases based on existing test templates.</font> | ||
| 50 | + | ||
| 51 | +- Framework Directory Layout | ||
| 52 | + ``` | ||
| 53 | + . | ||
| 54 | + ├─ libs | ||
| 55 | + │ └─ locallibs | ||
| 56 | + │ ├─ common_lib.sh | ||
| 57 | + │ ├─ sshcmd.sh | ||
| 58 | + │ └─ sshscp.sh | ||
| 59 | + ├─ runoet.sh -> mugen.sh | ||
| 60 | + ├─ suite2cases | ||
| 61 | + │ └─ testsuite | ||
| 62 | + ├─ testcases | ||
| 63 | + │ └─ testsuite | ||
| 64 | + │ ├─ oe_test_casename_01 | ||
| 65 | + │ │ └─ oe_test_casename_01.sh | ||
| 66 | + │ ├─ oe_test_casename_02 | ||
| 67 | + │ │ └─ oe_test_casename_02.py | ||
| 68 | + │ └─ oe_test_casename_03.sh | ||
| 69 | + ├─ README.md | ||
| 70 | + └─ mugen.sh | ||
| 71 | + ``` | ||
| 72 | + | ||
| 73 | +- Environment variables generated by mugen | ||
| 74 | + - Configuration file path: | ||
| 75 | + - If **/etc/mugen/** does not exist, the path will be **${OET_PATH}/conf**. | ||
| 76 | + - Configuration file content: | ||
| 77 | + - NODE: test environment node. | ||
| 78 | + - LOCATION: whether the test environment is local or remote. | ||
| 79 | + - USER: user on the test environment node. | ||
| 80 | + - PASSWORD: password of the user on the test environment node. | ||
| 81 | + - MACHINE: whether the host is a virtual or physical machine. | ||
| 82 | + - FRAME: system architecture. | ||
| 83 | + - NICS: NIC names, which is an array. | ||
| 84 | + - MAC: NIC MAC addresses, which is an array. | ||
| 85 | + - IPV4: IPv4 addresses, which is an array. | ||
| 86 | + - IPV6: IPv6 addresses, which is an array. | ||
| 87 | + - Environment variables: | ||
| 88 | + - NODE1_LOCATION, NODE2_LOCATION | ||
| 89 | + - NODE1_USER, NODE2_USER | ||
| 90 | + - NODE1_PASSWORD, NODE2_PASSWORD | ||
| 91 | + - NODE1_MACHINE, NODE2_MACHINE | ||
| 92 | + - NODE1_FRAME, NODE2_FRAME | ||
| 93 | + - NODE1_NICS, NODE2_NICS | ||
| 94 | + - NODE1_MAC, NODE2_MAC | ||
| 95 | + - NODE1_IPV4, NODE2_IPV4 | ||
| 96 | + - NODE1_IPV6, NODE2_IPV6 | ||
| 97 | + - <font color="#660000">Note: You can define global variables in **env.conf** as required.</font> | ||
| 98 | + | ||
| 99 | +## Global shell functions of mugen | ||
| 100 | + | ||
| 101 | +- SSH_CMD | ||
| 102 | + - Encapsulates SSH so that you can run remote commands in non-interactive mode. | ||
| 103 | + - Usage | ||
| 104 | + `SSH_CMD "$cmd" $REMOTEIP $REMOTEPASSWD $REMOTEUSER` | ||
| 105 | + | ||
| 106 | +- SSH_SCP | ||
| 107 | + - Encapsulates SCP so that you can run SCP commands in non-interactive mode. | ||
| 108 | + - Usage: | ||
| 109 | + - Transferring a local file to a remote server. | ||
| 110 | + `SSH_SCP $local_path/$file $REMOTE_USER@$REMOTE_IP:$remote_path "$REMOTE_PASSWD"` | ||
| 111 | + - Transferring a remote file to the local host. | ||
| 112 | + `SSH_SCP $REMOTE_USER@$REMOTE_IP:$remote_path/$file $local_path "$REMOTE_PASSWD"` | ||
| 113 | + | ||
| 114 | +- LOG_INFO | ||
| 115 | + - Outputs logs of the INFO level | ||
| 116 | + `LOG_INFO $log` | ||
| 117 | + | ||
| 118 | +- LOG_WARN | ||
| 119 | + - Outputs logs of the WARN level | ||
| 120 | + `LOG_WARN $log` | ||
| 121 | + | ||
| 122 | +- LOG_ERROR | ||
| 123 | + - Outputs logs of the ERROR level | ||
| 124 | + `LOG_WARN $log` | ||
| 125 | + | ||
| 126 | +- DNF_INSTALL | ||
| 127 | + - Installs software packages. | ||
| 128 | + `DNF_INSTALL "vim bc nettools"` | ||
| 129 | + - Note: It is recommended that all required software packages be installed at a time during the preparation phase. | ||
| 130 | + | ||
| 131 | +- DNF_REMOVE | ||
| 132 | + - Uninstalls software packages. | ||
| 133 | + - Note: This function depends on `DNF_INSTALL` by default. To ensure the environment is restored, all packages installed by `DNF_INSTALL` are uninstalled. | ||
| 134 | + `DNF_REMOVE` | ||
| 135 | + - If you want to uninstall a software package independently, add the **1** parameter when using this function. | ||
| 136 | + `DNF_REMOVE "tree" 1` | ||
| 137 | + | ||
| 138 | +- REMOTE_REBOOT_WAIT | ||
| 139 | + - Reboots remote servers in a multi-node environment, and waits for the remote servers to complete restart. | ||
| 140 | + `REMOTE_REBOOT_WAIT $REMOTEPASSWD $REMOTEUSER $REMOTEIP` | ||
| 141 | + | ||
| 142 | +- SLEEP_WAIT | ||
| 143 | + - Use this function instead of the `sleep` command when you want to delay for more than 1 second. | ||
| 144 | + `SLEEP_WAIT 3` | ||
| 145 | + | ||
| 146 | +- CHECK_RESULT | ||
| 147 | + - Checks the test items. The mugen framework collects statistics on the execution results. Use this function to check the results. | ||
| 148 | + - Parameters: | ||
| 149 | + - Parameter 1: actual result. | ||
| 150 | + - Parameter 2: expected result. The default value is **0**. | ||
| 151 | + - Parameter 3: determination mode. The default value **0** indicates that the actual result must be the same as the expected result. The value **1** indicates that the actual result must be different from the expected result. | ||
| 152 | + `CHECK_RESULT 0 0` | ||
| 153 | + | ||
| 154 | +- GET_RANDOM_PORT | ||
| 155 | + - Obtains a random port number that is not in use. | ||
| 156 | + - Parameters: | ||
| 157 | + - Parameter 1: start value of the random port number range. The default value is 1. | ||
| 158 | + - Parameter 2: end value of the random port number range. The default value is 10000. | ||
| 159 | + `GET_RANDOM_PORT 1 10000` | ||
| 160 | + | ||
| 161 | +## Global Python functions of the mugen framework | ||
| 162 | + | ||
| 163 | +- Coming soon. | ||
| 164 | + | ||
| 165 | +## About mugen Logs | ||
| 166 | + | ||
| 167 | +After all test cases are executed: | ||
| 168 | + | ||
| 169 | +- Logs are saved to the **logs** directory in the same directory as **runoet.sh**. | ||
| 170 | +- The execution results are saved to the **results** directory in the same directory as **runoet.sh**. | ||
| 171 | +- The **logs** and **results** directories are automatically generated after a test case is executed. | ||
Executes 这个地方需要加s吗,可以参考其他的--help 其他英文都关注一下