78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
---
|
|
- name: Echo test header
|
|
shell: |
|
|
MSG="Running test case {{ test_case }}"
|
|
echo "*** $MSG ***" >/dev/console
|
|
logger -p user.notify "$MSG"
|
|
true
|
|
|
|
- name: Create artifacts directory
|
|
file:
|
|
state: directory
|
|
path: "{{ remote_artifacts }}/{{ test_case }}"
|
|
|
|
- name: Run the testsuite
|
|
# lvm2-testsuite --batch --flavours "{{ flavours.stdout_lines|join(',')}}" --only "{{ run_tests|default([])|join(',') }}" --skip "{{ skip_tests|default([])|join(',') }}" 2>&1 | tee "lvm2-testsuite.out"
|
|
shell: |
|
|
# Run testsuite in RAM disk:
|
|
mkdir -p /dev/shm/lvm2-slave
|
|
export LVM_TEST_DIR=/dev/shm/lvm2-slave
|
|
mount -o remount,dev /dev/shm
|
|
# Protection against some of our non-deterministic tests
|
|
# TODO: Add diff for each test run, so it is easier to tell whether test is broken, or there is an issue
|
|
RESULT=1
|
|
ITERATION=0
|
|
while [[ "$RESULT" -ne 0 && "$ITERATION" -lt {{ iterations|default(3) }} ]]; do
|
|
let ITERATION++
|
|
mkdir "$ITERATION"
|
|
cd "$ITERATION"
|
|
echo "Running iteration $ITERATION..."
|
|
lvm2-testsuite --batch --flavours "{{ flavours.stdout_lines|join(',')}}" --only "{{ test_case }}" 2>&1 | tee "lvm2-testsuite.out"
|
|
RESULT="${PIPESTATUS[0]}"
|
|
cd ".."
|
|
done
|
|
cp -R "$ITERATION"/* "."
|
|
exit "$RESULT"
|
|
args:
|
|
chdir: "{{ remote_artifacts }}/{{ test_case }}"
|
|
register: lvm2_testsuite_run
|
|
ignore_errors: yes
|
|
|
|
- name: Collect artifacts
|
|
shell: |
|
|
"{{ workdir }}/collect_output.sh" "{{ remote_artifacts }}/{{ test_case }}" "{{ remote_artifacts }}/list"
|
|
ignore_errors: yes
|
|
register: lvm2_testsuite_results
|
|
|
|
#- name: Find artifacts
|
|
# find:
|
|
# path: "{{ remote_artifacts }}"
|
|
# patterns: "*.txt"
|
|
# register: artifacts_files
|
|
|
|
- name: Fetch output
|
|
fetch:
|
|
dest: "{{ artifacts }}/{{ test_case }}/"
|
|
src: "{{ remote_artifacts }}/{{ test_case }}/{{ logfile }}"
|
|
flat: yes
|
|
with_items:
|
|
- lvm2-testsuite.out
|
|
- journal
|
|
- list
|
|
- logfiles.tar
|
|
loop_control:
|
|
loop_var: logfile
|
|
when: lvm2_testsuite_results.failed
|
|
|
|
- name: Fetch list
|
|
fetch:
|
|
dest: "{{ artifacts }}/"
|
|
src: "{{ remote_artifacts }}/list"
|
|
flat: yes
|
|
|
|
- name: Summary
|
|
shell: |
|
|
cut -d" " -f2 "{{ remote_artifacts }}/list" | sort | uniq -c
|
|
grep "failed$" "{{ remote_artifacts }}/list" || :
|
|
|