From 36d08c93da2b4f320e93c597e8832b6c9bfbc9f9 Mon Sep 17 00:00:00 2001 From: LiaoU3 <58060146+LiaoU3@users.noreply.github.com> Date: Wed, 10 Jan 2024 09:13:55 +0800 Subject: [PATCH] Add QEP test cases and plans from iiotg provider (New) (#901) * Add QEP test cases and plans from checkbox-iiotg-providers and iiotg provider * Apply suggestions from code review Co-authored-by: Pierre Equoy * Add qep testplan --------- Co-authored-by: Pierre Equoy --- providers/base/units/qep/category.pxu | 3 + providers/base/units/qep/jobs.pxu | 58 +++++++++++++++++++ .../{iiotg => base}/units/qep/manifest.pxu | 0 providers/base/units/qep/test-plan.pxu | 25 ++++++++ providers/iiotg/units/qep/category.pxu | 3 - providers/iiotg/units/qep/jobs.pxu | 10 ---- 6 files changed, 86 insertions(+), 13 deletions(-) create mode 100644 providers/base/units/qep/category.pxu create mode 100644 providers/base/units/qep/jobs.pxu rename providers/{iiotg => base}/units/qep/manifest.pxu (100%) create mode 100644 providers/base/units/qep/test-plan.pxu delete mode 100644 providers/iiotg/units/qep/category.pxu delete mode 100644 providers/iiotg/units/qep/jobs.pxu diff --git a/providers/base/units/qep/category.pxu b/providers/base/units/qep/category.pxu new file mode 100644 index 0000000000..7d1797f165 --- /dev/null +++ b/providers/base/units/qep/category.pxu @@ -0,0 +1,3 @@ +unit: category +id: qep +_name: Quadrature Encoder Peripherals diff --git a/providers/base/units/qep/jobs.pxu b/providers/base/units/qep/jobs.pxu new file mode 100644 index 0000000000..6623f1d5ff --- /dev/null +++ b/providers/base/units/qep/jobs.pxu @@ -0,0 +1,58 @@ +unit: job +category_id: qep +id: qep/qep-devices +plugin: resource +_summary: test QEP +_description: Generates the 4 QEP devices to be used in the template test jobs +command: + DEVICES="4bc3 4b81 4b82 4b83" + for d in $DEVICES; do + echo "qep-device: $d" + echo + done + +unit: template +template-resource: qep/qep-devices +template-unit: job +id: qep/qep-device-driver-for-{qep-device} +category_id: qep +_summary: Verify PCI Device {qep-device} is using the correct driver +_description: + Checks that the device exists in lspci and that the device driver associated is correct. + Device ID should be 8086:{qep-device} and the driver is always intel_qep. +imports: from com.canonical.plainbox import manifest +requires: + manifest.has_qep == 'True' +plugin: shell +command: + echo "Verifying: 8086:{qep-device} is using intel_qep driver" + lspci -nnkd 8086:{qep-device} | grep intel_qep + +unit: template +template-resource: qep/qep-devices +template-unit: job +id: qep/qep-device-node-for-{qep-device} +category_id: qep +_summary: Verify device directory exists for {qep-device} +_description: + Detects if the device's directory exists. + First needs to find the PCI ID from lspci + Then tests if the PCI device directory exists. + The PCI ID is always ##:##.# (e.g. 18:00.2) + The PCI device directory is always in the format of 0000:$PCI_ID +imports: from com.canonical.plainbox import manifest +requires: + manifest.has_qep == 'True' +plugin: shell +command: + echo "Test for: "{qep-device} + echo "Find PCI ID for "{qep-device} + PCI=$(lspci -nd 8086:{qep-device} | cut -c 1-7) + echo "PCI ID is: $PCI" + if [ -d "/sys/bus/pci/devices/0000:$PCI" ] + then + echo "path /sys/bus/pci/devices/0000:$PCI exists" + else + echo "path /sys/bus/pci/devices/0000:$PCI does not exist" + exit 1 + fi diff --git a/providers/iiotg/units/qep/manifest.pxu b/providers/base/units/qep/manifest.pxu similarity index 100% rename from providers/iiotg/units/qep/manifest.pxu rename to providers/base/units/qep/manifest.pxu diff --git a/providers/base/units/qep/test-plan.pxu b/providers/base/units/qep/test-plan.pxu new file mode 100644 index 0000000000..57ef8e0178 --- /dev/null +++ b/providers/base/units/qep/test-plan.pxu @@ -0,0 +1,25 @@ +id: qep-full +_name: Quadrature Encoder Peripheral (QEP) tests +unit: test plan +include: +bootstrap_include: + qep/qep-devices +nested_part: + qep-manual + qep-automated + +id: qep-manual +_name: Quadrature Encoder Peripheral (QEP) test (manual) +unit: test plan +bootstrap_include: + qep/qep-devices +include: + +id: qep-automated +_name: Quadrature Encoder Peripheral (QEP) test (automated) +unit: test plan +bootstrap_include: + qep/qep-devices +include: + qep/qep-device-driver-for-.* + qep/qep-device-node-for-.* diff --git a/providers/iiotg/units/qep/category.pxu b/providers/iiotg/units/qep/category.pxu deleted file mode 100644 index 77ebd64eb0..0000000000 --- a/providers/iiotg/units/qep/category.pxu +++ /dev/null @@ -1,3 +0,0 @@ -unit: category -id: qep -_name: Quadrature Encoder Peripherals \ No newline at end of file diff --git a/providers/iiotg/units/qep/jobs.pxu b/providers/iiotg/units/qep/jobs.pxu deleted file mode 100644 index 42a1d0c9a5..0000000000 --- a/providers/iiotg/units/qep/jobs.pxu +++ /dev/null @@ -1,10 +0,0 @@ - -id: qep/detect -_summary: Detect presence of a QEP interface device -plugin: shell -category_id: qep -imports: from com.canonical.plainbox import manifest -requires: - manifest.has_qep == 'True' -command: - lspci | grep -i 4bc3 | cut -c 1-7