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 # Directory where test cases has been deployed to
tox_dir: '{{ test_dir | realpath }}' tox_dir: '{{ test_dir | realpath }}'
tox_command: "tox" tox_command: tox
tox_environment: {}
tox_envlist: py36 tox_envlist: py36
tox_extra_args: '' 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_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: shell:
chdir: "{{ tox_dir }}" chdir: "{{ tox_dir }}"
cmd: | cmd: |
set -x
{{ tox_command }} -e "{{ tox_envlist }}" {{ tox_extra_args }} {{ tox_command }} -e "{{ tox_envlist }}" {{ tox_extra_args }}
exit_status=$?
{{ tox_command }} -c '{{ tobiko_dir }}' -e report 1>&2
exit "${exit_status}"
register: register:
run_tox run_tox
environment: environment: '{{ tox_environment }}'
TOBIKO_TEST_REPORT_DIR: "{{ tox_report_dir }}"
TOBIKO_TEST_REPORT_NAME: "{{ tox_report_name }}"
ignore_errors: yes ignore_errors: yes
- name: "Show test cases results" - name: "show test cases results"
debug: var=run_tox.stdout_lines debug: var=run_tox.stdout_lines
when: when:
- (run_tox.stdout_lines | length) > 0 - (run_tox.stdout_lines | length) > 0
- name: "Show test cases errors" - name: "generate test case report files"
debug: var=run_tox.stderr_lines 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: when:
- (run_tox.stderr_lines | length) > 0 - run_tox is defined
failed_when: run_tox is failed - 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() { function make_report() {
make_report_subunit if [[ -f .stestr/failing ]]; then
make_report_html make_report_subunit
make_report_xml make_report_html
make_report_xml
fi
} }