Skip to content

Commit e7ee1ef

Browse files
committed
ltp: add last-run directory and last-kernel.txt to the results
Create the last-run directory and last-kernel.txt file in a manner similar to the way the fstests workflow does it. This will make it easier to get at the most recent test results for reporting purposes. Signed-off-by: Scott Mayhew <[email protected]>
1 parent e30a7d1 commit e7ee1ef

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

playbooks/roles/ltp/tasks/main.yml

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,52 @@
2020
tags: ['vars']
2121
ansible.builtin.set_fact:
2222
ltp_test_group: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') }}"
23-
ltp_results_dir: "../workflows/ltp/results/{{ ansible_kernel }}"
23+
ltp_results_full_path: "{{ topdir_path }}/workflows/ltp/results"
24+
ltp_results_target: "../workflows/ltp/results/last-run"
2425

2526
- name: Create the local results directory
2627
tags: ['first_run']
2728
ansible.builtin.file:
28-
path: "{{ ltp_results_dir }}"
29+
path: "{{ ltp_results_full_path }}"
2930
state: directory
3031
mode: "u=rwx,g=rx,o=rx"
3132
delegate_to: localhost
3233
run_once: true
3334

35+
- name: Clean up our localhost results/last-run directory
36+
local_action: file path="{{ ltp_results_target }}/" state=absent
37+
run_once: true
38+
tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
39+
40+
- name: Create empty last-run directory
41+
local_action: file path="{{ ltp_results_target }}/" state=directory
42+
run_once: true
43+
tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
44+
45+
- name: Get used target kernel version
46+
tags: [ 'copy_results' ]
47+
command: "uname -r"
48+
register: uname_cmd
49+
50+
- name: Store last kernel variable
51+
tags: [ 'copy_results' ]
52+
set_fact:
53+
last_kernel: "{{ uname_cmd.stdout_lines | regex_replace('\\]') | regex_replace('\\[') | replace(\"'\",'') }}"
54+
run_once: true
55+
56+
- name: Document used target kernel version
57+
local_action: "shell echo {{ last_kernel }} > {{ ltp_results_target }}/../last-kernel.txt"
58+
tags: [ 'run_tests', 'copy_results', 'print_results' ]
59+
run_once: true
60+
61+
- name: Ensure the local results directory exists
62+
tags: copy_results
63+
ansible.builtin.file:
64+
path: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}"
65+
state: directory
66+
mode: "u=rwx,g=rx,o=rx"
67+
delegate_to: localhost
68+
3469
- name: Set OS-specific variables
3570
ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
3671
vars:
@@ -194,7 +229,7 @@
194229
tags: ['copy_results']
195230
ansible.builtin.fetch:
196231
src: "{{ item.path }}"
197-
dest: "{{ ltp_results_dir }}/{{ ltp_test_group }}/"
232+
dest: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}/"
198233
flat: true
199234
validate_checksum: false
200235
with_items: "{{ results_files.files }}"
@@ -216,11 +251,28 @@
216251
tags: ['copy_results']
217252
ansible.builtin.fetch:
218253
src: "{{ item.path }}"
219-
dest: "{{ ltp_results_dir }}/{{ ltp_test_group }}/"
254+
dest: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}/"
220255
flat: true
221256
validate_checksum: false
222257
with_items: "{{ output_files.files }}"
223258
when:
224259
- output_files.matched > 0
225260
loop_control:
226261
label: "Copying {{ item.path | basename }} ..."
262+
263+
- name: Verify last-run kernel directory exists
264+
tags: [ 'copy_results' ]
265+
delegate_to: localhost
266+
stat:
267+
path: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}"
268+
register: last_run_kernel_dir
269+
270+
- name: Copy over the last-run into the results directory for archiving into kdevops
271+
copy:
272+
src: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}"
273+
dest: "{{ ltp_results_full_path }}/"
274+
run_once: true
275+
tags: [ 'copy_results' ]
276+
delegate_to: localhost
277+
when:
278+
- last_run_kernel_dir.stat.exists

0 commit comments

Comments
 (0)