plugin: shell
id: disk/detect
estimated_duration: 0.25
command: udev_resource | filter_templates -w "category=DISK" | awk -F': ' '$1 == "product" { print $2 }'
_description: Detects and displays disks attached to the system.

unit: template
template-unit: job
template-imports: from 2013.com.canonical.certification import staging/udev as udev
template-resource: udev
template-filter: udev.attr_DEVTYPE == 'disk' and 'ram' not in udev.name and 'loop' not in udev.name
plugin: shell
id: staging/disk/stats_{name}
requires:
 block_device.{name}_state != 'removable'
user: root
command: disk_stats_test {name}
_summary: Disk statistics for {attr_DEVNAME}
_description:
 This test checks disk stats, generates some activity and rechecks stats to
 verify they've changed. It also verifies that disks appear in the various
 files they're supposed to.
 .
 This test will inspect the following disk:
 .
     product vendor: {attr_ID_VENDOR}
     product name: {attr_ID_MODEL}
     serial number: {attr_ID_SERIAL_SHORT}
     sysfs path: {path}
     device node path: {attr_DEVNAME}

plugin: local
_summary: Check stats changes for each disk
flags: deprecated
id: disk/stats
requires: device.category == 'DISK'
_description: Check stats changes for each disk
command:
 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
 plugin: shell
 id: disk/stats_`ls /sys$path/block`
 flags: deprecated
 requires:
  device.path == "$path"
  block_device.`ls /sys$path/block`_state != 'removable'
 user: root
 command: disk_stats_test `ls /sys$path/block | sed 's|!|/|'`
 description: This test checks disk stats, generates some activity and rechecks stats to verify they've changed. It also verifies that disks appear in the various files they're supposed to.
 EOF

plugin: local
_summary: SMART test
id: disk/smart
estimated_duration: 0.30
requires:
 package.name == 'smartmontools'
 device.category == 'DISK'
_description: SMART test
command:
 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
 plugin: shell
 id: disk/smart_`ls /sys$path/block`
 requires:
  device.path == "$path"
  block_device.`ls /sys$path/block`_state != 'removable'
 description:
  This tests the SMART capabilities for $product (Note that this test will not work against hardware RAID)
 user: root
 command: disk_smart -b /dev/`ls /sys$path/block | sed 's|!|/|'` -s 130 -t 270
 EOF

plugin: local
_summary: Verify system storage performs at or above baseline performance
id: disk/read_performance
estimated_duration: 0.30
requires:
 device.category == 'DISK'
_description: Verify system storage performs at or above baseline performance
command:
 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
 plugin: shell
 id: disk/read_performance_`ls /sys$path/block`
 estimated_duration: 65.0
 requires:
  device.path == "$path"
  block_device.`ls /sys$path/block`_state != 'removable'
 description: Disk performance test for $product
 user: root
 command: disk_read_performance_test `ls /sys$path/block | sed 's|!|/|'`
 EOF

plugin: local
_summary: Verify that storage devices, such as Fibre Channel and RAID can be detected and perform under stress.
id: disk/storage_devices
estimated_duration: 1.0
requires:
 device.category == 'DISK'
_description: Verify that storage devices, such as Fibre Channel and RAID can be detected and perform under stress.
command:
 cat <<'EOF' | run_templates -t -s 'udev_resource | filter_templates -w "category=DISK"'
 plugin: shell
 id: disk/storage_device_`ls /sys$path/block`
 estimated_duration: 375.0
 user: root
 requires:
  device.path == "$path"
  block_device.`ls /sys$path/block`_state != 'removable'
 description: Disk I/O stress test for $product
 command: storage_test `ls /sys$path/block | sed 's|!|/|'`
 EOF

plugin: shell
id: disk/spindown
estimated_duration: 875.0
requires:
 device.category == 'DISK'
 package.name == 'smartmontools'
user: root
command: spindown
_description:
 Some new hard drives include a feature that parks the drive heads after a short period of inactivity. This is a power-saving feature, but it can have a bad interaction with the operating system that results in the drive constantly parked then activated. This produces excess wear on the drive, potentially leading to early failures.

plugin: user-interact
id: disk/hdd-parking
estimated_duration: 60.0
requires: device.category == 'DISK'
depends: input/accelerometer
user: root
command: hdd_parking
_description:
 PURPOSE:
  This test checks that a systems drive protection mechanism works properly.
 STEPS:
  1. Click on Test
  2. Move the system under test around, ensuring it is raised and lowered at some point.
 VERIFICATION:
  The verification of this test is automated. Do not change the
  automatically selected result.

