Separate run_tox and make_report tasks

Change-Id: Ic064cdaa2b001358f3748b433baa1f9055db940a
This commit is contained in:
Federico Ressi 2020-03-23 15:33:55 +01:00
parent 617e44e8ed
commit 5a41476432
3 changed files with 38 additions and 21 deletions

View File

@ -2,11 +2,13 @@
# Directory where test cases has been deployed to
tox_dir: '{{ test_dir | realpath }}'
tox_command: "tox"
tox_command: tox
tox_environment: {}
tox_envlist: py36
tox_extra_args: ''
tox_command_line: '{{ tox_command }} "-e{{ tox_envlist }}" {{ tox_extra_args }}'
tox_report_dir: "{{ test_report_dir | realpath }}"
tox_report_dir: '{{ test_report_dir | realpath }}'
tox_report_name: '{{ test_report_name }}_{{ tox_envlist }}'
tox_report_env:
TOBIKO_TEST_REPORT_DIR: '{{ tox_report_dir }}'
TOBIKO_TEST_REPORT_NAME: '{{ tox_report_name }}'

View File

@ -4,29 +4,42 @@
shell:
chdir: "{{ tox_dir }}"
cmd: |
set -x
{{ tox_command }} -e "{{ tox_envlist }}" {{ tox_extra_args }}
exit_status=$?
{{ tox_command }} -c '{{ tobiko_dir }}' -e report 1>&2
exit "${exit_status}"
register:
run_tox
environment:
TOBIKO_TEST_REPORT_DIR: "{{ tox_report_dir }}"
TOBIKO_TEST_REPORT_NAME: "{{ tox_report_name }}"
environment: '{{ tox_environment }}'
ignore_errors: yes
- name: "Show test cases results"
- name: "show test cases results"
debug: var=run_tox.stdout_lines
when:
- (run_tox.stdout_lines | length) > 0
- name: "Show test cases errors"
debug: var=run_tox.stderr_lines
- name: "generate test case report files"
shell:
chdir: "{{ tobiko_dir }}"
cmd: |
{{ tox_command }} -e report
register:
make_report
environment: '{{ tox_report_env }}'
ignore_errors: yes
- name:
block:
- name: "show test cases errors"
debug: var=run_tox.stderr_lines
when:
- (run_tox.stderr_lines | length) > 0
- name: 'report test cases failure'
debug:
msg: 'test cases have failed'
failed_when: yes
when:
- (run_tox.stderr_lines | length) > 0
failed_when: run_tox is failed
- run_tox is defined
- run_tox is failed

View File

@ -18,9 +18,11 @@ TOBIKO_TEST_REPORT_XML=${TOBIKO_TEST_REPORT_XML:-${TOBIKO_TEST_REPORT_DIR}/${TOB
function make_report() {
make_report_subunit
make_report_html
make_report_xml
if [[ -f .stestr/failing ]]; then
make_report_subunit
make_report_html
make_report_xml
fi
}