From cfc6bb25d488aedaef6749d274afa536af31e65f Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 23 Aug 2012 16:22:47 +0200 Subject: Fix boken spec --- lib/common_test/src/ct_hooks.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/common_test/src/ct_hooks.erl b/lib/common_test/src/ct_hooks.erl index d0432b604d..1bcc63738e 100644 --- a/lib/common_test/src/ct_hooks.erl +++ b/lib/common_test/src/ct_hooks.erl @@ -48,7 +48,7 @@ %% @doc Called before any suites are started -spec init(State :: term()) -> ok | - {error, Reason :: term()}. + {fail, Reason :: term()}. init(Opts) -> call(get_new_hooks(Opts, undefined) ++ get_builtin_hooks(Opts), ok, init, []). -- cgit v1.2.3 From d179fbc7d91729cae45ef72296bacc0d911972ab Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 29 Aug 2012 15:19:25 +0200 Subject: crypto: Skip some tests if openssl lib < 0.9.8 OpenSSL 0.9.7 does not support sha224,384,256,512 --- lib/crypto/test/crypto_SUITE.erl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lib') diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl index 1b5bc44dde..7ac693f371 100644 --- a/lib/crypto/test/crypto_SUITE.erl +++ b/lib/crypto/test/crypto_SUITE.erl @@ -349,6 +349,14 @@ hmac_update_sha256(doc) -> hmac_update_sha256(suite) -> []; hmac_update_sha256(Config) when is_list(Config) -> + case openssl_version() of + V when V < 16#908000 -> + {skipped,"OpenSSL version too old"}; + _ -> + hmac_update_sha256_do() + end. + +hmac_update_sha256_do() -> ?line Key = hexstr2bin("00010203101112132021222330313233" "04050607141516172425262734353637" "08090a0b18191a1b28292a2b38393a3b" @@ -368,6 +376,14 @@ hmac_update_sha512(doc) -> hmac_update_sha512(suite) -> []; hmac_update_sha512(Config) when is_list(Config) -> + case openssl_version() of + V when V < 16#908000 -> + {skipped,"OpenSSL version too old"}; + _ -> + hmac_update_sha512_do() + end. + +hmac_update_sha512_do() -> ?line Key = hexstr2bin("00010203101112132021222330313233" "04050607141516172425262734353637" "08090a0b18191a1b28292a2b38393a3b" @@ -406,6 +422,14 @@ hmac_rfc4231(doc) -> hmac_rfc4231(suite) -> []; hmac_rfc4231(Config) when is_list(Config) -> + case openssl_version() of + V when V < 16#908000 -> + {skipped,"OpenSSL version too old"}; + _ -> + hmac_rfc4231_do() + end. + +hmac_rfc4231_do() -> %% Test Case 1 Case1Key = binary:copy(<<16#0b>>, 20), Case1Data = <<"Hi There">>, @@ -1927,3 +1951,11 @@ my_dss_sign(Data,Key) -> ?line S3 = crypto:dss_sign(none, crypto:sha(Raw), Key), [S1,S2,S3]. +openssl_version() -> + case crypto:info_lib() of + [{<<"OpenSSL">>,LibVer,_}] when is_integer(LibVer) -> + LibVer; + _ -> + undefined + end. + -- cgit v1.2.3 From 2d5d3b964942ab75777d2192fb15668e0f86456d Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 29 Aug 2012 21:59:21 +0200 Subject: crypto: Fix buffer overflow bug in rsa_sign --- lib/crypto/c_src/crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index a24747a872..91ab244620 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -1875,7 +1875,7 @@ static int get_rsa_private_key(ErlNifEnv* env, ERL_NIF_TERM key, RSA *rsa) static ERL_NIF_TERM rsa_sign_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {/* (Type, Data|{digest,Digest}, Key=[E,N,D]|[E,N,D,P1,P2,E1,E2,C]) */ ErlNifBinary data_bin, ret_bin; - unsigned char hmacbuf[SHA_DIGEST_LENGTH]; + unsigned char hmacbuf[SHA512_LEN]; unsigned rsa_s_len; RSA* rsa; int i; -- cgit v1.2.3 From 0e5190b8970e6514da9100f5664284c786dee6a2 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 24 Aug 2012 11:09:35 +0200 Subject: Fix compile warning --- lib/common_test/src/cth_surefire.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/common_test/src/cth_surefire.erl b/lib/common_test/src/cth_surefire.erl index e7bd84e51b..76b0f0b5ea 100644 --- a/lib/common_test/src/cth_surefire.erl +++ b/lib/common_test/src/cth_surefire.erl @@ -92,7 +92,7 @@ on_tc_fail(_TC, Res, State) -> {fail,lists:flatten(io_lib:format("~p",[Res]))} }, State#state{ test_cases = [NewTC | tl(TCs)]}. -on_tc_skip(Tc,{Type,Reason} = Res, State) when Type == tc_auto_skip -> +on_tc_skip(Tc,{Type,_Reason} = Res, State) when Type == tc_auto_skip -> do_tc_skip(Res, end_tc(Tc,[],Res,init_tc(State,[]))); on_tc_skip(_Tc, _Res, State = #state{test_cases = []}) -> State; -- cgit v1.2.3 From 74dc5ada9156ed1dd8bb73d6b298b2cdcf3cf3dc Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 24 Aug 2012 11:10:21 +0200 Subject: Generate tags in edoc xml headings --- lib/erl_docgen/src/docgen_edoc_xml_cb.erl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl index 20daae8215..cbaa93a15d 100644 --- a/lib/erl_docgen/src/docgen_edoc_xml_cb.erl +++ b/lib/erl_docgen/src/docgen_edoc_xml_cb.erl @@ -338,7 +338,7 @@ otp_xmlify_e(#xmlElement{name=code} = E) -> % 4) end; otp_xmlify_e(#xmlElement{name=Tag} = E) % 5a when Tag==h1; Tag==h2; Tag==h3; Tag==h4; Tag==h5 -> - Content = text_only(E#xmlElement.content), + Content = text_and_a_name_only(E#xmlElement.content), [E#xmlElement{name=b, content=Content}]; otp_xmlify_e(#xmlElement{name=Tag} = E) % 5b-c) when Tag==center; @@ -1161,6 +1161,18 @@ get_text(#xmlElement{content=[#xmlText{value=Text}]}) -> get_text(#xmlElement{content=[E]}) -> get_text(E). +%% text_and_name_only(Es) -> Ts +text_and_a_name_only([#xmlElement{ + name = a, + attributes = [#xmlAttribute{name=name}]} = Name|Es]) -> + [Name|text_and_a_name_only(Es)]; +text_and_a_name_only([#xmlElement{content = Content}|Es]) -> + text_and_a_name_only(Content) ++ text_and_a_name_only(Es); +text_and_a_name_only([#xmlText{} = E |Es]) -> + [E | text_and_a_name_only(Es)]; +text_and_a_name_only([]) -> + []. + %% text_only(Es) -> Ts %% Takes a list of xmlElement and xmlText and return a lists of xmlText. text_only([#xmlElement{content = Content}|Es]) -> -- cgit v1.2.3 From c9034896271dd9fc8f8e19810e06baf46198336d Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 24 Aug 2012 11:11:40 +0200 Subject: Fix broken links --- lib/stdlib/doc/src/unicode_usage.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/stdlib/doc/src/unicode_usage.xml b/lib/stdlib/doc/src/unicode_usage.xml index b7b5d497d0..acd36d2125 100644 --- a/lib/stdlib/doc/src/unicode_usage.xml +++ b/lib/stdlib/doc/src/unicode_usage.xml @@ -212,7 +212,7 @@ Eshell V5.7 (abort with ^G)
Unicode in environment variables and parameters

