MCPcopy Create free account
hub / github.com/ARMmbed/DAPLink / MassStorageTester

Class MassStorageTester

test/tests/test_msd.py:71–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69
70
71class MassStorageTester(object):
72
73 RETRY_COUNT = 5
74 DELAY_BEFORE_RETRY_S = 30
75
76 def __init__(self, board, parent_test, test_name):
77 self.board = board
78 self.parent_test = parent_test
79 self.test_name = test_name
80 self._expected_failure_msg = None
81 self._flush_time = 0.1
82 self._load_with_shutils = None
83 self._flush_size = None
84 self._programming_data = None
85 self._mock_file_list = []
86 self._mock_dir_list = []
87 self._mock_file_list_after = []
88 self._mock_dir_list_after = []
89 self._programming_file_name = None
90 self._start = 0
91
92 def set_shutils_copy(self, source_file_name):
93 """
94 Change mode to shutil file copy
95
96 This option cannot be used with set_programming_data.
97 """
98 assert type(source_file_name) is str
99 assert self._load_with_shutils is None
100 self._source_file_name = source_file_name
101 self._load_with_shutils = True
102
103 def set_programming_data(self, data, file_name):
104 """
105 Set data to program over mass storage
106
107 Data should be the conetents of the hex or binary file
108 being loaded. This option cannot be used with set_shutils_copy.
109 """
110 assert type(data) is bytearray
111 assert type(file_name) is str
112 assert(self._load_with_shutils is False or
113 self._load_with_shutils is None)
114 self._load_with_shutils = False
115 self._programming_data = data
116 self._programming_file_name = file_name
117
118 def set_flush_size(self, size):
119 """Set the block size to simulate a flush of"""
120 assert isinstance(size, six.integer_types)
121 self._flush_size = size
122
123 def set_expected_data(self, data, start=0):
124 """Data that should have been written to the device"""
125 assert data is None or type(data) is bytearray
126 self._expected_data = data
127 self._start = start
128

Callers 1

test_mass_storageFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_mass_storageFunction · 0.68