summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE13
-rw-r--r--.github/PULL_REQUEST_TEMPLATE33
-rw-r--r--.travis.yml11
-rw-r--r--rebar.config2
-rw-r--r--src/ejabberd_app.erl1
-rw-r--r--src/ejabberd_c2s.erl9
-rw-r--r--src/ejabberd_receiver.erl1
-rw-r--r--test/elixir_SUITE.erl25
8 files changed, 59 insertions, 36 deletions
diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE
index 8d1a5f25..d31eb5bb 100644
--- a/.github/ISSUE_TEMPLATE
+++ b/.github/ISSUE_TEMPLATE
@@ -1,16 +1,15 @@
-Please answer these questions before submitting your issue. It may help !
+> What version of ejabberd are you using?
-Thanks!
-1. What version of ejabberd are you using ?
+> What operating system (version) are you using?
-2. What operating system are you using ?
-3. How did you install ejabberd (source, package, distribution) ?
+> How did you install ejabberd (source, package, distribution)?
-4. What did not work as expected ? What that error in the log ?
- What that unexpected behaviour ? What was the expected result ?
+
+> What did not work as expected? Are there error messages in the log? What
+> was the unexpected behavior? What was the expected result?
diff --git a/.github/PULL_REQUEST_TEMPLATE b/.github/PULL_REQUEST_TEMPLATE
index 554cad4b..643d025d 100644
--- a/.github/PULL_REQUEST_TEMPLATE
+++ b/.github/PULL_REQUEST_TEMPLATE
@@ -1,23 +1,20 @@
-We are open to contribution for ejabberd, as Github pull requests (PR).
-Here is a few points to consider before submitting your pull request.
-(You can remove the whole text after reading).
+We are open to contributions for ejabberd, as GitHub pull requests (PR).
+Here are a few points to consider before submitting your PR. (You can
+remove the whole text after reading.)
-1. Does this PR address an issue ?
- Please reference it in PR description.
+1. Does this PR address an issue? Please reference it in the PR
+ description.
-2. Have you properly described the proposed changed ?
+2. Have you properly described the proposed change?
-3. Please, make sure the change is atomic and does only touch the
- needed modules.
- If you have other changes / fixes to provide, please make them as
- separate PR.
+3. Please make sure the change is atomic and does only touch the needed
+ modules. If you have other changes/fixes to provide, please submit
+ them as separate PRs.
-4. If you change or new feature involves backends,
- did you make sure you change is compliant with all backends or
- provide the feature for all backends ?
-
-5. Do you provides tests ?
- How can we check the behaviour of the code ?
+4. If your change or new feature involves storage backends, did you make
+ sure your change works with all backends?
-6. Did you consider documentation changes on project
- processone/docs.ejabberd.im ?
+5. Do you provide tests? How can we check the behavior of the code?
+
+6. Did you consider documentation changes in the
+ processone/docs.ejabberd.im repository?
diff --git a/.travis.yml b/.travis.yml
index 15363180..829b53fa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,9 +1,8 @@
language: erlang
otp_release:
- - 17.1
- 17.5
- - 18.0
+ - 18.2.1
services:
- riak
@@ -22,6 +21,8 @@ before_install:
- sudo add-apt-repository 'deb http://repo.mysql.com/apt/ubuntu/ precise mysql-5.6'
- sudo apt-get -qq update
- sudo apt-get -qq -o Dpkg::Options::=--force-confold install mysql-server-5.6
+ # /END MYSQL 5.6
+
install:
- sudo apt-get -qq install libexpat1-dev libyaml-dev libpam0g-dev libsqlite3-dev
@@ -40,11 +41,13 @@ before_script:
script:
- ./autogen.sh
- - ./configure --prefix=/tmp/ejabberd --enable-all --disable-odbc --disable-elixir
+ - ./configure --prefix=/tmp/ejabberd --enable-all --disable-odbc
- make
- make install
- make xref
- - make test
+ - sed -i -e 's/ct:pal/ct:log/' test/suite.erl
+ - ln -sf ../sql priv/
+ - escript ./rebar skip_deps=true ct -v
- grep -q 'TEST COMPLETE, \([[:digit:]]*\) ok, .* of \1 ' logs/raw.log
after_script:
diff --git a/rebar.config b/rebar.config
index 865517c9..1f064dd5 100644
--- a/rebar.config
+++ b/rebar.config
@@ -36,7 +36,7 @@
{if_var_true, riak, {riakc, ".*", {git, "https://github.com/basho/riak-erlang-client",
"527722d12d0433b837cdb92a60900c2cb5df8942"}}},
{if_var_true, elixir, {elixir, ".*", {git, "https://github.com/elixir-lang/elixir",
- {tag, "v1.2.3"}}}},
+ {tag, "v1.1.1"}}}},
%% TODO: When modules are fully migrated to new structure and mix, we will not need anymore rebar_elixir_plugin
{if_var_true, elixir, {rebar_elixir_plugin, ".*",
{git, "https://github.com/processone/rebar_elixir_plugin", "0.1.0"}}},
diff --git a/src/ejabberd_app.erl b/src/ejabberd_app.erl
index 66de3ceb..e493eac0 100644
--- a/src/ejabberd_app.erl
+++ b/src/ejabberd_app.erl
@@ -256,7 +256,6 @@ start_apps() ->
ejabberd:start_app(fast_tls),
ejabberd:start_app(fast_xml),
ejabberd:start_app(stringprep),
- ejabberd:start_app(ezlib),
ejabberd:start_app(cache_tab).
opt_type(net_ticktime) ->
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 97b75916..a5802a5b 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -999,7 +999,7 @@ resource_conflict_action(U, S, R) ->
acceptnew -> {accept_resource, R};
closenew -> closenew;
setresource ->
- Rnew = iolist_to_binary([randoms:get_string(),randoms:get_string(),randoms:get_string()]),
+ Rnew = new_uniq_id(),
{accept_resource, Rnew}
end.
@@ -1026,8 +1026,7 @@ wait_for_bind({xmlstreamelement, El}, StateData) ->
[{elem, <<"resource">>}, cdata]),
R = case jid:resourceprep(R1) of
error -> error;
- <<"">> ->
- iolist_to_binary([randoms:get_string(),randoms:get_string(),randoms:get_string()]);
+ <<"">> -> new_uniq_id();
Resource -> Resource
end,
case R of
@@ -1913,6 +1912,10 @@ send_trailer(StateData) ->
new_id() -> randoms:get_string().
+new_uniq_id() ->
+ iolist_to_binary([randoms:get_string(),
+ jlib:integer_to_binary(p1_time_compat:unique_integer(positive))]).
+
is_auth_packet(El) ->
case jlib:iq_query_info(El) of
#iq{id = ID, type = Type, xmlns = ?NS_AUTH, sub_el = SubEl} ->
diff --git a/src/ejabberd_receiver.erl b/src/ejabberd_receiver.erl
index 9fdc86f8..0a33e30e 100644
--- a/src/ejabberd_receiver.erl
+++ b/src/ejabberd_receiver.erl
@@ -141,6 +141,7 @@ handle_call({starttls, TLSSocket}, _From, State) ->
handle_call({compress, Data}, _From,
#state{socket = Socket, sock_mod = SockMod} =
State) ->
+ ejabberd:start_app(ezlib),
{ok, ZlibSocket} = ezlib:enable_zlib(SockMod,
Socket),
if Data /= undefined -> do_send(State, Data);
diff --git a/test/elixir_SUITE.erl b/test/elixir_SUITE.erl
index 6243456b..b9a0b1a2 100644
--- a/test/elixir_SUITE.erl
+++ b/test/elixir_SUITE.erl
@@ -8,7 +8,7 @@
%%% Example: Is run with:
%%% ./rebar skip_deps=true ct suites=elixir
%%% or from ejabber overall test suite:
-%%% make test
+%%% make quicktest
%%% @end
%%% Created : 19 Feb 2015 by Mickael Remond <mremond@process-one.net>
%%%-------------------------------------------------------------------
@@ -17,6 +17,10 @@
-compile(export_all).
+init_per_suite(Config) ->
+ check_meck(),
+ Config.
+
init_per_testcase(_TestCase, Config) ->
process_flag(error_handler, ?MODULE),
Config.
@@ -32,9 +36,19 @@ all() ->
[]
end.
+check_meck() ->
+ case catch meck:module_info(module) of
+ meck ->
+ ok;
+ {'EXIT',{undef, _}} ->
+ ct:print("meck is not available. Please make sure you configured ejabberd with --enable-elixir --enable-tools"),
+ ok
+ end.
+
is_elixir_available() ->
case catch elixir:module_info() of
{'EXIT',{undef,_}} ->
+ ct:print("ejabberd has not been build with Elixir support, skipping Elixir tests."),
false;
ModInfo when is_list(ModInfo) ->
true
@@ -55,7 +69,14 @@ run_elixir_test(Func) ->
'Elixir.Code':load_file(list_to_binary(filename:join(test_dir(), atom_to_list(Func)))),
%% I did not use map syntax, so that this file can still be build under R16
ResultMap = 'Elixir.ExUnit':run(),
- {ok, 0} = maps:find(failures, ResultMap).
+ case maps:find(failures, ResultMap) of
+ {ok, 0} ->
+ %% Zero failures
+ ok;
+ {ok, Failures} ->
+ ct:print("Elixir tests failed: ~.10B~nSee logs for details", [Failures]),
+ ct:fail(elixir_test_failure)
+ end.
test_dir() ->
{ok, CWD} = file:get_cwd(),