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 2/9] nfstest: add last-run directory and last-kernel.txt to the results
Date: Mon,  3 Mar 2025 08:09:41 -0500	[thread overview]
Message-ID: <20250303130948.630029-3-smayhew@redhat.com> (raw)
In-Reply-To: <20250303130948.630029-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/nfstest/tasks/main.yml | 60 ++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 8 deletions(-)

diff --git a/playbooks/roles/nfstest/tasks/main.yml b/playbooks/roles/nfstest/tasks/main.yml
index 8c8db02..bf5cd9f 100644
--- a/playbooks/roles/nfstest/tasks/main.yml
+++ b/playbooks/roles/nfstest/tasks/main.yml
@@ -131,6 +131,24 @@
   tags:
     - run_tests
 
+- name: Set the pathname of the results directory
+  ansible.builtin.set_fact:
+    nfstest_results_full_path: "{{ topdir_path }}/workflows/nfstest/results"
+    nfstest_results_target: "../workflows/nfstest/results/last-run"
+  when:
+    - kdevops_workflows_dedicated_workflow|bool
+  tags: copy_results
+
+- name: Clean up our localhost results/last-run directory
+  local_action: file path="{{ nfstest_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="{{ nfstest_results_target }}/" state=directory
+  run_once: true
+  tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
+
 - name: Run the test group script on the target node
   ansible.builtin.command:
     cmd: "/tmp/runtest.sh"
@@ -138,16 +156,25 @@
     - kdevops_workflows_dedicated_workflow|bool
   tags: run_tests
 
-- name: Set the pathname of the results directory
-  ansible.builtin.set_fact:
-    nfstest_results_dir: "../workflows/nfstest/results/{{ ansible_kernel }}"
-  when:
-    - kdevops_workflows_dedicated_workflow|bool
-  tags: copy_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 }} > {{ nfstest_results_target }}/../last-kernel.txt"
+  tags: [ 'run_tests', 'copy_results', 'print_results' ]
+  run_once: true
 
 - name: Create the results directory on the control node
   ansible.builtin.file:
-    path: "{{ nfstest_results_dir }}"
+    path: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}"
     state: directory
     mode: "u=rwx,g=rx,o=rx"
   delegate_to: localhost
@@ -168,7 +195,7 @@
 - name: Copy the output logs to the control node
   ansible.builtin.fetch:
     src: "{{ item.path }}"
-    dest: "{{ nfstest_results_dir }}/{{ nfstest_test_group }}/"
+    dest: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}/{{ nfstest_test_group }}/"
     flat: true
   with_items: "{{ nfstest_logs.files }}"
   loop_control:
@@ -178,3 +205,20 @@
     - kdevops_workflows_dedicated_workflow|bool
   changed_when: false
   tags: copy_results
+
+- name: Verify last-run kernel directory exists
+  tags: [ 'copy_results' ]
+  delegate_to: localhost
+  stat:
+    path: "{{ nfstest_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: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}"
+    dest: "{{ nfstest_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-03 13:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 13:09 [PATCH 0/9] tweak results organization and reporting Scott Mayhew
2025-03-03 13:09 ` [PATCH 1/9] pynfs: add last-run directory and last-kernel.txt to the results Scott Mayhew
2025-03-03 13:09 ` Scott Mayhew [this message]
2025-03-03 13:09 ` [PATCH 3/9] gitr: " Scott Mayhew
2025-03-03 13:09 ` [PATCH 4/9] ltp: " Scott Mayhew
2025-03-03 13:09 ` [PATCH 5/9] fstests: add makefile target to show test results Scott Mayhew
2025-03-06 16:48   ` Luis Chamberlain
2025-03-03 13:09 ` [PATCH 6/9] pynfs: " Scott Mayhew
2025-03-03 13:09 ` [PATCH 7/9] nfstest: " Scott Mayhew
2025-03-03 13:09 ` [PATCH 8/9] gitr: " Scott Mayhew
2025-03-03 13:09 ` [PATCH 9/9] ltp: " Scott Mayhew
2025-03-12 20:09 ` [PATCH 0/9] tweak results organization and reporting Chuck Lever
2025-03-12 22:58   ` Luis Chamberlain
  -- strict thread matches above, loose matches on Subject: below --
2025-03-05  0:57 Scott Mayhew
2025-03-05  0:57 ` [PATCH 2/9] nfstest: 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=20250303130948.630029-3-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