summaryrefslogtreecommitdiffstats
path: root/run-test-docker.md
blob: 87b425cb03b3b68da31c5e4a8f54496c66efe389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Run OpenBMC Test Automation Using Docker

Running OpenBMC automation using Docker involves creating a Docker image and
then running automation tests inside the Docker container.


## Build Docker Image

`Note: Prerequisite is to have Docker installed.`

1. Create a workspace directory.

    `mkdir ${HOME}/OpenBMC_Automation`

2. Change directory to workspace created.

    `cd ${HOME}/OpenBMC_Automation`

3. Clone openbmc-build-scripts repository.

    `git clone https://github.com/openbmc/openbmc-build-scripts`

4. Change directory to openbmc-build-scripts.

    `cd openbmc-build-scripts`

5. Build the Docker image required to execute the robot tests (it may take
   close to 15 mins for the first time). The default Docker image name is
   "openbmc/ubuntu-robot-qemu". You can check images using "docker images"
   command.

    `./scripts/build-qemu-robot-docker.sh`


## Code update process using robot test code

1. Change directory to HOME workspace.

    `cd ${HOME}/OpenBMC_Automation`

2. Clone openbmc-test-automation repository.

    `git clone https://github.com/openbmc/openbmc-test-automation`

3. Execute docker run to initiate BMC code update.
    ######    *Note: Download BMC fw image file (*.all.tar) before executing this. BMC_IMG_PATH below points to this downloaded file.

    ```
    docker run --user root \
               --env HOME=${HOME} \
               --workdir ${HOME} \
               --volume ${HOME}/OpenBMC_Automation:${HOME} \
               --tty openbmc/ubuntu-robot-qemu python -m robot \
                   -v OPENBMC_HOST:<BMC IP> \
                   -v FILE_PATH:<BMC_IMG_PATH> \
                   -i Initiate_Code_Update_BMC \
                   ${HOME}/openbmc-test-automation/extended/code_update/update_bmc.robot
    ```

    Example to run BMC code update using witherspoon-20170614071422.all.tar
    image file from HOME directory of the system where docker run command
    is executed:

    ```
    docker run --user root \
               --env HOME=${HOME} \
               --workdir ${HOME} \
               --volume ${HOME}/OpenBMC_Automation:${HOME} \
               --tty openbmc/ubuntu-robot-qemu python -m robot \
                   -v OPENBMC_HOST:1.11.222.333 \
                   -v FILE_PATH:/home/witherspoon-20170614071422.all.tar \
                   -i Initiate_Code_Update_BMC \
                   ${HOME}/openbmc-test-automation/extended/code_update/update_bmc.robot
    ```

4. On code update completion, logs generated from robot framework execution
   will be available in the following location:

    ```
    ${HOME}/OpenBMC_Automation/log.html
    ${HOME}/OpenBMC_Automation/report.html
    ${HOME}/OpenBMC_Automation/output.xml
    ```


## Executing Automation Test

1. Execute docker run to execute OpenBMC automation test cases.
    ######    *Note: This runs a Docker container using openbmc/ubuntu-robot-qemu image.*
    ######    *Robot test code is extracted and ran on this container using run-robot.sh script.*
    ```
    docker run --user root \
               --env HOME=${HOME} \
               --env IP_ADDR=<BMC IP> \
               --env SSH_PORT=22 \
               --env HTTPS_PORT=443 \
               --env ROBOT_TEST_CMD="tox -e <System Type> -- <Robot Cmd>" \
               --workdir ${HOME} \
               --volume ${WORKSPACE}:${HOME} \
               --tty openbmc/ubuntu-robot-qemu \
                   ${HOME}/openbmc-build-scripts/scripts/run-robot.sh
    ```

    Example to run entire test suite:

    ```
    docker run --user root \
               --env HOME=${HOME} \
               --env IP_ADDR=1.11.222.333 \
               --env SSH_PORT=22 \
               --env HTTPS_PORT=443 \
               --env ROBOT_TEST_CMD="tox -e witherspoon -- tests" \
               --workdir ${HOME} \
               --volume ${HOME}/OpenBMC_Automation:${HOME}
               --tty openbmc/ubuntu-robot-qemu \
                   ${HOME}/openbmc-build-scripts/scripts/run-robot.sh
    ```

2. After the execution, test results will be available in below files.

    ```
    ${HOME}/OpenBMC_Automation/log.html
    ${HOME}/OpenBMC_Automation/report.html
    ${HOME}/OpenBMC_Automation/output.xml`
    ```
OpenPOWER on IntegriCloud