Skip to content

Commit

Permalink
fixed issue #49
Browse files Browse the repository at this point in the history
  • Loading branch information
ralequi committed Oct 18, 2022
1 parent 5f55efb commit 6878ead
Show file tree
Hide file tree
Showing 8 changed files with 826 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Version 1.2.0
- Checks for temperature units (farenheit) and converts to celsius
- Fixed MacOS compatibility issues up to version 11.x
- Fixed some localization (lang) issues
- Fixed issue ([#49](https://github.com/truenas/py-SMART/issues/49)) detecting selective test
capabilities as short/long tests on device parsing

Version 1.1.0
=============
Expand Down
9 changes: 5 additions & 4 deletions pySMART/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,14 +1016,15 @@ class members, including the SMART attribute table and self-test log.
self.test_capabilities['conveyance'] = 'No' not in line
continue

if 'Selective Self-test supported' in line:
self.test_capabilities['selective'] = 'No' not in line
continue

if 'Self-test supported' in line:
self.test_capabilities['short'] = 'No' not in line
self.test_capabilities['long'] = 'No' not in line
continue

# Note: Currently I have not added any support in pySMART for selective Self-tests
# Thus commenting it out
# if 'Selective Self-test supported' in line:
# self.test_capabilities['selective'] = False if 'No' in line else True
# SMART Attribute table parsing
if all_in(line, '0x0', '_') and not interface == 'nvme':
# Replace multiple space separators with a single space, then
Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/singletests/hdd_sata_issue42/device.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@
"short": true,
"long": true,
"conveyance": true,
"selective": false
"selective": true
},
"tests": [
{
Expand Down
87 changes: 87 additions & 0 deletions tests/dataset/singletests/issue_49_sata/_-d_ata_--all__dev_sda
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-5.4.0-126-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model: LITEONIT LCT-512L9S-11 2.5 7mm 512GB
Serial Number: TW0HN71H5508549A1220
Firmware Version: HC9110D
User Capacity: 512,110,190,592 bytes [512 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ATA8-ACS, ATA/ATAPI-7 T13/1532D revision 4a
SATA Version is: SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Tue Oct 18 08:18:02 2022 UTC
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status: (0x00) Offline data collection activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: ( 10) seconds.
Offline data collection
capabilities: (0x15) SMART execute Offline immediate.
No Auto Offline data collection support.
Abort Offline collection upon new
command.
No Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
No Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 1) minutes.
Extended self-test routine
recommended polling time: ( 10) minutes.
SCT capabilities: (0x003d) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.

SMART Attributes Data Structure revision number: 1
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
5 Reallocated_Sector_Ct 0x0003 100 100 000 Pre-fail Always - 0
9 Power_On_Hours 0x0002 100 100 000 Old_age Always - 2376
12 Power_Cycle_Count 0x0003 100 100 000 Pre-fail Always - 1000
175 Program_Fail_Count_Chip 0x0003 100 100 000 Pre-fail Always - 0
176 Erase_Fail_Count_Chip 0x0003 100 100 000 Pre-fail Always - 0
177 Wear_Leveling_Count 0x0003 100 100 000 Pre-fail Always - 21534
178 Used_Rsvd_Blk_Cnt_Chip 0x0003 100 100 000 Pre-fail Always - 0
179 Used_Rsvd_Blk_Cnt_Tot 0x0003 100 100 000 Pre-fail Always - 0
180 Unused_Rsvd_Blk_Cnt_Tot 0x0033 100 100 005 Pre-fail Always - 1472
181 Program_Fail_Cnt_Total 0x0003 100 100 000 Pre-fail Always - 0
182 Erase_Fail_Count_Total 0x0003 100 100 000 Pre-fail Always - 0
187 Reported_Uncorrect 0x0003 100 100 000 Pre-fail Always - 0
195 Hardware_ECC_Recovered 0x0003 100 100 000 Pre-fail Always - 0
241 Total_LBAs_Written 0x0003 100 100 000 Pre-fail Always - 176271
242 Total_LBAs_Read 0x0003 100 100 000 Pre-fail Always - 64812

SMART Error Log Version: 0
No Errors Logged

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 2376 -
# 2 Short offline Completed without error 00% 2376 -
# 3 Short offline Completed without error 00% 1501 -
# 4 Short offline Completed without error 00% 1499 -
# 5 Extended offline Aborted by host 10% 1499 -
# 6 Short offline Completed without error 00% 1498 -
# 7 Short offline Completed without error 00% 1498 -
# 8 Short offline Completed without error 00% 1498 -
# 9 Short offline Completed without error 00% 1454 -

Selective Self-tests/Logging not supported
Loading

0 comments on commit 6878ead

Please sign in to comment.