[PATCH 2/5] mmtests: add monitoring framework integration

Luis Chamberlain <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
Add support for the monitoring framework to mmtests workflow, matching
the implementation in fstests. This allows mmtests to leverage all
monitoring capabilities including the new eBPF fragmentation monitoring.

Changes:
- Import monitor_run tasks before test execution
- Import monitor_collect tasks after test completion
- Add monitor-results make target for interim data collection
- Make monitoring results path workflow-aware (fstests vs mmtests)

With these changes, users can simply enable monitoring options in
menuconfig and mmtests will automatically start/stop monitoring
during test execution.

Generated-by: Claude AI
Signed-off-by: Luis Chamberlain <[email protected]>
---
 .../roles/mmtests/tasks/install-deps/debian/main.yml |  1 +
 .../roles/mmtests/tasks/install-deps/redhat/main.yml |  1 +
 .../roles/mmtests/tasks/install-deps/suse/main.yml   |  1 +
 playbooks/roles/mmtests/tasks/main.yaml              | 12 ++++++++++++
 playbooks/roles/monitoring/tasks/monitor_collect.yml | 11 ++++++++++-
 workflows/mmtests/Makefile                           |  8 ++++++++
 6 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/playbooks/roles/mmtests/tasks/install-deps/debian/main.yml b/playbooks/roles/mmtests/tasks/install-deps/debian/main.yml
index 62de1e2a0c3e..7195ea527256 100644
--- a/playbooks/roles/mmtests/tasks/install-deps/debian/main.yml
+++ b/playbooks/roles/mmtests/tasks/install-deps/debian/main.yml
@@ -60,6 +60,7 @@
     name:
       - trace-cmd
       - perf-tools-unstable
+      - python3-bpfcc
     state: present
     update_cache: true
   tags: ["deps"]
diff --git a/playbooks/roles/mmtests/tasks/install-deps/redhat/main.yml b/playbooks/roles/mmtests/tasks/install-deps/redhat/main.yml
index debfb577c906..c62ff09fdde5 100644
--- a/playbooks/roles/mmtests/tasks/install-deps/redhat/main.yml
+++ b/playbooks/roles/mmtests/tasks/install-deps/redhat/main.yml
@@ -52,6 +52,7 @@
       - kernel-tools
       - trace-cmd
       - perf
+      - python3-bcc
     state: present
   tags: ["deps"]
   ignore_errors: true
diff --git a/playbooks/roles/mmtests/tasks/install-deps/suse/main.yml b/playbooks/roles/mmtests/tasks/install-deps/suse/main.yml
index 5a6c2b54c332..e357232d11a2 100644
--- a/playbooks/roles/mmtests/tasks/install-deps/suse/main.yml
+++ b/playbooks/roles/mmtests/tasks/install-deps/suse/main.yml
@@ -52,6 +52,7 @@
       - kernel-default-devel
       - trace-cmd
       - perf
+      - python3-bcc
     state: present
   tags: ["deps"]
   ignore_errors: true
diff --git a/playbooks/roles/mmtests/tasks/main.yaml b/playbooks/roles/mmtests/tasks/main.yaml
index 6e9593662a6b..fd05843f8b2c 100644
--- a/playbooks/roles/mmtests/tasks/main.yaml
+++ b/playbooks/roles/mmtests/tasks/main.yaml
@@ -217,6 +217,12 @@
   ansible.builtin.debug:
     msg: "Kernel version on {{ inventory_hostname }} : {{ kernel_version.stdout }}"
 
+# Start monitoring services before running tests
+- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_run.yml
+  when:
+    - enable_monitoring|default(false)|bool
+  tags: ["run_tests", "monitoring", "monitor_run"]
+
 - name: Run mmtests in background
   tags: ["run_tests"]
   become: true
@@ -239,6 +245,12 @@
   retries: 1440 # 12 hours
   delay: 60 # check every 60 seconds
 
+# Collect monitoring data after tests complete
+- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_collect.yml
+  when:
+    - enable_monitoring|default(false)|bool
+  tags: ["run_tests", "monitoring", "monitor_collect"]
+
 - name: Create local results directory
   delegate_to: localhost
   ansible.builtin.file:
diff --git a/playbooks/roles/monitoring/tasks/monitor_collect.yml b/playbooks/roles/monitoring/tasks/monitor_collect.yml
index f57a4e9d8106..967526b40428 100644
--- a/playbooks/roles/monitoring/tasks/monitor_collect.yml
+++ b/playbooks/roles/monitoring/tasks/monitor_collect.yml
@@ -110,7 +110,16 @@
 
 - name: Set monitoring results path
   ansible.builtin.set_fact:
-    monitoring_results_path: "{{ monitoring_results_base_path | default(topdir_path + '/workflows/fstests/results/monitoring') }}"
+    monitoring_results_path: >-
+      {%- if monitoring_results_base_path is defined -%}
+        {{ monitoring_results_base_path }}
+      {%- elif kdevops_run_fstests|default(false)|bool -%}
+        {{ topdir_path }}/workflows/fstests/results/monitoring
+      {%- elif kdevops_workflow_enable_mmtests|default(false)|bool -%}
+        {{ topdir_path }}/workflows/mmtests/results/monitoring
+      {%- else -%}
+        {{ topdir_path }}/results/monitoring
+      {%- endif -%}
 
 - name: Create local monitoring results directory
   ansible.builtin.file:
diff --git a/workflows/mmtests/Makefile b/workflows/mmtests/Makefile
index 69db9505284d..c6248b95c05c 100644
--- a/workflows/mmtests/Makefile
+++ b/workflows/mmtests/Makefile
@@ -43,6 +43,12 @@ mmtests-compare:
 		--tags deps,compare \
 		$(MMTESTS_ARGS)
 
+monitor-results: $(KDEVOPS_EXTRA_VARS)
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		playbooks/monitor-results.yml \
+		--extra-vars=@./extra_vars.yaml \
+		$(MMTESTS_ARGS)
+
 mmtests-clean:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/mmtests.yml \
@@ -58,6 +64,7 @@ mmtests-help:
 	@echo "mmtests-tests                : Run mmtests tests"
 	@echo "mmtests-results              : Copy results from guests"
 	@echo "mmtests-compare              : Compare baseline and dev results (AB testing)"
+	@echo "monitor-results              : Collect interim monitoring data without stopping monitoring"
 	@echo "mmtests-clean                : Clean up mmtests installation"
 	@echo ""
 
@@ -69,6 +76,7 @@ PHONY +: mmtests-dev
 PHONY +: mmtests-tests
 PHONY +: mmtests-results
 PHONY +: mmtests-compare
+PHONY +: monitor-results
 PHONY +: mmtests-clean
 PHONY +: mmtests-help
 .PHONY: $(PHONY)
-- 
2.45.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.