Environment variables and their interpretation is handled much in the same way as file names. If Unicode file names are enabled, environment variables as well as parameters to the Erlang VM are expected to be in Unicode.

-

If Unicode file names are enabled, the calls to os:getenv/0, os:getenv/1 and os:putenv/2 will handle Unicode strings. On Unix-like platforms, the built-in functions will translate environment variables in UTF-8 to/from Unicode strings, possibly with codepoints > 255. On Windows the Unicode versions of the environment system API will be used, also allowing for codepoints > 255.

+

If Unicode file names are enabled, the calls to os:getenv/0, os:getenv/1 and os:putenv/2 will handle Unicode strings. On Unix-like platforms, the built-in functions will translate environment variables in UTF-8 to/from Unicode strings, possibly with codepoints > 255. On Windows the Unicode versions of the environment system API will be used, also allowing for codepoints > 255.

On Unix-like operating systems, parameters are expected to be UTF-8 without translation if Unicode file names are enabled.

-- cgit v1.2.3 From 7a57b91fd08f3ca9bffb8d5a02ab797a10a21ec8 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 28 Aug 2012 16:50:41 +0200 Subject: Do not verify del_path as it is not always there --- lib/asn1/test/asn1_SUITE.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl index 56f31de638..b0c37d79e7 100644 --- a/lib/asn1/test/asn1_SUITE.erl +++ b/lib/asn1/test/asn1_SUITE.erl @@ -248,7 +248,7 @@ init_per_testcase(Func, Config) -> [{case_dir, CaseDir}, {watchdog, Dog}|Config]. end_per_testcase(_Func, Config) -> - true = code:del_path(?config(case_dir, Config)), + code:del_path(?config(case_dir, Config)), test_server:timetrap_cancel(?config(watchdog, Config)). %%------------------------------------------------------------------------------ -- cgit v1.2.3 From c0ef28d5eecffc56b72a281a6d73f5ad1504bf0a Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 29 Aug 2012 15:12:51 +0200 Subject: Document that CTHs can get fail/skip as Config OTP-10077 --- lib/common_test/doc/src/ct_hooks.xml | 20 +++++++++++++------- lib/common_test/doc/src/ct_hooks_chapter.xml | 7 +++++++ 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/common_test/doc/src/ct_hooks.xml b/lib/common_test/doc/src/ct_hooks.xml index b98c04a850..b3e713c77f 100644 --- a/lib/common_test/doc/src/ct_hooks.xml +++ b/lib/common_test/doc/src/ct_hooks.xml @@ -5,7 +5,7 @@
- 20102011 + 20102012 Ericsson AB. All Rights Reserved. @@ -111,11 +111,12 @@ - Module:pre_init_per_suite(SuiteName, Config, CTHState) -> + Module:pre_init_per_suite(SuiteName, InitData, CTHState) -> Result Called before init_per_suite SuiteName = atom() + InitData = Config | SkipOrFail Config = NewConfig = [{Key,Value}] CTHState = NewCTHState = term() Result = {Return, NewCTHState} @@ -140,7 +141,8 @@

