@@ -197,6 +197,11 @@ class WatchpointTestsImpl:
197
197
""" Watchpoints test cases which are common for dual and single core modes
198
198
"""
199
199
200
+ wp_stop_reason = [dbg .TARGET_STOP_REASON_SIGTRAP , dbg .TARGET_STOP_REASON_WP ]
201
+ compare_offset = 0
202
+ if testee_info .arch == "xtensa" or testee_info .idf_ver == IdfVersion .fromstr ('latest' ):
203
+ compare_offset = 1
204
+
200
205
def test_wp_simple (self ):
201
206
"""
202
207
This simple test checks general watchpoints usage scenario.
@@ -213,23 +218,19 @@ def test_wp_simple(self):
213
218
for e in self .wps :
214
219
self .add_wp (e , 'rw' )
215
220
cnt = 0
216
- wp_stop_reason = [dbg .TARGET_STOP_REASON_SIGTRAP , dbg .TARGET_STOP_REASON_WP ]
217
221
for i in range (3 ):
218
222
# 'count' read
219
- self .run_to_bp_and_check (wp_stop_reason , 'blink_task' , ['s_count10' ])
223
+ self .run_to_bp_and_check (self . wp_stop_reason , 'blink_task' , ['s_count10' ])
220
224
var_val = int (self .gdb .data_eval_expr ('s_count1' ))
221
225
self .assertEqual (var_val , cnt )
222
226
# 'count' read
223
- self .run_to_bp_and_check (wp_stop_reason , 'blink_task' , ['s_count11' ])
227
+ self .run_to_bp_and_check (self . wp_stop_reason , 'blink_task' , ['s_count11' ])
224
228
var_val = int (self .gdb .data_eval_expr ('s_count1' ))
225
229
self .assertEqual (var_val , cnt )
226
230
# 'count' write
227
- self .run_to_bp_and_check (wp_stop_reason , 'blink_task' , ['s_count11' ])
231
+ self .run_to_bp_and_check (self . wp_stop_reason , 'blink_task' , ['s_count11' ])
228
232
var_val = int (self .gdb .data_eval_expr ('s_count1' ))
229
- if testee_info .arch == "xtensa" or testee_info .idf_ver > IdfVersion .fromstr ('5.0' ):
230
- self .assertEqual (var_val , cnt + 1 )
231
- else :
232
- self .assertEqual (var_val , cnt )
233
+ self .assertEqual (var_val , cnt + self .compare_offset )
233
234
cnt += 1
234
235
235
236
def test_wp_and_reconnect (self ):
@@ -251,25 +252,16 @@ def test_wp_and_reconnect(self):
251
252
cnt2 = 100
252
253
for e in self .wps :
253
254
self .add_wp (e , 'w' )
254
- wp_stop_reason = [dbg .TARGET_STOP_REASON_SIGTRAP ]
255
- if testee_info .idf_ver >= IdfVersion .fromstr ('5.1' ):
256
- wp_stop_reason .append (dbg .TARGET_STOP_REASON_WP )
257
255
for i in range (5 ):
258
256
if (i % 2 ) == 0 :
259
- self .run_to_bp_and_check (wp_stop_reason , 'blink_task' , ['s_count11' ])
257
+ self .run_to_bp_and_check (self . wp_stop_reason , 'blink_task' , ['s_count11' ])
260
258
var_val = int (self .gdb .data_eval_expr ('s_count1' ))
261
- if testee_info .arch == "xtensa" or testee_info .idf_ver > IdfVersion .fromstr ('5.0' ):
262
- self .assertEqual (var_val , cnt + 1 )
263
- else :
264
- self .assertEqual (var_val , cnt )
259
+ self .assertEqual (var_val , cnt + self .compare_offset )
265
260
cnt += 1
266
261
else :
267
- self .run_to_bp_and_check (wp_stop_reason , 'blink_task' , ['s_count2' ])
262
+ self .run_to_bp_and_check (self . wp_stop_reason , 'blink_task' , ['s_count2' ])
268
263
var_val = int (self .gdb .data_eval_expr ('s_count2' ))
269
- if testee_info .arch == "xtensa" or testee_info .idf_ver > IdfVersion .fromstr ('5.0' ):
270
- self .assertEqual (var_val , cnt2 - 1 )
271
- else :
272
- self .assertEqual (var_val , cnt2 )
264
+ self .assertEqual (var_val , cnt2 - self .compare_offset )
273
265
cnt2 -= 1
274
266
self .gdb .disconnect ()
275
267
sleep (0.1 ) #sleep 100ms
@@ -324,7 +316,7 @@ def two_cores_concurrently_hit_wps(self):
324
316
for e in self .wps :
325
317
self .add_wp (e , 'w' )
326
318
wp_stop_reason = [dbg .TARGET_STOP_REASON_SIGTRAP ]
327
- if testee_info .idf_ver >= IdfVersion .fromstr ('5.1 ' ):
319
+ if testee_info .arch == "xtensa" or testee_info . idf_ver == IdfVersion .fromstr ('latest ' ):
328
320
wp_stop_reason .append (dbg .TARGET_STOP_REASON_WP )
329
321
for i in range (10 ):
330
322
self .run_to_bp_and_check (wp_stop_reason , 'blink_task' , ['s_count11' , 's_count2' ])
0 commit comments