From 9a7a18f9df12d4676affc5b0f267252b68f068d1 Mon Sep 17 00:00:00 2001 From: Rafael Leira Date: Tue, 28 Mar 2023 11:53:42 +0200 Subject: [PATCH] Fixed NVME testing capabilities detection (issue NVMe Windows self-test seems a bit off #64) --- pySMART/device.py | 6 ++++++ tests/dataset/singletests/issue_63_nvme/device.json | 4 ++-- tests/dataset/singletests/nvme_0/device.json | 4 ++-- tests/dataset/singletests/nvme_1_issue_37/device.json | 4 ++-- tests/dataset/singletests/nvme_2_issue_46/device.json | 4 ++-- tests/dataset/singletests/nvme_3_issue_52/device.json | 4 ++-- tests/dataset/singletests/nvme_4_issue_53/device.json | 4 ++-- tests/dataset/singletests/nvme_5_issue_46/device.json | 4 ++-- tests/dataset/singletests/nvme_6/device.json | 4 ++-- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/pySMART/device.py b/pySMART/device.py index 89d2c42..9c408c6 100644 --- a/pySMART/device.py +++ b/pySMART/device.py @@ -1163,6 +1163,12 @@ class members, including the SMART attribute table and self-test log. self.test_capabilities['long'] = 'No' not in line continue + # Parse SMART test capabilities (NVMe only) + if 'Optional Admin Commands' in line: + if 'Self_Test' in line: + self.test_capabilities['short'] = True + self.test_capabilities['long'] = True + # SMART Attribute table parsing if all_in(line, '0x0', '_') and not interface == 'nvme': # Replace multiple space separators with a single space, then diff --git a/tests/dataset/singletests/issue_63_nvme/device.json b/tests/dataset/singletests/issue_63_nvme/device.json index 16022a8..aa9a38d 100644 --- a/tests/dataset/singletests/issue_63_nvme/device.json +++ b/tests/dataset/singletests/issue_63_nvme/device.json @@ -274,8 +274,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_0/device.json b/tests/dataset/singletests/nvme_0/device.json index 6c84764..4deb20d 100644 --- a/tests/dataset/singletests/nvme_0/device.json +++ b/tests/dataset/singletests/nvme_0/device.json @@ -273,8 +273,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_1_issue_37/device.json b/tests/dataset/singletests/nvme_1_issue_37/device.json index 9e98ca0..dd4a87b 100644 --- a/tests/dataset/singletests/nvme_1_issue_37/device.json +++ b/tests/dataset/singletests/nvme_1_issue_37/device.json @@ -274,8 +274,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_2_issue_46/device.json b/tests/dataset/singletests/nvme_2_issue_46/device.json index b52c32e..bb221e9 100644 --- a/tests/dataset/singletests/nvme_2_issue_46/device.json +++ b/tests/dataset/singletests/nvme_2_issue_46/device.json @@ -274,8 +274,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_3_issue_52/device.json b/tests/dataset/singletests/nvme_3_issue_52/device.json index 7d9dd82..3e3f0cf 100644 --- a/tests/dataset/singletests/nvme_3_issue_52/device.json +++ b/tests/dataset/singletests/nvme_3_issue_52/device.json @@ -274,8 +274,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_4_issue_53/device.json b/tests/dataset/singletests/nvme_4_issue_53/device.json index da18bd5..4e0a89c 100644 --- a/tests/dataset/singletests/nvme_4_issue_53/device.json +++ b/tests/dataset/singletests/nvme_4_issue_53/device.json @@ -274,8 +274,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_5_issue_46/device.json b/tests/dataset/singletests/nvme_5_issue_46/device.json index 53d1d2b..9a05bbc 100644 --- a/tests/dataset/singletests/nvme_5_issue_46/device.json +++ b/tests/dataset/singletests/nvme_5_issue_46/device.json @@ -274,8 +274,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false }, diff --git a/tests/dataset/singletests/nvme_6/device.json b/tests/dataset/singletests/nvme_6/device.json index 2cc439a..724a9df 100644 --- a/tests/dataset/singletests/nvme_6/device.json +++ b/tests/dataset/singletests/nvme_6/device.json @@ -273,8 +273,8 @@ ], "test_capabilities": { "offline": false, - "short": false, - "long": false, + "short": true, + "long": true, "conveyance": false, "selective": false },