public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: kdevops@lists.linux.dev
Subject: [PATCH 4/9] ltp: add last-run directory and last-kernel.txt to the results
Date: Tue,  4 Mar 2025 19:57:49 -0500	[thread overview]
Message-ID: <20250305005755.697599-6-smayhew@redhat.com> (raw)
In-Reply-To: <20250305005755.697599-1-smayhew@redhat.com>

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 <smayhew@redhat.com>
---
 playbooks/roles/ltp/tasks/main.yml | 60 ++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 4 deletions(-)

diff --git a/playbooks/roles/ltp/tasks/main.yml b/playbooks/roles/ltp/tasks/main.yml
index 34cae23..71e1541 100644
--- a/playbooks/roles/ltp/tasks/main.yml
+++ b/playbooks/roles/ltp/tasks/main.yml
@@ -20,17 +20,52 @@
   tags: ['vars']
   ansible.builtin.set_fact:
     ltp_test_group: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') }}"
-    ltp_results_dir: "../workflows/ltp/results/{{ ansible_kernel }}"
+    ltp_results_full_path: "{{ topdir_path }}/workflows/ltp/results"
+    ltp_results_target: "../workflows/ltp/results/last-run"
 
 - name: Create the local results directory
   tags: ['first_run']
   ansible.builtin.file:
-    path: "{{ ltp_results_dir }}"
+    path: "{{ ltp_results_full_path }}"
     state: directory
     mode: "u=rwx,g=rx,o=rx"
   delegate_to: localhost
   run_once: true
 
+- name: Clean up our localhost results/last-run directory
+  local_action: file path="{{ ltp_results_target }}/" state=absent
+  run_once: true
+  tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
+
+- name: Create empty last-run directory
+  local_action: file path="{{ ltp_results_target }}/" state=directory
+  run_once: true
+  tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
+
+- name: Get used target kernel version
+  tags: [ 'copy_results' ]
+  command: "uname -r"
+  register: uname_cmd
+
+- name: Store last kernel variable
+  tags: [ 'copy_results' ]
+  set_fact:
+    last_kernel: "{{ uname_cmd.stdout_lines | regex_replace('\\]') | regex_replace('\\[') | replace(\"'\",'') }}"
+  run_once: true
+
+- name: Document used target kernel version
+  local_action: "shell echo {{ last_kernel }} > {{ ltp_results_target }}/../last-kernel.txt"
+  tags: [ 'run_tests', 'copy_results', 'print_results' ]
+  run_once: true
+
+- name: Ensure the local results directory exists
+  tags: copy_results
+  ansible.builtin.file:
+    path: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}"
+    state: directory
+    mode: "u=rwx,g=rx,o=rx"
+  delegate_to: localhost
+
 - name: Set OS-specific variables
   ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}"
   vars:
@@ -194,7 +229,7 @@
   tags: ['copy_results']
   ansible.builtin.fetch:
     src: "{{ item.path }}"
-    dest: "{{ ltp_results_dir }}/{{ ltp_test_group }}/"
+    dest: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}/"
     flat: true
     validate_checksum: false
   with_items: "{{ results_files.files }}"
@@ -216,7 +251,7 @@
   tags: ['copy_results']
   ansible.builtin.fetch:
     src: "{{ item.path }}"
-    dest: "{{ ltp_results_dir }}/{{ ltp_test_group }}/"
+    dest: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}/"
     flat: true
     validate_checksum: false
   with_items: "{{ output_files.files }}"
@@ -224,3 +259,20 @@
     - output_files.matched > 0
   loop_control:
     label: "Copying {{ item.path | basename }} ..."
+
+- name: Verify last-run kernel directory exists
+  tags: [ 'copy_results' ]
+  delegate_to: localhost
+  stat:
+    path: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}"
+  register: last_run_kernel_dir
+
+- name: Copy over the last-run into the results directory for archiving into kdevops
+  copy:
+    src: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}"
+    dest: "{{ ltp_results_full_path }}/"
+  run_once: true
+  tags: [ 'copy_results' ]
+  delegate_to: localhost
+  when:
+    - last_run_kernel_dir.stat.exists
-- 
2.48.1


  parent reply	other threads:[~2025-03-05  0:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05  0:57 [PATCH 0/9] tweak results organization and reporting Scott Mayhew
2025-03-05  0:57 ` [PATCH] Don't include the codereadyrepo role if we're using a custom yum repofile Scott Mayhew
2025-03-05  0:57 ` [PATCH 1/9] pynfs: add last-run directory and last-kernel.txt to the results Scott Mayhew
2025-03-05  0:57 ` [PATCH 2/9] nfstest: " Scott Mayhew
2025-03-05  0:57 ` [PATCH 3/9] gitr: " Scott Mayhew
2025-03-05  0:57 ` Scott Mayhew [this message]
2025-03-05  0:57 ` [PATCH 5/9] fstests: add makefile target to show test results Scott Mayhew
2025-03-05  0:57 ` [PATCH 6/9] pynfs: " Scott Mayhew
2025-03-05  0:57 ` [PATCH 7/9] nfstest: " Scott Mayhew
2025-03-05  0:57 ` [PATCH 8/9] gitr: " Scott Mayhew
2025-03-05  0:57 ` [PATCH 9/9] ltp: " Scott Mayhew
2025-03-05  0:57 ` [PATCH] Don't include the codereadyrepo role if we're using a custom yum repofile Scott Mayhew
2025-03-05  1:11 ` [PATCH 0/9] tweak results organization and reporting Scott Mayhew
  -- strict thread matches above, loose matches on Subject: below --
2025-03-03 13:09 Scott Mayhew
2025-03-03 13:09 ` [PATCH 4/9] ltp: add last-run directory and last-kernel.txt to the results Scott Mayhew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250305005755.697599-6-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox