wpa_supplicant: Add new blacklist tests

This change adds some barebones tests for new blacklisting functionality
to wpas_module_tests.c. The tests ensure some basic functionality for
the functions wpa_blacklist_is_blacklisted() and wpa_blacklist_update().

Signed-off-by: Kevin Lund <kglund@google.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
This commit is contained in:
Kevin Lund 2020-06-11 14:11:18 -07:00 committed by Jouni Malinen
parent 164b8dd8e4
commit bbbb3c04ef

View File

@ -59,6 +59,23 @@ static int wpas_blacklist_module_tests(void)
wpa_blacklist_add(&wpa_s, (u8 *) "333333") < 0)
goto fail;
wpa_blacklist_clear(&wpa_s);
if (wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "333333") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "444444") < 0 ||
!wpa_blacklist_is_blacklisted(&wpa_s, (u8 *) "111111") ||
wpa_blacklist_del(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_is_blacklisted(&wpa_s, (u8 *) "111111") ||
wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0)
goto fail;
wpa_blacklist_update(&wpa_s);
if (!wpa_blacklist_is_blacklisted(&wpa_s, (u8 *) "111111"))
goto fail;
ret = 0;
fail:
wpa_blacklist_clear(&wpa_s);