Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/nvme_copy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

"""

import base64

from nvme_test import TestNVMe


Expand Down Expand Up @@ -44,12 +46,12 @@ def setUp(self):
self.assertEqual(err, 0, "ERROR : nvme get-feature failed")
self.host_behavior_data = result.stdout
# enable cross-namespace copy formats
if self.host_behavior_data[4] & cross_namespace_copy:
if int.from_bytes(base64.b64decode(self.host_behavior_data[4])) & cross_namespace_copy:
# skip if already enabled
print("Cross-namespace copy already enabled, skipping set-features")
self.host_behavior_data = None
else:
data = self.host_behavior_data[:4] + cross_namespace_copy.to_bytes(2, 'little') + self.host_behavior_data[6:]
data = self.host_behavior_data[:4] + str(cross_namespace_copy.to_bytes(2, 'little')) + self.host_behavior_data[6:]
set_features_cmd = f"{self.nvme_bin} set-feature " + \
f"{self.ctrl} --feature-id=0x16 --data-len=512"
result = self.run_cmd(set_features_cmd, stdin_data=data)
Expand Down
Loading