Merge "Fix partial subunit stream logging"
This commit is contained in:
commit
155a880534
@ -28,17 +28,28 @@ zuul_work_dir=$1
|
|||||||
cd $HOME
|
cd $HOME
|
||||||
cd $zuul_work_dir
|
cd $zuul_work_dir
|
||||||
|
|
||||||
|
# A non zero exit code means we didn't find any stestr or testr database
|
||||||
|
# content. Additionally if the database content is parseable we emit on
|
||||||
|
# stdout the commands which can be used to retrieve that parsed content.
|
||||||
|
# This distiction is necessary as we want to take different actions based
|
||||||
|
# on whether or not the database content is parseable.
|
||||||
|
rc=1
|
||||||
commands=""
|
commands=""
|
||||||
|
|
||||||
if [[ -d .testrepository ]] ; then
|
if [[ -d .testrepository ]] ; then
|
||||||
|
rc=0
|
||||||
commands="testr ${commands}"
|
commands="testr ${commands}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# NOTE(mordred) Check for the failing file in the .stestr directory
|
if [[ -d .stestr ]] ; then
|
||||||
# nstead of just the directory. A stestr run that fails due to python
|
rc=0
|
||||||
# parsing errors will leave a directory but with no test results, which
|
# NOTE(mordred) Check for the failing file in the .stestr directory
|
||||||
# will result in an error in the subunit generation phase.
|
# instead of just the directory. A stestr run that fails due to python
|
||||||
if [[ -f .stestr/failing ]] ; then
|
# parsing errors will leave a directory but with no test results, which
|
||||||
commands="stestr ${commands}"
|
# will result in an error in the subunit generation phase.
|
||||||
|
if [[ -f .stestr/failing ]] ; then
|
||||||
|
commands="stestr ${commands}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add all the tox envs to the path so that type will work. Prefer tox
|
# Add all the tox envs to the path so that type will work. Prefer tox
|
||||||
@ -57,3 +68,4 @@ for command in $commands; do
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
exit $rc
|
||||||
|
@ -4,15 +4,49 @@
|
|||||||
- name: Find stestr or testr executable
|
- name: Find stestr or testr executable
|
||||||
script: "find-testr.sh {{ zuul_work_dir }}"
|
script: "find-testr.sh {{ zuul_work_dir }}"
|
||||||
register: testr_command
|
register: testr_command
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
- when:
|
- when:
|
||||||
- testr_command.rc == 0
|
- testr_command.rc == 0
|
||||||
- testr_command.stdout_lines
|
# Here we run steps that should apply whether or not there is a valid
|
||||||
|
# subunit stream present.
|
||||||
block:
|
block:
|
||||||
- name: Get the list of directories with subunit files
|
- name: Get the list of directories with subunit files
|
||||||
set_fact:
|
set_fact:
|
||||||
all_subunit_dirs: "{{ [ zuul_work_dir ] + fetch_subunit_output_additional_dirs }}"
|
all_subunit_dirs: "{{ [ zuul_work_dir ] + fetch_subunit_output_additional_dirs }}"
|
||||||
|
|
||||||
|
# If (s)testr was stopped early (possibly due to a timeout) it will "leak"
|
||||||
|
# a tmp file of the inflight subunit stream. Collect this as it is useful
|
||||||
|
# for debugging in these situations. Because it isn't a complete file
|
||||||
|
# we don't process it further.
|
||||||
|
- name: Find any inflight partial subunit files
|
||||||
|
find:
|
||||||
|
paths:
|
||||||
|
- "{{ zj_item }}/.testrepository"
|
||||||
|
- "{{ zj_item }}/.stestr"
|
||||||
|
patterns:
|
||||||
|
- 'tmp*'
|
||||||
|
register: partial_subunit_files
|
||||||
|
loop: "{{ all_subunit_dirs }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: zj_item
|
||||||
|
|
||||||
|
- name: Copy any inflight subunit files
|
||||||
|
copy:
|
||||||
|
dest: "{{ zuul_output_dir }}/logs/"
|
||||||
|
src: "{{ zj_item.path }}"
|
||||||
|
remote_src: true
|
||||||
|
with_items: "{{ partial_subunit_files.files }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: zj_item
|
||||||
|
when: partial_subunit_files.files is defined
|
||||||
|
|
||||||
|
- when:
|
||||||
|
- testr_command.rc == 0
|
||||||
|
- testr_command.stdout_lines
|
||||||
|
# Here we run steps that only apply when there is a valid subunity stream.
|
||||||
|
# This is indicated through testr_command.stdout_lines content.
|
||||||
|
block:
|
||||||
# The usage an independent target file instead of sending the output
|
# The usage an independent target file instead of sending the output
|
||||||
# to zuul_work_dir prevents issues related to zuul_work_dir being
|
# to zuul_work_dir prevents issues related to zuul_work_dir being
|
||||||
# a relative path, which may happen despite what the documentation
|
# a relative path, which may happen despite what the documentation
|
||||||
@ -43,31 +77,5 @@
|
|||||||
state: absent
|
state: absent
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
# If (s)testr was stopped early (possibly due to a timeout) it will "leak"
|
|
||||||
# a tmp file of the inflight subunit stream. Collect this as it is useful
|
|
||||||
# for debugging in these situations. Because it isn't a complete file
|
|
||||||
# we don't process it further.
|
|
||||||
- name: Find any inflight partial subunit files
|
|
||||||
find:
|
|
||||||
paths:
|
|
||||||
- "{{ zj_item }}/.testrepository"
|
|
||||||
- "{{ zj_item }}/.stestr"
|
|
||||||
patterns:
|
|
||||||
- 'tmp*'
|
|
||||||
register: partial_subunit_files
|
|
||||||
loop: "{{ all_subunit_dirs }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: zj_item
|
|
||||||
|
|
||||||
- name: Copy any inflight subunit files
|
|
||||||
copy:
|
|
||||||
dest: "{{ zuul_output_dir }}/logs/"
|
|
||||||
src: "{{ zj_item.path }}"
|
|
||||||
remote_src: true
|
|
||||||
with_items: "{{ partial_subunit_files.files }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: zj_item
|
|
||||||
when: partial_subunit_files.files is defined
|
|
||||||
|
|
||||||
- name: Process and fetch subunit results
|
- name: Process and fetch subunit results
|
||||||
include_tasks: process.yaml
|
include_tasks: process.yaml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user