@@ -328,6 +328,7 @@ static void *iface_setup(void)
328
328
struct net_if_mcast_addr * maddr ;
329
329
struct net_if_addr * ifaddr ;
330
330
const struct device * dev ;
331
+ int64_t oper_state_change_time = -1LL , later_time = -1LL ;
331
332
bool status ;
332
333
int idx , ret ;
333
334
@@ -336,6 +337,12 @@ static void *iface_setup(void)
336
337
337
338
net_if_foreach (iface_cb , NULL );
338
339
340
+ /* Make sure the operational state change time is set properly */
341
+ ret = net_if_oper_state_change_time (iface1 , & oper_state_change_time );
342
+ zassert_equal (ret , 0 , "Cannot get oper state change time" );
343
+ zassert_equal (oper_state_change_time , 0 ,
344
+ "Invalid oper state change time" );
345
+
339
346
idx = net_if_get_by_iface (iface1 );
340
347
((struct net_if_test * )
341
348
net_if_get_device (iface1 )-> data )-> idx = idx ;
@@ -381,6 +388,11 @@ static void *iface_setup(void)
381
388
dev -> state -> init_res = 0 ;
382
389
device_ok = true;
383
390
391
+ /* We need to sleep a bit to let the interface
392
+ * operational state change time to be set.
393
+ */
394
+ k_sleep (K_MSEC (10 ));
395
+
384
396
ret = net_if_up (iface1 );
385
397
zassert_equal (ret , 0 , "Interface 1 is not up (%d)" , ret );
386
398
@@ -463,6 +475,14 @@ static void *iface_setup(void)
463
475
net_if_up (iface3 );
464
476
net_if_up (iface4 );
465
477
478
+ ret = net_if_oper_state_change_time (iface1 , & later_time );
479
+ zassert_equal (ret , 0 , "Cannot get oper state change time" );
480
+ zassert_not_equal (later_time , 0 ,
481
+ "Invalid oper state change time" );
482
+ zassert_true (later_time >= oper_state_change_time ,
483
+ "Invalid oper state change time %" PRId64 " vs %" PRId64 ,
484
+ later_time , oper_state_change_time );
485
+
466
486
/* The interface might receive data which might fail the checks
467
487
* in the iface sending function, so we need to reset the failure
468
488
* flag.
0 commit comments