fix loaded_programs() race in int-tests

in the integration tests we recenctly switched to using
our internal api to list programs. I was seeing times when
this would race and panic internally (program fd was deleted
by aya WHILE we were trying to get it).  This ensures that
the list succeeded without panicking.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
reviewable/pr560/r3
Andrew Stoycos 2 years ago
parent 57370b574d
commit 9ce22837ed
No known key found for this signature in database
GPG Key ID: 66735B92BB71C096

@ -68,6 +68,7 @@ macro_rules! assert_loaded_and_linked {
($name:literal, $loaded:expr) => {
for i in 0..(MAX_RETRIES + 1) {
let id = loaded_programs()
.filter(|prog| prog.is_ok())
.find(|prog| prog.as_ref().unwrap().name() == $name.as_bytes())
.map(|prog| Some(prog.unwrap().id()));
let mut linked = false;
@ -94,7 +95,10 @@ macro_rules! assert_loaded_and_linked {
macro_rules! assert_loaded {
($name:literal, $loaded:expr) => {
for i in 0..(MAX_RETRIES + 1) {
let state = loaded_programs().any(|prog| prog.unwrap().name() == $name.as_bytes());
let state = loaded_programs()
.filter(|prog| prog.is_ok())
.any(|prog| prog.unwrap().name() == $name.as_bytes());
if state == $loaded {
break;
}

Loading…
Cancel
Save