diff options
Diffstat (limited to 'lib/odbc/test')
-rw-r--r-- | lib/odbc/test/Makefile | 6 | ||||
-rw-r--r-- | lib/odbc/test/odbc.cover | 2 | ||||
-rw-r--r-- | lib/odbc/test/odbc.spec | 34 | ||||
-rw-r--r-- | lib/odbc/test/odbc_connect_SUITE.erl | 43 | ||||
-rw-r--r-- | lib/odbc/test/odbc_data_type_SUITE.erl | 81 | ||||
-rw-r--r-- | lib/odbc/test/odbc_query_SUITE.erl | 78 | ||||
-rw-r--r-- | lib/odbc/test/odbc_start_SUITE.erl | 22 | ||||
-rw-r--r-- | lib/odbc/test/odbc_test_lib.erl | 2 |
8 files changed, 150 insertions, 118 deletions
diff --git a/lib/odbc/test/Makefile b/lib/odbc/test/Makefile index 935ecbf5a7..ab3cdea543 100644 --- a/lib/odbc/test/Makefile +++ b/lib/odbc/test/Makefile @@ -45,8 +45,8 @@ HRL_FILES= odbc_test.hrl\ TARGET_FILES= \ $(MODULES:%=$(EBIN)/%.$(EMULATOR)) -SPEC_FILES = odbc.spec odbc.dynspec \ - odbc.spec.win +SPEC_FILES = odbc.spec +COVER_FILE = odbc.cover EMAKEFILE = Emakefile MAKE_EMAKE = $(wildcard $(ERL_TOP)/make/make_emakefile) @@ -101,7 +101,7 @@ release_spec: opt release_tests_spec: opt $(INSTALL_DIR) $(RELSYSDIR) - $(INSTALL_DATA) $(SPEC_FILES) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(SPEC_FILES) $(COVER_FILE) $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR) release_docs_spec: diff --git a/lib/odbc/test/odbc.cover b/lib/odbc/test/odbc.cover new file mode 100644 index 0000000000..1acca281fb --- /dev/null +++ b/lib/odbc/test/odbc.cover @@ -0,0 +1,2 @@ +{incl_app,odbc,details}. + diff --git a/lib/odbc/test/odbc.spec b/lib/odbc/test/odbc.spec index acba9f8d98..edaf821c91 100644 --- a/lib/odbc/test/odbc.spec +++ b/lib/odbc/test/odbc.spec @@ -1,9 +1,25 @@ -{topcase, {dir, "../odbc_test"}}. -{skip, {odbc_data_type_SUITE, varchar_upper_limit, "Known bug in database"}}. -{skip, {odbc_data_type_SUITE, text_upper_limit, "Consumes too much resources"}}. -{skip, {odbc_data_type_SUITE, bit_true , "Not supported by driver"}}. -{skip, {odbc_data_type_SUITE, bit_false, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_select_result_sets,"Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_mix_result_sets, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, multiple_result_sets_error, "Not supported by driver"}}. -{skip, {odbc_query_SUITE, param_insert_tiny_int, "Not supported by driver"}}.
\ No newline at end of file +{suites,"../odbc_test",all}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [varchar_upper_limit], + "Known bug in database"}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [text_upper_limit], + "Consumes too much resources"}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [bit_true], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_data_type_SUITE, + [bit_false], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [multiple_select_result_sets], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [multiple_mix_result_sets], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [multiple_result_sets_error], + "Not supported by driver"}. +{skip_cases,"../odbc_test",odbc_query_SUITE, + [param_insert_tiny_int], + "Not supported by driver"}. diff --git a/lib/odbc/test/odbc_connect_SUITE.erl b/lib/odbc/test/odbc_connect_SUITE.erl index 4d37a8f543..fd7693de3a 100644 --- a/lib/odbc/test/odbc_connect_SUITE.erl +++ b/lib/odbc/test/odbc_connect_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -40,20 +40,32 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests the ability to connect and disconnet to/from the database"]; -all(suite) -> + +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); + ok -> + [not_exist_db, commit, rollback, not_explicit_commit, + no_c_node, port_dies, control_process_dies, + {group, client_dies}, connect_timeout, timeout, + many_timeouts, timeout_reset, disconnect_on_timeout, + connection_closed, disable_scrollable_cursors, + return_rows_as_lists, api_missuse]; Other -> {skip, Other} - end. + end. + +groups() -> + [{client_dies, [], + [client_dies_normal, client_dies_timeout, + client_dies_error]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all() -> - [not_exist_db, commit, rollback, not_explicit_commit, - no_c_node, port_dies, control_process_dies, client_dies, - connect_timeout, timeout, many_timeouts, timeout_reset, - disconnect_on_timeout, connection_closed, - disable_scrollable_cursors, return_rows_as_lists, api_missuse]. %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config @@ -66,7 +78,7 @@ all() -> %%-------------------------------------------------------------------- init_per_suite(Config) -> application:start(odbc), - case odbc:connect(?RDBMS:connection_string(), + case catch odbc:connect(?RDBMS:connection_string(), [{auto_commit, off}]) of {ok, Ref} -> odbc:disconnect(Ref), @@ -283,11 +295,6 @@ control_process_dies(_Config) -> ok. %%------------------------------------------------------------------------- -client_dies(doc) -> - ["Test that the odbc process is terminated when the client process " - "dies"]; -client_dies(suite) -> - [client_dies_normal, client_dies_timeout, client_dies_error]. %%------------------------------------------------------------------------- client_dies_normal(doc) -> diff --git a/lib/odbc/test/odbc_data_type_SUITE.erl b/lib/odbc/test/odbc_data_type_SUITE.erl index 7d4a0ca15f..83bb821e2b 100644 --- a/lib/odbc/test/odbc_data_type_SUITE.erl +++ b/lib/odbc/test/odbc_data_type_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include_lib("stdlib/include/ms_transform.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -39,16 +39,48 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests data types"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); - Other -> {skip,Other} - end. + ok -> + [{group, char}, {group, int}, {group, floats}, + {group, dec_and_num}, timestamp]; + Other -> {skip, Other} + end. -all() -> - [char, int, floats, dec_and_num, timestamp]. +groups() -> + [{char, [], + [char_fixed_lower_limit, char_fixed_upper_limit, + char_fixed_padding, varchar_lower_limit, + varchar_upper_limit, varchar_no_padding, + text_lower_limit, text_upper_limit, unicode]}, + {binary_char, [], + [binary_char_fixed_lower_limit, + binary_char_fixed_upper_limit, + binary_char_fixed_padding, binary_varchar_lower_limit, + binary_varchar_upper_limit, binary_varchar_no_padding, + binary_text_lower_limit, binary_text_upper_limit, + unicode]}, + {int, [], + [tiny_int_lower_limit, tiny_int_upper_limit, + small_int_lower_limit, small_int_upper_limit, + int_lower_limit, int_upper_limit, big_int_lower_limit, + big_int_upper_limit, bit_false, bit_true]}, + {floats, [], + [float_lower_limit, float_upper_limit, float_zero, + real_zero]}, + {dec_and_num, [], + [dec_long, dec_double, dec_bignum, num_long, num_double, + num_bignum]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config @@ -124,14 +156,6 @@ end_per_testcase(_TestCase, Config) -> %%------------------------------------------------------------------------- %% Test cases starts here. %%------------------------------------------------------------------------- -char(doc) -> - ["Tests char data types"]; - -char(suite) -> - [char_fixed_lower_limit, char_fixed_upper_limit, - char_fixed_padding, varchar_lower_limit, varchar_upper_limit, - varchar_no_padding, text_lower_limit, text_upper_limit, unicode - ]. char_fixed_lower_limit(doc) -> ["Tests fixed length char data type lower boundaries."]; @@ -424,14 +448,6 @@ text_upper_limit(Config) when is_list(Config) -> %% ok. %%------------------------------------------------------------------------- -binary_char(doc) -> - ["Tests char data types returned as erlang binaries"]; - -binary_char(suite) -> - [binary_char_fixed_lower_limit, binary_char_fixed_upper_limit, - binary_char_fixed_padding, binary_varchar_lower_limit, binary_varchar_upper_limit, - binary_varchar_no_padding, binary_text_lower_limit, binary_text_upper_limit, unicode - ]. binary_char_fixed_lower_limit(doc) -> ["Tests fixed length char data type lower boundaries."]; @@ -726,13 +742,6 @@ binary_text_upper_limit(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -int(doc) -> - ["Tests integer data types"]; - -int(suite) -> - [tiny_int_lower_limit, tiny_int_upper_limit, small_int_lower_limit, - small_int_upper_limit, int_lower_limit, int_upper_limit, - big_int_lower_limit, big_int_upper_limit, bit_false, bit_true]. %%------------------------------------------------------------------------- @@ -1053,10 +1062,6 @@ bit_true(Config) when is_list(Config) -> %%------------------------------------------------------------------------- -floats(doc) -> - ["Test the datatype float."]; -floats(suite) -> - [float_lower_limit, float_upper_limit, float_zero, real_zero]. %%------------------------------------------------------------------------- float_lower_limit(doc) -> @@ -1184,10 +1189,6 @@ real_zero(Config) when is_list(Config) -> ok end. %%------------------------------------------------------------------------- -dec_and_num(doc) -> - ["Tests decimal and numeric datatypes."]; -dec_and_num(suite) -> - [dec_long, dec_double, dec_bignum, num_long, num_double, num_bignum]. %%------------------------------------------------------------------------ dec_long(doc) -> [""]; diff --git a/lib/odbc/test/odbc_query_SUITE.erl b/lib/odbc/test/odbc_query_SUITE.erl index 12b39be3b7..5c8126ace6 100644 --- a/lib/odbc/test/odbc_query_SUITE.erl +++ b/lib/odbc/test/odbc_query_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -38,22 +38,47 @@ %% Description: Returns documentation/test cases in this test suite %% or a skip tuple if the platform is not supported. %%-------------------------------------------------------------------- -all(doc) -> - ["Tests SQL queries"]; -all(suite) -> +suite() -> [{ct_hooks,[ts_install_cth]}]. + +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); + ok -> + [sql_query, first, last, next, prev, select_count, + select_next, select_relative, select_absolute, + create_table_twice, delete_table_twice, duplicate_key, + not_connection_owner, no_result_set, query_error, + multiple_select_result_sets, multiple_mix_result_sets, + multiple_result_sets_error, + {group, parameterized_queries}, {group, describe_table}, + delete_nonexisting_row]; Other -> {skip, Other} - end. + end. -all() -> - [sql_query, first, last, next, prev, select_count,select_next, - select_relative, select_absolute, create_table_twice, - delete_table_twice, duplicate_key, not_connection_owner, - no_result_set, query_error, multiple_select_result_sets, - multiple_mix_result_sets, multiple_result_sets_error, - parameterized_queries, describe_table, - delete_nonexisting_row]. +groups() -> + [{parameterized_queries, [], + [{group, param_integers}, param_insert_decimal, + param_insert_numeric, {group, param_insert_string}, + param_insert_float, param_insert_real, + param_insert_double, param_insert_mix, param_update, + param_delete, param_select]}, + {param_integers, [], + [param_insert_tiny_int, param_insert_small_int, + param_insert_int, param_insert_integer]}, + {param_insert_string, [], + [param_insert_char, param_insert_character, + param_insert_char_varying, + param_insert_character_varying]}, + {describe_table, [], + [describe_integer, describe_string, describe_floating, + describe_dec_num, describe_no_such_table]}]. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. + + %%-------------------------------------------------------------------- @@ -638,23 +663,8 @@ multiple_result_sets_error(Config) when is_list(Config) -> end. %%------------------------------------------------------------------------- -parameterized_queries(doc)-> - ["Tests diffrent variants of parameterized queries."]; -parameterized_queries(suite) -> - %% Note timestamps are inserted with param_query in odbc_data_type_SUITE - %% so no need to test this again. - [param_integers, - param_insert_decimal, param_insert_numeric, - param_insert_string, - param_insert_float, param_insert_real, param_insert_double, - param_insert_mix, param_update, param_delete, param_select]. %%------------------------------------------------------------------------- -param_integers(doc)-> - ["Test insertion of integers by parameterized queries."]; -param_integers(suite) -> - [param_insert_tiny_int, - param_insert_small_int, param_insert_int, param_insert_integer]. %%------------------------------------------------------------------------- param_insert_tiny_int(doc)-> ["Test insertion of tiny ints by parameterized queries."]; @@ -891,11 +901,6 @@ param_insert_numeric(Config) when is_list(Config) -> ok. %%------------------------------------------------------------------------- -param_insert_string(doc) -> - ["Test insertion of strings by parameterized queries."]; -param_insert_string(suite) -> - [param_insert_char, param_insert_character, param_insert_char_varying, - param_insert_character_varying]. %%------------------------------------------------------------------------- param_insert_char(doc)-> @@ -1320,11 +1325,6 @@ param_select(Config) when is_list(Config) -> ok. %%------------------------------------------------------------------------- -describe_table(doc) -> - ["Test describe_table/[2,3]"]; -describe_table(suite) -> - [describe_integer, describe_string, describe_floating, describe_dec_num, - describe_no_such_table]. %%------------------------------------------------------------------------- describe_integer(doc) -> diff --git a/lib/odbc/test/odbc_start_SUITE.erl b/lib/odbc/test/odbc_start_SUITE.erl index 2cca8e4546..902e77d210 100644 --- a/lib/odbc/test/odbc_start_SUITE.erl +++ b/lib/odbc/test/odbc_start_SUITE.erl @@ -24,7 +24,7 @@ %% Note: This directive should only be used in test suites. -compile(export_all). --include("test_server.hrl"). +-include_lib("common_test/include/ct.hrl"). -include("test_server_line.hrl"). -include("odbc_test.hrl"). @@ -98,17 +98,23 @@ end_per_testcase(_TestCase, Config) -> %% Name of a test case. %% Description: Returns a list of all test cases in this test suite %%-------------------------------------------------------------------- -all(doc) -> - ["Test start/stop of odbc"]; +suite() -> [{ct_hooks,[ts_install_cth]}]. -all(suite) -> +all() -> case odbc_test_lib:odbc_check() of - ok -> all(); + ok -> [start]; Other -> {skip, Other} - end. + end. + +groups() -> + []. + +init_per_group(_GroupName, Config) -> + Config. + +end_per_group(_GroupName, Config) -> + Config. -all() -> - [start]. %% Test cases starts here. diff --git a/lib/odbc/test/odbc_test_lib.erl b/lib/odbc/test/odbc_test_lib.erl index 92e895eb87..012eb96e43 100644 --- a/lib/odbc/test/odbc_test_lib.erl +++ b/lib/odbc/test/odbc_test_lib.erl @@ -51,7 +51,7 @@ odbc_check() -> [Other])) end; Other -> - case test_server:os_type() of + case os:type() of {unix, linux} -> ok; Platform -> |