@ -60,9 +60,12 @@ fn is_linked(prog_id: &u32) -> bool {
macro_rules! assert_loaded_and_linked {
macro_rules! assert_loaded_and_linked {
( $name :literal , $loaded :expr ) = > {
( $name :literal , $loaded :expr ) = > {
for i in 0 .. ( MAX_RETRIES + 1 ) {
for i in 0 .. ( MAX_RETRIES + 1 ) {
// Ignore race failures which can happen when the tests delete a
// program in the middle of a `loaded_programs()` call.
let id = loaded_programs ( )
let id = loaded_programs ( )
. find ( | prog | prog . as_ref ( ) . unwrap ( ) . name ( ) = = $name . as_bytes ( ) )
. filter_map ( | prog | prog . ok ( ) )
. map ( | prog | Some ( prog . unwrap ( ) . id ( ) ) ) ;
. find ( | prog | prog . name ( ) = = $name . as_bytes ( ) )
. map ( | prog | Some ( prog . id ( ) ) ) ;
let mut linked = false ;
let mut linked = false ;
if let Some ( prog_id ) = id {
if let Some ( prog_id ) = id {
linked = is_linked ( & prog_id . unwrap ( ) ) ;
linked = is_linked ( & prog_id . unwrap ( ) ) ;
@ -87,7 +90,12 @@ macro_rules! assert_loaded_and_linked {
macro_rules! assert_loaded {
macro_rules! assert_loaded {
( $name :literal , $loaded :expr ) = > {
( $name :literal , $loaded :expr ) = > {
for i in 0 .. ( MAX_RETRIES + 1 ) {
for i in 0 .. ( MAX_RETRIES + 1 ) {
let state = loaded_programs ( ) . any ( | prog | prog . unwrap ( ) . name ( ) = = $name . as_bytes ( ) ) ;
// Ignore race failures which can happen when the tests delete a
// program in the middle of a `loaded_programs()` call.
let state = loaded_programs ( )
. filter_map ( | prog | prog . ok ( ) )
. any ( | prog | prog . name ( ) = = $name . as_bytes ( ) ) ;
if state = = $loaded {
if state = = $loaded {
break ;
break ;
}
}