SuiteName is the name of the suite to be run.

-

Config is the original config list of the test suite.

+

InitData is the original config list of the test suite, or + a SkipOrFail tuple if a previous CTH has returned this.

CTHState is the current internal state of the CTH.

@@ -212,11 +214,12 @@
- Module:pre_init_per_group(GroupName, Config, CTHState) -> + Module:pre_init_per_group(GroupName, InitData, CTHState) -> Result Called before init_per_group GroupName = atom() + InitData = Config | SkipOrFail Config = NewConfig = [{Key,Value}] CTHState = NewCTHState = term() Result = {NewConfig | SkipOrFail, NewCTHState} @@ -269,11 +272,12 @@ - Module:pre_init_per_testcase(TestcaseName, Config, CTHState) -> + Module:pre_init_per_testcase(TestcaseName, InitData, CTHState) -> Result Called before init_per_testcase TestcaseName = atom() + InitData = Config | SkipOrFail Config = NewConfig = [{Key,Value}] CTHState = NewCTHState = term() Result = {NewConfig | SkipOrFail, NewCTHState} @@ -330,11 +334,12 @@ - Module:pre_end_per_group(GroupName, Config, CTHState) -> + Module:pre_end_per_group(GroupName, EndData, CTHState) -> Result Called before end_per_group GroupName = atom() + EndData = Config | SkipOrFail Config = NewConfig = [{Key,Value}] CTHState = NewCTHState = term() Result = {NewConfig | SkipOrFail, NewCTHState} @@ -387,11 +392,12 @@ - Module:pre_end_per_suite(SuiteName, Config, CTHState) -> + Module:pre_end_per_suite(SuiteName, EndData, CTHState) -> Result Called before end_per_suite SuiteName = atom() + EndData = Config | SkipOrFail Config = NewConfig = [{Key,Value}] CTHState = NewCTHState = term() Result = {NewConfig | SkipOrFail, NewCTHState} diff --git a/lib/common_test/doc/src/ct_hooks_chapter.xml b/lib/common_test/doc/src/ct_hooks_chapter.xml index c938851e0e..86237f5fc1 100644 --- a/lib/common_test/doc/src/ct_hooks_chapter.xml +++ b/lib/common_test/doc/src/ct_hooks_chapter.xml @@ -252,6 +252,13 @@ {ok, Handle} -> {[{db_handle, Handle} | Config], CTHState#state{ handle = Handle }} end. + If using multiple CTHs, the first part of the return tuple will be + used as input for the next CTH. So in the case above the next CTH might + get {fail,Reason} as the second parameter. If you have many CTHs + which interact, it might be a good idea to not let each CTH return + fail or skip. Instead return that an action should be taken + through the Config list and implement a CTH which at the end takes + the correct action.
-- cgit v1.2.3