Skip to content

Commit 6878ead

Browse files
committed
fixed issue #49
1 parent 5f55efb commit 6878ead

File tree

8 files changed

+826
-8
lines changed

8 files changed

+826
-8
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Version 1.2.0
1515
- Checks for temperature units (farenheit) and converts to celsius
1616
- Fixed MacOS compatibility issues up to version 11.x
1717
- Fixed some localization (lang) issues
18+
- Fixed issue ([#49](https://github.com/truenas/py-SMART/issues/49)) detecting selective test
19+
capabilities as short/long tests on device parsing
1820

1921
Version 1.1.0
2022
=============

pySMART/device.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1016,14 +1016,15 @@ class members, including the SMART attribute table and self-test log.
10161016
self.test_capabilities['conveyance'] = 'No' not in line
10171017
continue
10181018

1019+
if 'Selective Self-test supported' in line:
1020+
self.test_capabilities['selective'] = 'No' not in line
1021+
continue
1022+
10191023
if 'Self-test supported' in line:
10201024
self.test_capabilities['short'] = 'No' not in line
1025+
self.test_capabilities['long'] = 'No' not in line
10211026
continue
10221027

1023-
# Note: Currently I have not added any support in pySMART for selective Self-tests
1024-
# Thus commenting it out
1025-
# if 'Selective Self-test supported' in line:
1026-
# self.test_capabilities['selective'] = False if 'No' in line else True
10271028
# SMART Attribute table parsing
10281029
if all_in(line, '0x0', '_') and not interface == 'nvme':
10291030
# Replace multiple space separators with a single space, then

tests/dataset/singletests/hdd_sata_issue42/device.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@
652652
"short": true,
653653
"long": true,
654654
"conveyance": true,
655-
"selective": false
655+
"selective": true
656656
},
657657
"tests": [
658658
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-5.4.0-126-generic] (local build)
2+
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
3+
4+
=== START OF INFORMATION SECTION ===
5+
Device Model: LITEONIT LCT-512L9S-11 2.5 7mm 512GB
6+
Serial Number: TW0HN71H5508549A1220
7+
Firmware Version: HC9110D
8+
User Capacity: 512,110,190,592 bytes [512 GB]
9+
Sector Size: 512 bytes logical/physical
10+
Rotation Rate: Solid State Device
11+
Device is: Not in smartctl database [for details use: -P showall]
12+
ATA Version is: ATA8-ACS, ATA/ATAPI-7 T13/1532D revision 4a
13+
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
14+
Local Time is: Tue Oct 18 08:18:02 2022 UTC
15+
SMART support is: Available - device has SMART capability.
16+
SMART support is: Enabled
17+
18+
=== START OF READ SMART DATA SECTION ===
19+
SMART overall-health self-assessment test result: PASSED
20+
21+
General SMART Values:
22+
Offline data collection status: (0x00) Offline data collection activity
23+
was never started.
24+
Auto Offline Data Collection: Disabled.
25+
Self-test execution status: ( 0) The previous self-test routine completed
26+
without error or no self-test has ever
27+
been run.
28+
Total time to complete Offline
29+
data collection: ( 10) seconds.
30+
Offline data collection
31+
capabilities: (0x15) SMART execute Offline immediate.
32+
No Auto Offline data collection support.
33+
Abort Offline collection upon new
34+
command.
35+
No Offline surface scan supported.
36+
Self-test supported.
37+
No Conveyance Self-test supported.
38+
No Selective Self-test supported.
39+
SMART capabilities: (0x0003) Saves SMART data before entering
40+
power-saving mode.
41+
Supports SMART auto save timer.
42+
Error logging capability: (0x01) Error logging supported.
43+
General Purpose Logging supported.
44+
Short self-test routine
45+
recommended polling time: ( 1) minutes.
46+
Extended self-test routine
47+
recommended polling time: ( 10) minutes.
48+
SCT capabilities: (0x003d) SCT Status supported.
49+
SCT Error Recovery Control supported.
50+
SCT Feature Control supported.
51+
SCT Data Table supported.
52+
53+
SMART Attributes Data Structure revision number: 1
54+
Vendor Specific SMART Attributes with Thresholds:
55+
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
56+
5 Reallocated_Sector_Ct 0x0003 100 100 000 Pre-fail Always - 0
57+
9 Power_On_Hours 0x0002 100 100 000 Old_age Always - 2376
58+
12 Power_Cycle_Count 0x0003 100 100 000 Pre-fail Always - 1000
59+
175 Program_Fail_Count_Chip 0x0003 100 100 000 Pre-fail Always - 0
60+
176 Erase_Fail_Count_Chip 0x0003 100 100 000 Pre-fail Always - 0
61+
177 Wear_Leveling_Count 0x0003 100 100 000 Pre-fail Always - 21534
62+
178 Used_Rsvd_Blk_Cnt_Chip 0x0003 100 100 000 Pre-fail Always - 0
63+
179 Used_Rsvd_Blk_Cnt_Tot 0x0003 100 100 000 Pre-fail Always - 0
64+
180 Unused_Rsvd_Blk_Cnt_Tot 0x0033 100 100 005 Pre-fail Always - 1472
65+
181 Program_Fail_Cnt_Total 0x0003 100 100 000 Pre-fail Always - 0
66+
182 Erase_Fail_Count_Total 0x0003 100 100 000 Pre-fail Always - 0
67+
187 Reported_Uncorrect 0x0003 100 100 000 Pre-fail Always - 0
68+
195 Hardware_ECC_Recovered 0x0003 100 100 000 Pre-fail Always - 0
69+
241 Total_LBAs_Written 0x0003 100 100 000 Pre-fail Always - 176271
70+
242 Total_LBAs_Read 0x0003 100 100 000 Pre-fail Always - 64812
71+
72+
SMART Error Log Version: 0
73+
No Errors Logged
74+
75+
SMART Self-test log structure revision number 1
76+
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
77+
# 1 Short offline Completed without error 00% 2376 -
78+
# 2 Short offline Completed without error 00% 2376 -
79+
# 3 Short offline Completed without error 00% 1501 -
80+
# 4 Short offline Completed without error 00% 1499 -
81+
# 5 Extended offline Aborted by host 10% 1499 -
82+
# 6 Short offline Completed without error 00% 1498 -
83+
# 7 Short offline Completed without error 00% 1498 -
84+
# 8 Short offline Completed without error 00% 1498 -
85+
# 9 Short offline Completed without error 00% 1454 -
86+
87+
Selective Self-tests/Logging not supported

0 commit comments

Comments
 (0)