From db9fe93ef8567e7084778adbd159fe6045f61c22 Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Wed, 13 Mar 2019 15:53:08 +0100 Subject: crypto: Better error report in crypto_SUITE --- lib/crypto/test/crypto_SUITE.erl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lib/crypto/test') diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index bd540329b5..dfce887d87 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -466,15 +466,17 @@ api_ng_cipher_increment({Type, Key, IV, PlainText0, ExpectedEncText}=_X) -> ok; Enc -> ok; - OtherEnc -> - ct:fail({{crypto, api_ng_encrypt, [IV,EncTexts]}, {expected, ExpectedEncText}, {got, OtherEnc}}) + _ -> + ct:log("encode~nIn: ~p~nExpected: ~p~nEnc: ~p~n", [{Type,Key,IV,PlainTexts}, ExpectedEncText, Enc]), + ct:fail("api_ng_cipher_increment (encode)",[]) end, Plain = iolist_to_binary(PlainTexts), case iolist_to_binary(api_ng_cipher_increment_loop(RefDec, EncTexts)) of Plain -> ok; OtherPT -> - ct:fail({{crypto, api_ng_decrypt, [IV,EncTexts]}, {expected, Plain}, {got, OtherPT}}) + ct:log("decode~nIn: ~p~nExpected: ~p~nDec: ~p~n", [{Type,Key,IV,EncTexts}, Plain, OtherPT]), + ct:fail("api_ng_cipher_increment (encode)",[]) end. @@ -517,15 +519,15 @@ do_api_ng_one_shot({Type, Key, IV, PlainText0, ExpectedEncText}=_X) -> ok; EncTxt -> ok; - OtherEnc -> - ct:log("In: ~p~nOut: ~p",[_X,OtherEnc]), + _ -> + ct:log("encode~nIn: ~p~nExpected: ~p~nEnc: ~p~n", [{Type,Key,IV,PlainText}, ExpectedEncText, EncTxt]), ct:fail("api_ng_one_shot (encode)",[]) end, case crypto:crypto_one_shot(Type, Key, IV, EncTxt, false) of PlainText -> ok; OtherPT -> - ct:log("In: ~p~nOut: ~p",[_X,OtherPT]), + ct:log("decode~nIn: ~p~nExpected: ~p~nDec: ~p~n", [{Type,Key,IV,EncTxt}, PlainText, OtherPT]), ct:fail("api_ng_one_shot (decode)",[]) end. @@ -562,11 +564,11 @@ do_api_ng_tls({Type, Key, IV, PlainText0, ExpectedEncText}=_X) -> EncTxt -> ok; EncTxt2 -> - ct:log("In = ~p,~nEncTxt = ~p~nEncTxt2= ~p", [_X,EncTxt,EncTxt2]), + ct:log("2nd encode~nIn: ~p~nExpected: ~p~nEnc: ~p~n", [{Type,Key,IV,PlainText}, EncTxt, EncTxt2]), ct:fail("api_ng_tls (second encode)",[]) end; OtherEnc -> - ct:log("In: ~p~nOut: ~p",[_X,OtherEnc]), + ct:log("1st encode~nIn: ~p~nExpected: ~p~nEnc: ~p~n", [{Type,Key,IV,PlainText}, ExpectedEncText, OtherEnc]), ct:fail("api_ng_tls (encode)",[]) end, case crypto:crypto_update_dyn_iv(Rdec, EncTxt, IV) of @@ -576,11 +578,11 @@ do_api_ng_tls({Type, Key, IV, PlainText0, ExpectedEncText}=_X) -> PlainText -> ok; PlainText2 -> - ct:log("In = ~p,~nPlainText = ~p~nPlainText2= ~p", [_X,PlainText,PlainText2]), + ct:log("2nd decode~nIn: ~p~nExpected: ~p~nDec: ~p~n", [{Type,Key,IV,EncTxt}, PlainText, PlainText2]), ct:fail("api_ng_tls (second decode)",[]) end; OtherPT -> - ct:log("In: ~p~nOut: ~p",[_X,OtherPT]), + ct:log("1st decode~nIn: ~p~nExpected: ~p~nDec: ~p~n", [{Type,Key,IV,EncTxt}, PlainText, OtherPT]), ct:fail("api_ng_tlst (decode)",[]) end. -- cgit v1.2.3