diff options
author | Ingela Anderton Andin <ingela@erlang.org> | 2011-05-30 08:25:42 +0200 |
---|---|---|
committer | Ingela Anderton Andin <ingela@erlang.org> | 2011-05-30 08:58:49 +0200 |
commit | b4e89a35e7a443df6f3cf282d5bbdca118bbc4f9 (patch) | |
tree | 0885be9d5b528ba912ca5c6b4c7c1552bc8df693 /lib/odbc/test | |
parent | 7ae73012553fc54e84ad00fc00f7940cabf1edbb (diff) | |
download | otp-b4e89a35e7a443df6f3cf282d5bbdca118bbc4f9.tar.gz otp-b4e89a35e7a443df6f3cf282d5bbdca118bbc4f9.tar.bz2 otp-b4e89a35e7a443df6f3cf282d5bbdca118bbc4f9.zip |
Modernized the test suites
Moved functionality of special specs odbc.dynspec and odbc.spec.win
to the test suites.
Diffstat (limited to 'lib/odbc/test')
-rw-r--r-- | lib/odbc/test/odbc.dynspec | 31 | ||||
-rw-r--r-- | lib/odbc/test/odbc.spec | 24 | ||||
-rw-r--r-- | lib/odbc/test/odbc.spec.win | 5 | ||||
-rw-r--r-- | lib/odbc/test/odbc_connect_SUITE.erl | 3 | ||||
-rw-r--r-- | lib/odbc/test/odbc_data_type_SUITE.erl | 51 | ||||
-rw-r--r-- | lib/odbc/test/odbc_query_SUITE.erl | 6 |
6 files changed, 54 insertions, 66 deletions
diff --git a/lib/odbc/test/odbc.dynspec b/lib/odbc/test/odbc.dynspec deleted file mode 100644 index bb15edceed..0000000000 --- a/lib/odbc/test/odbc.dynspec +++ /dev/null @@ -1,31 +0,0 @@ -%% -*- erlang -*- -%% You can test this file using this command. -%% file:script("odbc.dynspec", [{'Os',"Unix"}]). - -Exists = -fun() -> - case code:lib_dir(odbc) of - {error,bad_name} -> - false; - P -> - %% Make sure that the odbc directory really - %% contains the application (and not only documentation). - case filelib:is_file(filename:join(P, "ebin/odbc.beam")) of - false -> false; - true -> - %% We know that we don't have any odbc libraries - %% installed on this computer. - {ok,Host} = inet:gethostname(), - Host =/= "netsim200" - end - end -end, -case Exists() of - false -> - NoOdbc = "No odbc application", - [{skip, {odbc_connect_SUITE, NoOdbc}}, - {skip, {odbc_data_type_SUITE, NoOdbc}}, - {skip, {odbc_query_SUITE, NoOdbc}}]; - true -> - [] -end. diff --git a/lib/odbc/test/odbc.spec b/lib/odbc/test/odbc.spec index edaf821c91..653f1a780e 100644 --- a/lib/odbc/test/odbc.spec +++ b/lib/odbc/test/odbc.spec @@ -1,25 +1 @@ {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.spec.win b/lib/odbc/test/odbc.spec.win deleted file mode 100644 index 1fd349d2c3..0000000000 --- a/lib/odbc/test/odbc.spec.win +++ /dev/null @@ -1,5 +0,0 @@ -{topcase, {dir, "../odbc_test"}}. -{skip, {odbc_data_type_SUITE, big_int_lower_limit, "Not supported by sqlserver 7.0"}}. -{skip, {odbc_data_type_SUITE, big_int_upper_limit, "Not supported by sqlserver7.0"}}. -{skip, {odbc_data_type_SUITE, text_upper_limit, "Consumes too much resources"}}. - diff --git a/lib/odbc/test/odbc_connect_SUITE.erl b/lib/odbc/test/odbc_connect_SUITE.erl index 6a2268f40e..4772d1a6fc 100644 --- a/lib/odbc/test/odbc_connect_SUITE.erl +++ b/lib/odbc/test/odbc_connect_SUITE.erl @@ -77,7 +77,8 @@ end_per_group(_GroupName, Config) -> %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - application:start(odbc), + %% application:start(odbc), + odbc:start(), % make sure init_per_suite fails if odbc is not built case catch odbc:connect(?RDBMS:connection_string(), [{auto_commit, off}]) of {ok, Ref} -> diff --git a/lib/odbc/test/odbc_data_type_SUITE.erl b/lib/odbc/test/odbc_data_type_SUITE.erl index bfb1e4b329..633ddec27f 100644 --- a/lib/odbc/test/odbc_data_type_SUITE.erl +++ b/lib/odbc/test/odbc_data_type_SUITE.erl @@ -92,7 +92,8 @@ end_per_group(_GroupName, Config) -> %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) -> - application:start(odbc), + %%application:start(odbc), + odbc:start(), % make sure init_per_suite fails if odbc is not built [{tableName, odbc_test_lib:unique_table_name()} | Config]. %%-------------------------------------------------------------------- @@ -117,7 +118,55 @@ end_per_suite(_Config) -> %% Note: This function is free to add any key/value pairs to the Config %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- +init_per_testcase(varchar_upper_limit, _Config) -> + {skip, "Known bug in database"}; +init_per_testcase(text_upper_limit, _Config) -> + {skip, "Consumes too much resources"}; + +init_per_testcase(Case, Config) when Case == bit_true; Case == bit_false -> + case is_supported_bit(?RDBMS) of + true -> + common_init_per_testcase(Case, Config); + false -> + {skip, "Not supported by driver"} + end; + +init_per_testcase(Case, Config) when Case == multiple_select_result_sets; + Case == multiple_mix_result_sets; + Case == multiple_result_sets_error -> + case is_supported_multiple_resultsets(?RDBMS) of + true -> + common_init_per_testcase(Case, Config); + false -> + {skip, "Not supported by driver"} + end; + +init_per_testcase(param_insert_tiny_int = Case, Config) -> + case is_supported_tinyint(?RDBMS) of + true -> + common_init_per_testcase(Case, Config); + false -> + {skip, "Not supported by driver"} + end; init_per_testcase(Case, Config) -> + common_init_per_testcase(Case, Config). + +is_supported_multiple_resultsets(sqlserver) -> + true; +is_supported_multiple_resultsets(_) -> + false. + +is_supported_tinyint(sqlserver) -> + true; +is_supported_tinyint(_) -> + false. + +is_supported_bit(sqlserver) -> + true; +is_supported_bit(_) -> + false. + +common_init_per_testcase(Case, Config) -> case atom_to_list(Case) of "binary" ++ _ -> {ok, Ref} = odbc:connect(?RDBMS:connection_string(), diff --git a/lib/odbc/test/odbc_query_SUITE.erl b/lib/odbc/test/odbc_query_SUITE.erl index 8b8d1e7a40..61106fbf84 100644 --- a/lib/odbc/test/odbc_query_SUITE.erl +++ b/lib/odbc/test/odbc_query_SUITE.erl @@ -78,9 +78,6 @@ init_per_group(_GroupName, Config) -> end_per_group(_GroupName, Config) -> Config. - - - %%-------------------------------------------------------------------- %% Function: init_per_suite(Config) -> Config %% Config - [tuple()] @@ -91,7 +88,8 @@ end_per_group(_GroupName, Config) -> %% variable, but should NOT alter/remove any existing entries. %%-------------------------------------------------------------------- init_per_suite(Config) when is_list(Config) -> - application:start(odbc), + %% application:start(odbc), + odbc:start(), % make sure init_per_suite fails if odbc is not built [{tableName, odbc_test_lib:unique_table_name()}| Config]. %%-------------------------------------------------------------------- |