Bug 17141: Add test coverage checking. Necessitates moving all erlang

files to src/.
This commit is contained in:
simon@lshift.net 2007-10-03 16:13:53 +00:00
parent a642aad923
commit 4da5d3047f
6 changed files with 24 additions and 13 deletions

View File

@ -1,15 +1,19 @@
EBIN_DIR=ebin
SOURCE_DIR=src
TEST_SOURCE_DIR=test
INCLUDE_DIR=include
ERLC_FLAGS=-W0
compile:
mkdir -p $(EBIN_DIR)
erlc -I $(INCLUDE_DIR) -o $(EBIN_DIR) $(ERLC_FLAGS) $(SOURCE_DIR)/*.erl
erlc -I $(INCLUDE_DIR) -o $(EBIN_DIR) $(ERLC_FLAGS) $(TEST_SOURCE_DIR)/*.erl
erlc +debug_info -I $(INCLUDE_DIR) -o $(EBIN_DIR) $(ERLC_FLAGS) $(SOURCE_DIR)/*.erl
all: compile
test: compile
erl -pa ebin -noshell -eval 'amqp_network_client_test:test(),halt().'
test_coverage: compile
erl -pa ebin -noshell -eval 'amqp_network_client_test:test_coverage(),halt().'
clean:
rm $(EBIN_DIR)/*.beam

View File

@ -33,7 +33,7 @@ In order to compile/run this code you must have the following
installed:
- Erlang/OTP
- Eunit installed in the standard OTP library path (to run the tests)
- Eunit (from SVN) installed in the standard OTP library path (to run the tests)
- The source of RabbitMQ server 1.2.0
Patch & Install RabbitMQ to OTP Libs Dir
@ -59,16 +59,9 @@ In order to run the network client, you need to run the RabbitMQ server in
a separate Erlang process (or use any other AMQP server). Start your server
as usual.
After you have done this, you can start an Erlang shell in order to run the unit tests:
After you have done this, you can run the unit tests:
$ erl -pa $PATH_TO_AMQPCLIENT_EBIN_DIR
Erlang (BEAM) emulator version 5.5.4 [source] [async-threads:0] [kernel-poll:false]
Eshell V5.5.4 (abort with ^G)
1> amqp_network_client_test:test().
All 4 tests successful.
ok
2>
$ make test
To get more examples of the API, look at the functions in the amqp_test_util module.

View File

@ -1,5 +1,7 @@
-module(amqp_direct_client_test).
-export([test_coverage/0]).
-include_lib("eunit/include/eunit.hrl").
basic_get_test() ->
@ -17,3 +19,8 @@ lifecycle_test() ->
basic_ack_test() ->
Connection = amqp_connection:start("guest", "guest"),
amqp_test_util:basic_ack_test(Connection).
test_coverage() ->
rabbit_misc:enable_cover(),
test(),
rabbit_misc:report_cover().

View File

@ -1,5 +1,7 @@
-module(amqp_network_client_test).
-export([test_coverage/0]).
-include_lib("eunit/include/eunit.hrl").
basic_get_test() ->
@ -17,3 +19,8 @@ lifecycle_test() ->
basic_ack_test() ->
Connection = amqp_connection:start("guest", "guest", "localhost"),
amqp_test_util:basic_ack_test(Connection).
test_coverage() ->
rabbit_misc:enable_cover(),
test(),
rabbit_misc:report_cover().