3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-21 22:09:23 +01:00

unit: Only run tests if checksum is available

This commit is contained in:
Denis Kenzior 2017-06-01 16:30:14 -05:00
parent d46489c4ee
commit 23d9b4c089
11 changed files with 76 additions and 11 deletions

View File

@ -142,10 +142,16 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_cmac_aes_supported()) {
printf("AES-CMAC support missing, skipping...\n");
goto done;
}
l_test_add("/cmac-aes/Example 1", cmac_test, &example_1);
l_test_add("/cmac-aes/Example 2", cmac_test, &example_2);
l_test_add("/cmac-aes/Exmaple 3", cmac_test, &example_3);
l_test_add("/cmac-aes/Exmaple 4", cmac_test, &example_4);
done:
return l_test_run();
}

View File

@ -339,6 +339,11 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_SHA1, true)) {
printf("SHA1 support missing, skipping...\n");
goto done;
}
l_test_add("/Passphrase Generator/PSK Test Case 1",
psk_test, &psk_test_case_1);
l_test_add("/Passphrase Generator/PSK Test Case 2",
@ -355,5 +360,6 @@ int main(int argc, char *argv[])
l_test_add("/PTK Derivation/PTK Test Case 4",
ptk_test, &ptk_test_4);
done:
return l_test_run();
}

View File

@ -135,6 +135,11 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_MD4, false)) {
printf("MD4 support missing, skipping...\n");
goto done;
}
l_test_add("MSHAPv2 nt_password-hash",
test_nt_password_hash, NULL);
l_test_add("MSHAPv2 generate_nt_response",
@ -146,5 +151,6 @@ int main(int argc, char *argv[])
l_test_add("MSHAPv2 authenticator_response",
test_authenticator_response, NULL);
done:
return l_test_run();
}

View File

@ -3177,6 +3177,10 @@ int main(int argc, char *argv[])
l_test_add("/EAPoL Key/Key Frame 32",
eapol_key_test, &eapol_key_test_32);
if (!l_checksum_is_supported(L_CHECKSUM_MD5, true) ||
!l_checksum_is_supported(L_CHECKSUM_SHA1, true))
goto done;
l_test_add("/EAPoL Key/MIC Test 1",
eapol_key_mic_test, &eapol_key_mic_test_1);
l_test_add("/EAPoL Key/MIC Test 2",
@ -3220,5 +3224,6 @@ int main(int argc, char *argv[])
l_test_add("EAPoL/FT-Using-PSK 4-Way Handshake",
&eapol_ft_handshake_test, NULL);
done:
return l_test_run();
}

View File

@ -85,8 +85,14 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_MD5, true)) {
printf("MD5 support missing, skipping...\n");
goto done;
}
l_test_add("/hmac-md5/Test case 1", hmac_test, &test_case_1);
l_test_add("/hmac-md5/Test case 2", hmac_test, &test_case_2);
done:
return l_test_run();
}

View File

@ -85,8 +85,14 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_SHA1, true)) {
printf("SHA1 support missing, skipping...\n");
goto done;
}
l_test_add("/hmac-sha1/Test case 1", hmac_test, &test_case_1);
l_test_add("/hmac-sha1/Test case 2", hmac_test, &test_case_2);
done:
return l_test_run();
}

View File

@ -87,8 +87,14 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_SHA256, true)) {
printf("SHA256 support missing, skipping...\n");
goto done;
}
l_test_add("/hmac-sha256/Test case 1", hmac_test, &test_case_1);
l_test_add("/hmac-sha256/Test case 2", hmac_test, &test_case_2);
done:
return l_test_run();
}

View File

@ -85,7 +85,13 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_SHA256, true)) {
printf("SHA256 support missing, skipping...\n");
goto done;
}
l_test_add("/kdf-sha256/Test case 1", kdf_test, &test_case_1);
done:
return l_test_run();
}

View File

@ -183,6 +183,11 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_SHA1, true)) {
printf("SHA1 support missing, skipping...\n");
goto done;
}
l_test_add("/pbkdf2-sha1/PBKDF2 Test vector 1",
pbkdf2_test, &pbkdf2_test_vector_1);
l_test_add("/pbkdf2-sha1/PBKDF2 Test vector 2",
@ -211,5 +216,6 @@ int main(int argc, char *argv[])
l_test_add("/pbkdf2-sha1/ATHENA Test vector 7",
pbkdf2_test, &athena_test_vector_7);
done:
return l_test_run();
}

View File

@ -117,9 +117,15 @@ int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
if (!l_checksum_is_supported(L_CHECKSUM_SHA1, true)) {
printf("SHA1 support missing, skipping...\n");
goto done;
}
l_test_add("/prf-sha1/Test case 1", prf_test, &test_case_1);
l_test_add("/prf-sha1/Test case 2", prf_test, &test_case_2);
l_test_add("/prf-sha1/Test case 3", prf_test, &test_case_3);
done:
return l_test_run();
}

View File

@ -2233,22 +2233,24 @@ int main(int argc, char *argv[])
l_test_add("/wsc/build/probe request 1", wsc_test_build_probe_request,
&probe_request_data_1);
l_test_add("/wsc/pin/valid pin", wsc_test_pin_valid, NULL);
l_test_add("/wsc/pin/valid checksum", wsc_test_pin_checksum, NULL);
l_test_add("/wsc/pin/generate", wsc_test_pin_generate, NULL);
l_test_add("/wsc/gen_uuid/1", wsc_test_uuid_from_addr,
&uuid_from_addr_data_1);
l_test_add("/wsc/diffie-hellman/generate pubkey 1",
wsc_test_dh_generate_pubkey,
&dh_generate_pubkey_test_data_1);
l_test_add("/wsc/diffie-hellman/generate pubkey 2",
wsc_test_dh_generate_pubkey,
&dh_generate_pubkey_test_data_2);
l_test_add("/wsc/parse/m1 1", wsc_test_parse_m1, &m1_data_1);
l_test_add("/wsc/parse/m1 2", wsc_test_parse_m1, &m1_data_2);
l_test_add("/wsc/build/m1 1", wsc_test_build_m1, &m1_data_1);
l_test_add("/wsc/build/m1 2", wsc_test_build_m1, &m1_data_2);
if (!l_checksum_is_supported(L_CHECKSUM_SHA256, true)) {
printf("SHA256 support missing, skipping other tests...\n");
goto done;
}
l_test_add("/wsc/parse/m2 1", wsc_test_parse_m2, &m2_data_1);
l_test_add("/wsc/parse/m2 2", wsc_test_parse_m2, &m2_data_2);
@ -2295,15 +2297,19 @@ int main(int argc, char *argv[])
l_test_add("/wsc/build/wsc_done 1", wsc_test_build_wsc_done,
&wsc_done_data_1);
l_test_add("/wsc/diffie-hellman/generate pubkey 1",
wsc_test_dh_generate_pubkey,
&dh_generate_pubkey_test_data_1);
l_test_add("/wsc/diffie-hellman/generate pubkey 2",
wsc_test_dh_generate_pubkey,
&dh_generate_pubkey_test_data_2);
l_test_add("/wsc/handshake/PBC Handshake Test",
wsc_test_pbc_handshake, NULL);
l_test_add("/wsc/retransmission/no fragmentation",
wsc_test_retransmission_no_fragmentation, NULL);
l_test_add("/wsc/pin/valid pin", wsc_test_pin_valid, NULL);
l_test_add("/wsc/pin/valid checksum", wsc_test_pin_checksum, NULL);
l_test_add("/wsc/pin/generate", wsc_test_pin_generate, NULL);
done:
return l_test_run();
}