blob: 87b425cb03b3b68da31c5e4a8f54496c66efe389 [file] [log] [blame]
Rahul Maheshwaric6387832017-06-08 07:02:53 -05001# Run OpenBMC Test Automation Using Docker
2
3Running OpenBMC automation using Docker involves creating a Docker image and
4then running automation tests inside the Docker container.
5
6
7## Build Docker Image
8
9`Note: Prerequisite is to have Docker installed.`
10
111. Create a workspace directory.
12
13 `mkdir ${HOME}/OpenBMC_Automation`
14
152. Change directory to workspace created.
16
17 `cd ${HOME}/OpenBMC_Automation`
18
193. Clone openbmc-build-scripts repository.
20
21 `git clone https://github.com/openbmc/openbmc-build-scripts`
22
234. Change directory to openbmc-build-scripts.
24
25 `cd openbmc-build-scripts`
26
275. Build the Docker image required to execute the robot tests (it may take
28 close to 15 mins for the first time). The default Docker image name is
29 "openbmc/ubuntu-robot-qemu". You can check images using "docker images"
30 command.
31
32 `./scripts/build-qemu-robot-docker.sh`
33
34
35## Code update process using robot test code
36
371. Change directory to HOME workspace.
38
39 `cd ${HOME}/OpenBMC_Automation`
40
412. Clone openbmc-test-automation repository.
42
43 `git clone https://github.com/openbmc/openbmc-test-automation`
44
453. Execute docker run to initiate BMC code update.
46 ###### *Note: Download BMC fw image file (*.all.tar) before executing this. BMC_IMG_PATH below points to this downloaded file.
47
48 ```
49 docker run --user root \
50 --env HOME=${HOME} \
51 --workdir ${HOME} \
52 --volume ${HOME}/OpenBMC_Automation:${HOME} \
53 --tty openbmc/ubuntu-robot-qemu python -m robot \
54 -v OPENBMC_HOST:<BMC IP> \
55 -v FILE_PATH:<BMC_IMG_PATH> \
56 -i Initiate_Code_Update_BMC \
57 ${HOME}/openbmc-test-automation/extended/code_update/update_bmc.robot
58 ```
59
60 Example to run BMC code update using witherspoon-20170614071422.all.tar
61 image file from HOME directory of the system where docker run command
62 is executed:
63
64 ```
65 docker run --user root \
66 --env HOME=${HOME} \
67 --workdir ${HOME} \
68 --volume ${HOME}/OpenBMC_Automation:${HOME} \
69 --tty openbmc/ubuntu-robot-qemu python -m robot \
70 -v OPENBMC_HOST:1.11.222.333 \
71 -v FILE_PATH:/home/witherspoon-20170614071422.all.tar \
72 -i Initiate_Code_Update_BMC \
73 ${HOME}/openbmc-test-automation/extended/code_update/update_bmc.robot
74 ```
75
764. On code update completion, logs generated from robot framework execution
77 will be available in the following location:
78
79 ```
80 ${HOME}/OpenBMC_Automation/log.html
81 ${HOME}/OpenBMC_Automation/report.html
82 ${HOME}/OpenBMC_Automation/output.xml
83 ```
84
85
86## Executing Automation Test
87
881. Execute docker run to execute OpenBMC automation test cases.
89 ###### *Note: This runs a Docker container using openbmc/ubuntu-robot-qemu image.*
90 ###### *Robot test code is extracted and ran on this container using run-robot.sh script.*
91 ```
92 docker run --user root \
93 --env HOME=${HOME} \
94 --env IP_ADDR=<BMC IP> \
95 --env SSH_PORT=22 \
96 --env HTTPS_PORT=443 \
97 --env ROBOT_TEST_CMD="tox -e <System Type> -- <Robot Cmd>" \
98 --workdir ${HOME} \
99 --volume ${WORKSPACE}:${HOME} \
100 --tty openbmc/ubuntu-robot-qemu \
101 ${HOME}/openbmc-build-scripts/scripts/run-robot.sh
102 ```
103
104 Example to run entire test suite:
105
106 ```
107 docker run --user root \
108 --env HOME=${HOME} \
109 --env IP_ADDR=1.11.222.333 \
110 --env SSH_PORT=22 \
111 --env HTTPS_PORT=443 \
112 --env ROBOT_TEST_CMD="tox -e witherspoon -- tests" \
113 --workdir ${HOME} \
114 --volume ${HOME}/OpenBMC_Automation:${HOME}
115 --tty openbmc/ubuntu-robot-qemu \
116 ${HOME}/openbmc-build-scripts/scripts/run-robot.sh
117 ```
118
1192. After the execution, test results will be available in below files.
120
121 ```
122 ${HOME}/OpenBMC_Automation/log.html
123 ${HOME}/OpenBMC_Automation/report.html
124 ${HOME}/OpenBMC_Automation/output.xml`
125 ```