Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebar3 from rkarol #1

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,41 @@
_build
ebin
*.beam
*.sw*
deps
.DS_Store
erl_crash.dump
.eunit
mime.types
.rebar
# rebar
/.cache/
/.eunit/
/.rebar/
/.rebar3/
/_build/
/_checkouts
/deps
/rebar.lock

# work environments
*.bak
*.dump
*.iml
*.plt
.rebar
*.sublime-project
*.sublime-workspace
*.tmp
*_plt
*~
.DS_Store
.idea/
.project
.settings/
.tm_properties
/*.txt
erln8.config
tmp/

# Erlang build/test artifacts
*.app
*.beam
*.coverdata
*.crashdump
/.eqc*
/doc/*.css
/doc/*.html
/doc/*.png
/doc/edoc-info
/ebin/
/log/
17 changes: 17 additions & 0 deletions .thumbs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
minimum_reviewers: 2
merge: true
merge_method: merge
build_steps:
# clean relevant profiles to ensure they succeed
- rebar3 clean --all
- rebar3 as test clean --all
# compile relevant profiles to ensure they succeed
- rebar3 compile
- rebar3 as test compile
# these are the real tests
- rebar3 eunit
- rebar3 dialyzer
# last, but not least, do the docs build?
- rebar3 edoc
org_mode: true
timeout: 1800
9 changes: 2 additions & 7 deletions src/ibrowse_http_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ send_queued_requests([], State) ->
State#state{tunnel_setup_queue = []};
send_queued_requests([{From, Url, Headers, Method, Body, Options, Timeout} | Q],
State) ->
{noreply, State_1} =
{noreply, State_1} =
send_req_1(From, Url, Headers, Method, Body, Options, Timeout, State),
send_queued_requests(Q, State_1).

Expand Down Expand Up @@ -2040,12 +2040,7 @@ cancel_timer(Ref, {eat_message, Msg}) ->
end.

make_req_id() ->
case catch erlang:unique_integer() of
{'EXIT', _} ->
erlang:apply(erlang, now, []);
V ->
V
end.
erlang:unique_integer().

to_lower(Str) when is_binary(Str) ->
to_lower(binary_to_list(Str));
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IBROWSE_EBIN_PATH=../../ibrowse/ebin
IBROWSE_EBIN_PATH ?= ../../ibrowse/ebin

compile:
@erl -pa $(IBROWSE_EBIN_PATH) -make
Expand Down
18 changes: 2 additions & 16 deletions test/ibrowse_load_test.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-module(ibrowse_load_test).
%%-compile(export_all).
-export([
random_seed/0,
start/3,
query_state/0,
shutdown/0,
Expand All @@ -15,19 +14,6 @@
update_unknown_counter/2
]).

-ifdef(new_rand).

-define(RAND, rand).
random_seed() ->
ok.

-else.

-define(RAND, random).
random_seed() ->
random:seed(os:timestamp()).

-endif.

-define(ibrowse_load_test_counters, ibrowse_load_test_counters).

Expand Down Expand Up @@ -123,7 +109,7 @@ spawn_workers(0, _Num_requests, _Parent, Acc) ->
lists:reverse(Acc);
spawn_workers(Num_workers, Num_requests, Parent, Acc) ->
Pid_ref = spawn_monitor(fun() ->
random_seed(),
rand:seed(explus, os:timestamp()),
case catch worker_loop(Parent, Num_requests) of
{'EXIT', Rsn} ->
io:format("Worker crashed with reason: ~p~n", [Rsn]);
Expand Down Expand Up @@ -163,7 +149,7 @@ wait_for_workers([{Pid, Pid_ref} | T] = Pids) ->
worker_loop(Parent, 0) ->
Parent ! {done, self()};
worker_loop(Parent, N) ->
Delay = ?RAND:uniform(100),
Delay = rand:uniform(100),
Url = case Delay rem 10 of
%% Change 10 to some number between 0-9 depending on how
%% much chaos you want to introduce into the server
Expand Down
13 changes: 4 additions & 9 deletions test/ibrowse_test_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@
%%% Created : 17 Oct 2010 by Chandrashekhar Mullaparthi <[email protected]>

-module(ibrowse_test_server).

-export([
start_server/0,
start_server/2,
stop_server/1,
get_conn_pipeline_depth/0
]).

-ifdef(new_rand).
-define(RAND, rand).
-else.
-define(RAND, random).
-endif.

-record(request, {method, uri, version, headers = [], body = [], state}).

-define(dec2hex(X), erlang:integer_to_list(X, 16)).
Expand Down Expand Up @@ -147,7 +142,7 @@ server_loop(Sock, Sock_type, #request{headers = Headers} = Req) ->
server_loop(Sock, Sock_type, #request{});
collect_body ->
server_loop(Sock, Sock_type, Req_1)
end;
end;
{http, Sock, {http_error, Err}} ->
io:format("Error parsing HTTP request:~n"
"Req so far : ~p~n"
Expand Down Expand Up @@ -285,7 +280,7 @@ process_request(Sock, Sock_type,
#request{method='GET',
headers = _Headers,
uri = {abs_path, "/ibrowse_send_file_conn_close"}}) ->
Resp = <<"HTTP/1.1 200 OK\r\nServer: Apache-Coyote/1.1\r\nDate: Wed, 04 Apr 2012 16:53:49 GMT\r\nConnection: close\r\n\r\nblahblah-">>,
Resp = <<"HTTP/1.1 200 OK\r\nServer: Apache-Coyote/1.1\r\nDate: Wed, 04 Apr 2012 16:53:49 GMT\r\nConnection: close\r\n\r\nblahblah-">>,
do_send(Sock, Sock_type, Resp),
timer:sleep(1000),
do_send(Sock, Sock_type, <<"blahblah">>),
Expand All @@ -296,7 +291,7 @@ process_request(Sock, Sock_type, Req) ->
do_trace("Recvd req: ~p~n", [Req]),
Resp = <<"HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n">>,
do_send(Sock, Sock_type, Resp),
timer:sleep(?RAND:uniform(100)).
timer:sleep(rand:uniform(100)).

do_send(Sock, tcp, Resp) ->
gen_tcp:send(Sock, Resp);
Expand Down