Add a test framework for various wpa_supplicant failure cases
For CONFIG_TESTING_OPTIONS=y builds, add a new test parameter than can be used to trigger various error cases within wpa_supplicant operations to make it easier to test error path processing. "SET test_failure <val>" is used to set which operation fails. For now, 0 = no failures and 1 = scan trigger fails with EBUSY. More operations can be added in the future to extend coverage. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
e60be3b3d4
commit
911942ee64
3 changed files with 13 additions and 0 deletions
|
@ -437,6 +437,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
|||
#endif /* CONFIG_AP */
|
||||
} else if (os_strcasecmp(cmd, "extra_roc_dur") == 0) {
|
||||
wpa_s->extra_roc_dur = atoi(value);
|
||||
} else if (os_strcasecmp(cmd, "test_failure") == 0) {
|
||||
wpa_s->test_failure = atoi(value);
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
#ifndef CONFIG_NO_CONFIG_BLOBS
|
||||
} else if (os_strcmp(cmd, "blob") == 0) {
|
||||
|
@ -6195,6 +6197,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
|
|||
wpa_s->ext_eapol_frame_io = 0;
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
wpa_s->extra_roc_dur = 0;
|
||||
wpa_s->test_failure = WPAS_TEST_FAILURE_NONE;
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
wpa_s->disconnected = 0;
|
||||
|
|
|
@ -90,6 +90,10 @@ static inline int wpa_drv_leave_mesh(struct wpa_supplicant *wpa_s)
|
|||
static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_driver_scan_params *params)
|
||||
{
|
||||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
if (wpa_s->test_failure == WPAS_TEST_FAILURE_SCAN_TRIGGER)
|
||||
return -EBUSY;
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
if (wpa_s->driver->scan2)
|
||||
return wpa_s->driver->scan2(wpa_s->drv_priv, params);
|
||||
return -1;
|
||||
|
|
|
@ -403,6 +403,11 @@ struct rrm_data {
|
|||
u8 next_neighbor_rep_token;
|
||||
};
|
||||
|
||||
enum wpa_supplicant_test_failure {
|
||||
WPAS_TEST_FAILURE_NONE,
|
||||
WPAS_TEST_FAILURE_SCAN_TRIGGER,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wpa_supplicant - Internal data for wpa_supplicant interface
|
||||
*
|
||||
|
@ -940,6 +945,7 @@ struct wpa_supplicant {
|
|||
#ifdef CONFIG_TESTING_OPTIONS
|
||||
struct l2_packet_data *l2_test;
|
||||
unsigned int extra_roc_dur;
|
||||
enum wpa_supplicant_test_failure test_failure;
|
||||
#endif /* CONFIG_TESTING_OPTIONS */
|
||||
|
||||
struct wmm_ac_assoc_data *wmm_ac_assoc_info;
|
||||
|
|
Loading…
Reference in a new issue