diff options
Diffstat (limited to 'lib/dialyzer')
19 files changed, 2231 insertions, 1733 deletions
diff --git a/lib/dialyzer/test/Makefile b/lib/dialyzer/test/Makefile index 5daf132730..a8549278a5 100644 --- a/lib/dialyzer/test/Makefile +++ b/lib/dialyzer/test/Makefile @@ -10,11 +10,13 @@ MODULES= \ opaque_tests_SUITE \ options1_tests_SUITE \ options2_tests_SUITE \ + plt_tests_SUITE \ r9c_tests_SUITE \ race_tests_SUITE \ small_tests_SUITE \ user_tests_SUITE \ - dialyzer_test + dialyzer_common\ + file_utils ERL_FILES= $(MODULES:%=%.erl) @@ -66,7 +68,7 @@ release_spec: opt release_tests_spec: make_emakefile $(INSTALL_DIR) $(RELSYSDIR) $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) $(RELSYSDIR) - $(INSTALL_DATA) dialyzer.spec $(RELSYSDIR) + $(INSTALL_DATA) dialyzer.spec dialyzer_test_constants.hrl $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -) diff --git a/lib/dialyzer/test/callgraph_tests_SUITE.erl b/lib/dialyzer/test/callgraph_tests_SUITE.erl index f1c495827c..6148adf971 100644 --- a/lib/dialyzer/test/callgraph_tests_SUITE.erl +++ b/lib/dialyzer/test/callgraph_tests_SUITE.erl @@ -1,61 +1,52 @@ --module(callgraph_tests_SUITE). - --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. --export([test_missing_functions/1]). - --define(default_timeout, ?t:minutes(1)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). +-module(callgraph_tests_SUITE). -groups() -> []. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). -init_per_group(_GroupName, Config) -> Config. +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([callgraph_tests_SUITE_consistency/1, test_missing_functions/1]). -end_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 1}}]. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, []}, {watchdog, Dog} | Config]. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, []}|Config] + end. -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [test_missing_functions]. - -test_missing_functions(Config) when is_list(Config) -> - ?line run(Config, {test_missing_functions, dir}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. - -fail() -> - io:format("failed\n"), - ?t:fail(). + [callgraph_tests_SUITE_consistency,test_missing_functions]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +callgraph_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +test_missing_functions(Config) -> + case dialyze(Config, test_missing_functions) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + diff --git a/lib/dialyzer/test/dialyzer_common.erl b/lib/dialyzer/test/dialyzer_common.erl new file mode 100644 index 0000000000..cd2e76473a --- /dev/null +++ b/lib/dialyzer/test/dialyzer_common.erl @@ -0,0 +1,377 @@ +%%% File : dialyzer_common.erl +%%% Author : Stavros Aronis <[email protected]> +%%% Description : Generator and common infrastructure for simple dialyzer +%%% test suites (some options, some input files or directories +%%% and the relevant results). +%%% Created : 11 Jun 2010 by Stavros Aronis <stavros@enjoy> + +-module(dialyzer_common). + +-export([check_plt/1, check/4, create_suite/1, + create_all_suites/0, new_tests/2]). + +-include_lib("kernel/include/file.hrl"). + +-define(suite_suffix, "_tests_SUITE"). +-define(data_folder, "_data"). +-define(erlang_extension, ".erl"). +-define(output_file_mode, write). +-define(dialyzer_option_file, "dialyzer_options"). +-define(input_files_directory, "src"). +-define(result_files_directory, "results"). +-define(plt_filename,"dialyzer_plt"). +-define(home_plt_filename,".dialyzer_plt"). +-define(plt_lockfile,"plt_lock"). +-define(required_modules, [kernel,stdlib,compiler,erts,mnesia]). + +-record(suite, {suitename :: string(), + outputfile :: file:io_device(), + options :: options(), + testcases :: [testcase()]}). + +-record(options, {time_limit = 1 :: integer(), + dialyzer_options = [] :: dialyzer:dial_options()}). + +-type options() :: #options{}. +-type testcase() :: {atom(), 'file' | 'dir'}. + +-spec check_plt(string()) -> ok. + +check_plt(OutDir) -> + io:format("Checking plt:"), + PltFilename = filename:join(OutDir, ?plt_filename), + case file:read_file_info(PltFilename) of + {ok, _} -> dialyzer_check_plt(PltFilename); + {error, _ } -> + io:format("No plt found in test run directory!"), + PltLockFile = filename:join(OutDir, ?plt_lockfile), + case file:read_file_info(PltLockFile) of + {ok, _} -> + explain_fail_with_lock(), + fail; + {error, _} -> + io:format("Locking plt generation."), + case file:open(PltLockFile,[?output_file_mode]) of + {ok, OutFile} -> + io:format(OutFile,"Locking plt generation.",[]), + file:close(OutFile); + {error, Reason} -> + io:format("Couldn't write lock file ~p.",[Reason]), + fail + end, + obtain_plt(PltFilename) + end + end. + +dialyzer_check_plt(PltFilename) -> + try dialyzer:run([{analysis_type, plt_check}, + {init_plt, PltFilename}]) of + [] -> ok + catch + Class:Info -> + io:format("Failed. The error was: ~w\n~p",[Class, Info]), + io:format("A previously run dialyzer suite failed to generate" + " a correct plt."), + fail + end. + +explain_fail_with_lock() -> + io:format("Some other suite started creating a plt. It might not have" + " finished (Dialyzer's suites shouldn't run in parallel), or" + " it reached timeout and was killed (in which case" + " plt_timeout, defined in dialyzer_test_constants.hrl" + " should be increased), or it failed."). + +obtain_plt(PltFilename) -> + io:format("Obtaining plt:"), + HomeDir = os:getenv("HOME"), + HomePlt = filename:join(HomeDir, ?home_plt_filename), + io:format("Will try to use ~s as a starting point and add otp apps ~w.", + [HomePlt, ?required_modules]), + try dialyzer:run([{analysis_type, plt_add}, + {apps, ?required_modules}, + {output_plt, PltFilename}, + {init_plt, HomePlt}]) of + [] -> + io:format("Successfully added everything!"), + ok + catch + Class:Reason -> + io:format("Failed. The error was: ~w\n~p",[Class, Reason]), + build_plt(PltFilename) + end. + +build_plt(PltFilename) -> + io:format("Building plt from scratch:"), + try dialyzer:run([{analysis_type, plt_build}, + {apps, ?required_modules}, + {output_plt, PltFilename}]) of + [] -> + io:format("Successfully created plt!"), + ok + catch + Class:Reason -> + io:format("Failed. The error was: ~w\n~p",[Class, Reason]), + fail + end. + +-spec check(atom(), dialyzer:dial_options(), string(), string()) -> + 'same' | {differ, [term()]}. + +check(TestCase, Opts, Dir, OutDir) -> + PltFilename = filename:join(OutDir, ?plt_filename), + SrcDir = filename:join(Dir, ?input_files_directory), + ResDir = filename:join(Dir, ?result_files_directory), + Filename = filename:join(SrcDir, atom_to_list(TestCase)), + Files = + case file_utils:file_type(Filename) of + {ok, 'directory'} -> + {ok, ListFiles} = file_utils:list_dir(Filename, ".erl", + false), + ListFiles; + {error, _} -> + FilenameErl = Filename ++ ".erl", + case file_utils:file_type(FilenameErl) of + {ok, 'regular'} -> [FilenameErl] + end + end, + ResFile = atom_to_list(TestCase), + NewResFile = filename:join(OutDir, ResFile), + OldResFile = filename:join(ResDir, ResFile), + ProperOpts = fix_options(Opts, Dir), + try dialyzer:run([{files, Files},{from, src_code},{init_plt, PltFilename}, + {check_plt, false}|ProperOpts]) of + RawWarns -> + Warns = lists:sort([dialyzer:format_warning(W) || W <- RawWarns]), + case Warns of + [] -> ok; + _ -> + case file:open(NewResFile,[?output_file_mode]) of + {ok, OutFile} -> + io:format(OutFile,"\n~s",[Warns]), + file:close(OutFile); + Other -> erlang:error(Other) + end + end, + case file_utils:diff(NewResFile, OldResFile) of + 'same' -> file:delete(NewResFile), + 'same'; + Any -> escape_strings(Any) + end + catch + Kind:Error -> {'dialyzer crashed', Kind, Error} + end. + +fix_options(Opts, Dir) -> + fix_options(Opts, Dir, []). + +fix_options([], _Dir, Acc) -> + Acc; +fix_options([{pa, Path} | Rest], Dir, Acc) -> + case code:add_patha(filename:join(Dir, Path)) of + true -> fix_options(Rest, Dir, Acc); + {error, _} -> erlang:error("Bad directory for pa: " ++ Path) + end; +fix_options([{DirOption, RelativeDirs} | Rest], Dir, Acc) + when DirOption =:= include_dirs ; + DirOption =:= files_rec ; + DirOption =:= files -> + ProperRelativeDirs = [filename:join(Dir,RDir) || RDir <- RelativeDirs], + fix_options(Rest, Dir, [{include_dirs, ProperRelativeDirs} | Acc]); +fix_options([Opt | Rest], Dir, Acc) -> + fix_options(Rest, Dir, [Opt | Acc]). + +-spec new_tests(string(), [atom()]) -> [atom()]. + +new_tests(Dirname, DeclaredTestcases) -> + SrcDir = filename:join(Dirname, ?input_files_directory), + get_testcases(SrcDir) -- DeclaredTestcases. + +get_testcases(Dirname) -> + {ok, Files} = file_utils:list_dir(Dirname, ".erl", true), + [list_to_atom(filename:basename(F,".erl")) || F <-Files]. + +-spec create_all_suites() -> 'ok'. + +create_all_suites() -> + {ok, Cwd} = file:get_cwd(), + Suites = get_suites(Cwd), + lists:foreach(fun create_suite/1, Suites). + +escape_strings({differ,List}) -> + Map = fun({T,L,S}) -> {T,L,xmerl_lib:export_text(S)} end, + {differ, lists:keysort(3, lists:map(Map, List))}. + +-spec get_suites(file:filename()) -> [string()]. + +get_suites(Dir) -> + case file:list_dir(Dir) of + {error, _} -> []; + {ok, Filenames} -> + FullFilenames = [filename:join(Dir, F) || F <-Filenames ], + Dirs = [suffix(filename:basename(F), "_tests_SUITE_data") || + F <- FullFilenames, + file_utils:file_type(F) =:= {ok, 'directory'}], + [S || {yes, S} <- Dirs] + end. + +suffix(String, Suffix) -> + Index = string:rstr(String, Suffix), + case string:substr(String, Index) =:= Suffix of + true -> {yes, string:sub_string(String,1,Index-1)}; + false -> no + end. + +-spec create_suite(string()) -> 'ok'. + +create_suite(SuiteName) -> + {ok, Cwd} = file:get_cwd(), + SuiteDirN = generate_suite_dir_from_name(Cwd, SuiteName), + OutputFile = generate_suite_file(Cwd, SuiteName), + {OptionsFileN, InputDirN} = check_neccessary_files(SuiteDirN), + generate_suite(SuiteName, OutputFile, OptionsFileN, InputDirN). + +generate_suite_dir_from_name(Cwd, SuiteName) -> + filename:join(Cwd, SuiteName ++ ?suite_suffix ++ ?data_folder). + +generate_suite_file(Cwd, SuiteName) -> + OutputFilename = + filename:join(Cwd, SuiteName ++ ?suite_suffix ++ ?erlang_extension), + case file:open(OutputFilename, [?output_file_mode]) of + {ok, IoDevice} -> IoDevice; + {error, _} = E -> exit({E, OutputFilename}) + end. + +check_neccessary_files(SuiteDirN) -> + InputDirN = filename:join(SuiteDirN, ?input_files_directory), + check_file_exists(InputDirN, directory), + OptionsFileN = filename:join(SuiteDirN, ?dialyzer_option_file), + check_file_exists(OptionsFileN, regular), + {OptionsFileN, InputDirN}. + +check_file_exists(Filename, Type) -> + case file:read_file_info(Filename) of + {ok, FileInfo} -> + case FileInfo#file_info.type of + Type -> ok; + Else -> exit({error, {wrong_input_file_type, Else}}) + end; + {error, _} = E -> exit({E, Filename, Type}) + end. + +generate_suite(SuiteName, OutputFile, OptionsFileN, InputDirN) -> + Options = read_options(OptionsFileN), + TestCases = list_testcases(InputDirN), + Suite = #suite{suitename = SuiteName, outputfile = OutputFile, + options = Options, testcases = TestCases}, + write_suite(Suite), + file:close(OutputFile). + +read_options(OptionsFileN) -> + case file:consult(OptionsFileN) of + {ok, Opts} -> read_options(Opts, #options{}); + _ = E -> exit({error, {incorrect_options_file, E}}) + end. + +read_options([List], Options) when is_list(List) -> + read_options(List, Options); +read_options([], Options) -> + Options; +read_options([{time_limit, TimeLimit}|Opts], Options) -> + read_options(Opts, Options#options{time_limit = TimeLimit}); +read_options([{dialyzer_options, DialyzerOptions}|Opts], Options) -> + read_options(Opts, Options#options{dialyzer_options = DialyzerOptions}). + +list_testcases(Dirname) -> + {ok, Files} = file_utils:list_dir(Dirname, ".erl", true), + [list_to_atom(filename:basename(F,".erl")) || F <-Files]. + +write_suite(Suite) -> + write_header(Suite), + write_consistency(Suite), + write_testcases(Suite). + +write_header(#suite{suitename = SuiteName, outputfile = OutputFile, + options = Options, testcases = TestCases}) -> + Test_Plus_Consistency = + [list_to_atom(SuiteName ++ ?suite_suffix ++ "_consistency")|TestCases], + Exports = format_export(Test_Plus_Consistency), + TimeLimit = Options#options.time_limit, + DialyzerOptions = Options#options.dialyzer_options, + io:format(OutputFile, + "%% ATTENTION!\n" + "%% This is an automatically generated file. Do not edit.\n" + "%% Use './remake' script to refresh it if needed.\n" + "%% All Dialyzer options should be defined in dialyzer_options\n" + "%% file.\n\n" + "-module(~s).\n\n" + "-include(\"ct.hrl\").\n" + "-include(\"dialyzer_test_constants.hrl\").\n\n" + "-export([suite/0, init_per_suite/0, init_per_suite/1,\n" + " end_per_suite/1, all/0]).\n" + "~s\n\n" + "suite() ->\n" + " [{timetrap, {minutes, ~w}}].\n\n" + "init_per_suite() ->\n" + " [{timetrap, ?plt_timeout}].\n" + "init_per_suite(Config) ->\n" + " OutDir = ?config(priv_dir, Config),\n" + " case dialyzer_common:check_plt(OutDir) of\n" + " fail -> {skip, \"Plt creation/check failed.\"};\n" + " ok -> [{dialyzer_options, ~p}|Config]\n" + " end.\n\n" + "end_per_suite(_Config) ->\n" + " ok.\n\n" + "all() ->\n" + " ~p.\n\n" + "dialyze(Config, TestCase) ->\n" + " Opts = ?config(dialyzer_options, Config),\n" + " Dir = ?config(data_dir, Config),\n" + " OutDir = ?config(priv_dir, Config),\n" + " dialyzer_common:check(TestCase, Opts, Dir, OutDir)." + "\n\n" + ,[SuiteName ++ ?suite_suffix, Exports, TimeLimit, + DialyzerOptions, Test_Plus_Consistency]). + +format_export(TestCases) -> + TestCasesArity = + [list_to_atom(atom_to_list(N)++"/1") || N <- TestCases], + TestCaseString = io_lib:format("-export(~p).", [TestCasesArity]), + strip_quotes(lists:flatten(TestCaseString),[]). + +strip_quotes([], Result) -> + lists:reverse(Result); +strip_quotes([$' |Rest], Result) -> + strip_quotes(Rest, Result); +strip_quotes([$\, |Rest], Result) -> + strip_quotes(Rest, [$\ , $\, |Result]); +strip_quotes([C|Rest], Result) -> + strip_quotes(Rest, [C|Result]). + +write_consistency(#suite{suitename = SuiteName, outputfile = OutputFile}) -> + write_consistency(SuiteName, OutputFile). + +write_consistency(SuiteName, OutputFile) -> + io:format(OutputFile, + "~s_consistency(Config) ->\n" + " Dir = ?config(data_dir, Config),\n" + " case dialyzer_common:new_tests(Dir, all()) of\n" + " [] -> ok;\n" + " New -> ct:fail({missing_tests,New})\n" + " end.\n\n", + [SuiteName ++ ?suite_suffix]). + +write_testcases(#suite{outputfile = OutputFile, testcases = TestCases}) -> + write_testcases(OutputFile, TestCases). + +write_testcases(OutputFile, [TestCase| Rest]) -> + io:format(OutputFile, + "~p(Config) ->\n" + " case dialyze(Config, ~p) of\n" + " 'same' -> 'same';\n" + " Error -> ct:fail(Error)\n" + " end.\n\n", + [TestCase, TestCase]), + write_testcases(OutputFile, Rest); +write_testcases(_OutputFile, []) -> + ok. diff --git a/lib/dialyzer/test/dialyzer_test.erl b/lib/dialyzer/test/dialyzer_test.erl deleted file mode 100644 index 26b4e146cc..0000000000 --- a/lib/dialyzer/test/dialyzer_test.erl +++ /dev/null @@ -1,200 +0,0 @@ --module(dialyzer_test). - --export([dialyzer_test/6]). - --include("test_server.hrl"). - --define(test_case_dir, "src"). --define(results_dir,"results"). --define(plt_filename,".dialyzer_plt"). --define(required_modules, "kernel stdlib compiler erts"). - -dialyzer_test(Options, TestCase, Kind, Dir, OutDir, Dog) -> - PltFilename = filename:join(OutDir, ?plt_filename), - case file:read_file_info(PltFilename) of - {ok, _} -> ok; - {error, _ } -> create_plt(OutDir, Dog) - end, - SrcDir = filename:join(Dir, ?test_case_dir), - ResDir = filename:join(Dir, ?results_dir), - TestCaseString = atom_to_list(TestCase), - Filename = filename:join(SrcDir, TestCaseString), - CorrectOptions = convert_relative_paths(Options, Dir), - FilesOption = - case Kind of - file -> {files, [Filename ++ ".erl"]}; - dir -> {files_rec, [Filename]} - end, - ResFile = TestCaseString, - NewResFile = filename:join(OutDir, ResFile), - OldResFile = filename:join(ResDir, ResFile), - RawWarns = dialyzer:run([FilesOption, - {init_plt, PltFilename}, - {from, src_code}, - {check_plt, false} | CorrectOptions]), - Warns = lists:sort([dialyzer:format_warning(W) || W <- RawWarns]), - case Warns of - [] -> ok; - _ -> - case file:open(NewResFile,['write']) of - {ok, OutFile} -> - io:format(OutFile,"\n~s",[Warns]), - file:close(OutFile); - Other -> erlang:error(Other) - end - end, - case diff(NewResFile, OldResFile) of - 'same' -> file:delete(NewResFile), - 'same'; - Any -> Any - end. - -create_plt(OutDir, Dog) -> - PltFilename = filename:join(OutDir, ?plt_filename), - ?t:timetrap_cancel(Dog), - ?t:format("Generating plt..."), - HomeDir = os:getenv("HOME"), - HomePlt = filename:join(HomeDir, ?plt_filename), - file:copy(HomePlt, PltFilename), - try - AddCommand = "dialyzer --add_to_plt --output_plt " ++ - PltFilename ++ " --apps " ++ ?required_modules, - ?t:format(AddCommand ++ "\n"), - ?t:format(os:cmd(AddCommand)), - dialyzer:run([{analysis_type, plt_check}, - {init_plt, PltFilename}]) of - [] -> ok - catch - _:_ -> - BuildCommand = "dialyzer --build_plt --output_plt " ++ - PltFilename ++ " --apps " ++ ?required_modules, - ?t:format(BuildCommand ++ "\n"), - ?t:format(os:cmd(BuildCommand)) - end. - -convert_relative_paths(Options, Dir) -> - convert_relative_paths(Options, Dir, []). - -convert_relative_paths([], _Dir, Acc) -> - Acc; -convert_relative_paths([{include_dirs, Paths}|Rest], Dir, Acc) -> - AbsolutePaths = convert_relative_paths_1(Paths, Dir, []), - convert_relative_paths(Rest, Dir, [{include_dirs, AbsolutePaths}|Acc]); -convert_relative_paths([Option|Rest], Dir, Acc) -> - convert_relative_paths(Rest, Dir, [Option|Acc]). - -convert_relative_paths_1([], _Dir, Acc) -> - Acc; -convert_relative_paths_1([Path|Rest], Dir, Acc) -> - convert_relative_paths_1(Rest, Dir, [filename:join(Dir, Path)|Acc]). - -diff(Filename1, Filename2) -> - File1 = - case file:open(Filename1, [read]) of - {ok, F1} -> {file, F1}; - _ -> empty - end, - File2 = - case file:open(Filename2, [read]) of - {ok, F2} -> {file, F2}; - _ -> empty - end, - case diff1(File1, File2) of - {error, {N, Error}} -> - case N of - 1 -> {error, {Filename1, Error}}; - 2 -> {error, {Filename2, Error}} - end; - [] -> 'same'; - DiffList -> {'differ', DiffList} - end. - -diff1(File1, File2) -> - case file_to_lines(File1) of - {error, Error} -> {error, {1, Error}}; - Lines1 -> - case file_to_lines(File2) of - {error, Error} -> {error, {2, Error}}; - Lines2 -> - Common = lcs_fast(Lines1, Lines2), - diff2(Lines1, 1, Lines2, 1, Common, []) - end - end. - -diff2([], _, [], _, [], Acc) -> lists:keysort(2,Acc); -diff2([H1|T1], N1, [], N2, [], Acc) -> - diff2(T1, N1+1, [], N2, [], [{new, N1, H1}|Acc]); -diff2([], N1, [H2|T2], N2, [], Acc) -> - diff2([], N1, T2, N2+1, [], [{old, N2, H2}|Acc]); -diff2([H1|T1], N1, [H2|T2], N2, [], Acc) -> - diff2(T1, N1+1, T2, N2+1, [], [{new, N1, H1}, {old, N2, H2}|Acc]); -diff2([H1|T1]=L1, N1, [H2|T2]=L2, N2, [HC|TC]=LC, Acc) -> - case H1 =:= H2 of - true -> diff2(T1, N1+1, T2, N2+1, TC, Acc); - false -> - case H1 =:= HC of - true -> diff2(L1, N1, T2, N2+1, LC, [{old, N2, H2}|Acc]); - false -> diff2(T1, N1+1, L2, N2, LC, [{new, N1, H1}|Acc]) - end - end. - --spec lcs_fast([string()], [string()]) -> [string()]. - -lcs_fast(S1, S2) -> - M = length(S1), - N = length(S2), - Acc = array:new(M*N, {default, 0}), - {L, _} = lcs_fast(S1, S2, 1, 1, N, Acc), - L. - --spec lcs_fast([string()], [string()], - pos_integer(), pos_integer(), - non_neg_integer(), array()) -> {[string()], array()}. - -lcs_fast([], _, _, _, _, Acc) -> - {[], Acc}; -lcs_fast(_, [], _, _, _, Acc) -> - {[], Acc}; -lcs_fast([H1|T1] = S1, [H2|T2] = S2, N1, N2, N, Acc) -> - I = (N1-1) * N + N2 - 1, - case array:get(I, Acc) of - 0 -> - case string:equal(H1, H2) of - true -> - {T, NAcc} = lcs_fast(T1, T2, N1+1, N2+1, N, Acc), - L = [H1|T], - {L, array:set(I, L, NAcc)}; - false -> - {L1, NAcc1} = lcs_fast(S1, T2, N1, N2+1, N, Acc), - {L2, NAcc2} = lcs_fast(T1, S2, N1+1, N2, N, NAcc1), - L = longest(L1, L2), - {L, array:set(I, L, NAcc2)} - end; - L -> - {L, Acc} - end. - --spec longest([string()], [string()]) -> [string()]. - -longest(S1, S2) -> - case length(S1) > length(S2) of - true -> S1; - false -> S2 - end. - -file_to_lines(empty) -> - []; -file_to_lines({file, File}) -> - case file_to_lines(File, []) of - {error, _} = Error -> Error; - Lines -> lists:reverse(Lines) - end. - -file_to_lines(File, Acc) -> - case io:get_line(File, "") of - {error, _}=Error -> Error; - eof -> Acc; - A -> file_to_lines(File, [A|Acc]) - end. - - diff --git a/lib/dialyzer/test/dialyzer_test_constants.hrl b/lib/dialyzer/test/dialyzer_test_constants.hrl new file mode 100644 index 0000000000..5672327724 --- /dev/null +++ b/lib/dialyzer/test/dialyzer_test_constants.hrl @@ -0,0 +1 @@ +-define(plt_timeout, {hours, 2}). diff --git a/lib/dialyzer/test/file_utils.erl b/lib/dialyzer/test/file_utils.erl new file mode 100644 index 0000000000..36b368760c --- /dev/null +++ b/lib/dialyzer/test/file_utils.erl @@ -0,0 +1,155 @@ +-module(file_utils). + +-export([list_dir/3, file_type/1, diff/2]). + +-include_lib("kernel/include/file.hrl"). + +-type ext_posix()::posix()|'badarg'. +-type posix()::atom(). + +-spec list_dir(file:filename(), string(), boolean()) -> + {error, ext_posix()} | {ok, [file:filename()]}. + +list_dir(Dir, Extension, Dirs) -> + case file:list_dir(Dir) of + {error, _} = Error-> Error; + {ok, Filenames} -> + FullFilenames = [filename:join(Dir, F) || F <-Filenames ], + Matches1 = case Dirs of + true -> + [F || F <- FullFilenames, + file_type(F) =:= {ok, 'directory'}]; + false -> [] + end, + Matches2 = [F || F <- FullFilenames, + file_type(F) =:= {ok, 'regular'}, + filename:extension(F) =:= Extension], + {ok, lists:sort(Matches1 ++ Matches2)} + end. + +-spec file_type(file:filename()) -> + {ok, 'device' | 'directory' | 'regular' | 'other'} | + {error, ext_posix()}. + +file_type(Filename) -> + case file:read_file_info(Filename) of + {ok, FI} -> {ok, FI#file_info.type}; + Error -> Error + end. + +-type diff_result()::'same' | {'differ', diff_list()} | + {error, {file:filename(), term()}}. +-type diff_list()::[{id(), line(), string()}]. +-type id()::'new'|'old'. +-type line()::non_neg_integer(). + +-spec diff(file:filename(), file:filename()) -> diff_result(). + +diff(Filename1, Filename2) -> + File1 = + case file:open(Filename1, [read]) of + {ok, F1} -> {file, F1}; + _ -> empty + end, + File2 = + case file:open(Filename2, [read]) of + {ok, F2} -> {file, F2}; + _ -> empty + end, + case diff1(File1, File2) of + {error, {N, Error}} -> + case N of + 1 -> {error, {Filename1, Error}}; + 2 -> {error, {Filename2, Error}} + end; + [] -> 'same'; + DiffList -> {'differ', DiffList} + end. + +diff1(File1, File2) -> + case file_to_lines(File1) of + {error, Error} -> {error, {1, Error}}; + Lines1 -> + case file_to_lines(File2) of + {error, Error} -> {error, {2, Error}}; + Lines2 -> + Common = lcs_fast(Lines1, Lines2), + diff2(Lines1, 1, Lines2, 1, Common, []) + end + end. + +diff2([], _, [], _, [], Acc) -> lists:keysort(2,Acc); +diff2([H1|T1], N1, [], N2, [], Acc) -> + diff2(T1, N1+1, [], N2, [], [{new, N1, H1}|Acc]); +diff2([], N1, [H2|T2], N2, [], Acc) -> + diff2([], N1, T2, N2+1, [], [{old, N2, H2}|Acc]); +diff2([H1|T1], N1, [H2|T2], N2, [], Acc) -> + diff2(T1, N1+1, T2, N2+1, [], [{new, N1, H1}, {old, N2, H2}|Acc]); +diff2([H1|T1]=L1, N1, [H2|T2]=L2, N2, [HC|TC]=LC, Acc) -> + case H1 =:= H2 of + true -> diff2(T1, N1+1, T2, N2+1, TC, Acc); + false -> + case H1 =:= HC of + true -> diff2(L1, N1, T2, N2+1, LC, [{old, N2, H2}|Acc]); + false -> diff2(T1, N1+1, L2, N2, LC, [{new, N1, H1}|Acc]) + end + end. + +-spec lcs_fast([string()], [string()]) -> [string()]. + +lcs_fast(S1, S2) -> + M = length(S1), + N = length(S2), + Acc = array:new(M*N, {default, 0}), + {L, _} = lcs_fast(S1, S2, 1, 1, N, Acc), + L. + +-spec lcs_fast([string()], [string()], + pos_integer(), pos_integer(), + non_neg_integer(), array()) -> {[string()], array()}. + +lcs_fast([], _, _, _, _, Acc) -> + {[], Acc}; +lcs_fast(_, [], _, _, _, Acc) -> + {[], Acc}; +lcs_fast([H1|T1] = S1, [H2|T2] = S2, N1, N2, N, Acc) -> + I = (N1-1) * N + N2 - 1, + case array:get(I, Acc) of + 0 -> + case string:equal(H1, H2) of + true -> + {T, NAcc} = lcs_fast(T1, T2, N1+1, N2+1, N, Acc), + L = [H1|T], + {L, array:set(I, L, NAcc)}; + false -> + {L1, NAcc1} = lcs_fast(S1, T2, N1, N2+1, N, Acc), + {L2, NAcc2} = lcs_fast(T1, S2, N1+1, N2, N, NAcc1), + L = longest(L1, L2), + {L, array:set(I, L, NAcc2)} + end; + L -> + {L, Acc} + end. + +-spec longest([string()], [string()]) -> [string()]. + +longest(S1, S2) -> + case length(S1) > length(S2) of + true -> S1; + false -> S2 + end. + +file_to_lines(empty) -> + []; +file_to_lines({file, File}) -> + case file_to_lines(File, []) of + {error, _} = Error -> Error; + Lines -> lists:reverse(Lines) + end. + +file_to_lines(File, Acc) -> + case io:get_line(File, "") of + {error, _}=Error -> Error; + eof -> Acc; + A -> file_to_lines(File, [A|Acc]) + end. diff --git a/lib/dialyzer/test/generator.erl b/lib/dialyzer/test/generator.erl deleted file mode 100644 index f49083963f..0000000000 --- a/lib/dialyzer/test/generator.erl +++ /dev/null @@ -1,198 +0,0 @@ -%%% File : dialyzer_test_suite_generator.erl -%%% Author : Stavros Aronis <stavros@enjoy> -%%% Description : Generator for simple dialyzer test suites (some options, -%%% some input files or directories and the relevant results). -%%% Created : 11 Jun 2010 by Stavros Aronis <stavros@enjoy> - --module(generator). - --export([suite/1]). - --include_lib("kernel/include/file.hrl"). - --define(suite_suffix, "_tests_SUITE"). --define(data_folder, "_data"). --define(erlang_extension, ".erl"). --define(output_file_mode, write). --define(dialyzer_option_file, "dialyzer_options"). --define(input_files_directory, "src"). --define(result_files_directory, "result"). - --record(suite, {suitename :: string(), - outputfile :: file:io_device(), - options :: options(), - testcases :: [testcase()]}). - --record(options, {time_limit = 1 :: integer(), - dialyzer_options = [] :: [term()]}). - --type options() :: #options{}. --type testcase() :: {atom(), 'file' | 'dir'}. - --spec suite(string()) -> 'ok'. - -suite(SuiteName) -> - {ok, Cwd} = file:get_cwd(), - SuiteDirN = generate_suite_dir_from_name(Cwd, SuiteName), - OutputFile = generate_suite_file(Cwd, SuiteName), - {OptionsFileN, InputDirN} = check_neccessary_files(SuiteDirN), - generate_suite(SuiteName, OutputFile, OptionsFileN, InputDirN). - -generate_suite_dir_from_name(Cwd, SuiteName) -> - filename:join(Cwd, SuiteName ++ ?suite_suffix ++ ?data_folder). - -generate_suite_file(Cwd, SuiteName) -> - OutputFilename = - filename:join(Cwd, SuiteName ++ ?suite_suffix ++ ?erlang_extension), - case file:open(OutputFilename, [?output_file_mode]) of - {ok, IoDevice} -> IoDevice; - {error, _} = E -> exit(E) - end. - -check_neccessary_files(SuiteDirN) -> - InputDirN = filename:join(SuiteDirN, ?input_files_directory), - check_file_exists(InputDirN, directory), - OptionsFileN = filename:join(SuiteDirN, ?dialyzer_option_file), - check_file_exists(OptionsFileN, regular), - {OptionsFileN, InputDirN}. - -check_file_exists(Filename, Type) -> - case file:read_file_info(Filename) of - {ok, FileInfo} -> - case FileInfo#file_info.type of - Type -> ok; - Else -> exit({error, {wrong_input_file_type, Else}}) - end; - {error, _} = E -> exit(E) - end. - -generate_suite(SuiteName, OutputFile, OptionsFileN, InputDirN) -> - Options = read_options(OptionsFileN), - TestCases = list_testcases(InputDirN), - Suite = #suite{suitename = SuiteName, outputfile = OutputFile, - options = Options, testcases = TestCases}, - write_suite(Suite), - file:close(OutputFile). - -read_options(OptionsFileN) -> - case file:consult(OptionsFileN) of - {ok, Opts} -> read_options(Opts, #options{}); - _ = E -> exit({error, {incorrect_options_file, E}}) - end. - -read_options([List], Options) when is_list(List) -> - read_options(List, Options); -read_options([], Options) -> - Options; -read_options([{time_limit, TimeLimit}|Opts], Options) -> - read_options(Opts, Options#options{time_limit = TimeLimit}); -read_options([{dialyzer_options, DialyzerOptions}|Opts], Options) -> - read_options(Opts, Options#options{dialyzer_options = DialyzerOptions}). - -list_testcases(InputDirN) -> - {ok, PartialFilenames} = file:list_dir(InputDirN), - Filenames = [filename:join(InputDirN, F) || F <- PartialFilenames], - SafeFilenames = [F || F <- Filenames, safe_extension(F)], - lists:sort(lists:map(fun(X) -> map_testcase(X) end, SafeFilenames)). - -safe_extension(Filename) -> - Extension = filename:extension(Filename), - Extension =:= ".erl" orelse Extension =:= "". - -map_testcase(Filename) -> - TestCase = list_to_atom(filename:basename(Filename, ?erlang_extension)), - {ok, FileInfo} = file:read_file_info(Filename), - case FileInfo#file_info.type of - directory -> {TestCase, dir}; - regular -> {TestCase, file} - end. - -write_suite(Suite) -> - write_header(Suite), - write_testcases(Suite), - write_footer(Suite). - -write_header(#suite{suitename = SuiteName, outputfile = OutputFile, - options = Options, testcases = TestCases}) -> - TestCaseNames = [N || {N, _} <- TestCases], - Exports = format_export(TestCaseNames), - TimeLimit = Options#options.time_limit, - DialyzerOptions = Options#options.dialyzer_options, - io:format(OutputFile, - "-module(~s).\n\n" - "-include_lib(\"test_server/include/test_server.hrl\").\n\n" - "-export([all/0, groups/0, init_per_group/2, end_per_group/2,\n" - " init_per_testcase/2, fin_per_testcase/2]).\n\n" - "~s\n\n" - "-define(default_timeout, ?t:minutes(~p)).\n" - "-define(dialyzer_options, ?config(dialyzer_options, Config)).\n" - "-define(datadir, ?config(data_dir, Config)).\n" - "-define(privdir, ?config(priv_dir, Config)).\n\n" - "groups() -> [].\n\n" - "init_per_group(_GroupName, Config) -> Config.\n\n" - "end_per_group(_GroupName, Config) -> Config.\n\n" - "init_per_testcase(_Case, Config) ->\n" - " ?line Dog = ?t:timetrap(?default_timeout),\n" - " [{dialyzer_options, ~p}, {watchdog, Dog} | Config].\n\n" - "fin_per_testcase(_Case, _Config) ->\n" - " Dog = ?config(watchdog, _Config),\n" - " ?t:timetrap_cancel(Dog),\n" - " ok.\n\n" - "all() ->\n" - " ~p.\n\n" - ,[SuiteName ++ ?suite_suffix, Exports, TimeLimit, - DialyzerOptions, TestCaseNames]). - -format_export(TestCaseNames) -> - TestCaseNamesArity = [list_to_atom(atom_to_list(N)++"/1") || - N <- TestCaseNames], - TestCaseString = io_lib:format("-export(~p).", [TestCaseNamesArity]), - strip_quotes(lists:flatten(TestCaseString),[]). - -strip_quotes([], Result) -> - lists:reverse(Result); -strip_quotes([$' |Rest], Result) -> - strip_quotes(Rest, Result); -strip_quotes([$\, |Rest], Result) -> - strip_quotes(Rest, [$\ , $\, |Result]); -strip_quotes([C|Rest], Result) -> - strip_quotes(Rest, [C|Result]). - -write_testcases(#suite{outputfile = OutputFile, testcases = TestCases}) -> - write_testcases(OutputFile, TestCases). - -write_testcases(OutputFile, [{TestCase, Kind}|TestCases]) -> - io:format(OutputFile, - "~p(Config) when is_list(Config) ->\n" - " ?line run(Config, {~p, ~p}),\n" - " ok.\n\n" - ,[TestCase, TestCase, Kind]), - write_testcases(OutputFile, TestCases); -write_testcases(_OutputFile, []) -> - ok. - -write_footer(#suite{outputfile = OutputFile}) -> - io:format(OutputFile, - "run(Config, TestCase) ->\n" - " case run_test(Config, TestCase) of\n" - " ok -> ok;\n" - " {fail, Reason} ->\n" - " ?t:format(\"~~s\",[Reason]),\n" - " fail()\n" - " end.\n\n" - "run_test(Config, {TestCase, Kind}) ->\n" - " Dog = ?config(watchdog, Config),\n" - " Options = ?dialyzer_options,\n" - " Dir = ?datadir,\n" - " OutDir = ?privdir,\n" - " case dialyzer_test:dialyzer_test(Options, TestCase, Kind,\n" - " Dir, OutDir, Dog) of\n" - " same -> ok;\n" - " {differ, DiffList} ->\n" - " {fail,\n" - " io_lib:format(\"\\nTest ~~p failed:\\n~~p\\n\",\n" - " [TestCase, DiffList])}\n" - " end.\n\n" - "fail() ->\n" - " io:format(\"failed\\n\"),\n" - " ?t:fail().\n",[]). diff --git a/lib/dialyzer/test/opaque_tests_SUITE.erl b/lib/dialyzer/test/opaque_tests_SUITE.erl index 3dc583d065..6b90e7a646 100644 --- a/lib/dialyzer/test/opaque_tests_SUITE.erl +++ b/lib/dialyzer/test/opaque_tests_SUITE.erl @@ -1,151 +1,184 @@ --module(opaque_tests_SUITE). - --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. --export([array/1, crash/1, dict/1, ets/1, gb_sets/1, inf_loop1/1, - int/1, mixed_opaque/1, my_digraph/1, my_queue/1, opaque/1, - queue/1, rec/1, timer/1, union/1, wings/1, zoltan_kis1/1, - zoltan_kis2/1, zoltan_kis3/1, zoltan_kis4/1, zoltan_kis5/1, - zoltan_kis6/1]). - --define(default_timeout, ?t:minutes(1)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). +-module(opaque_tests_SUITE). -groups() -> []. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). -init_per_group(_GroupName, Config) -> Config. +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([opaque_tests_SUITE_consistency/1, array/1, crash/1, dict/1, + ets/1, gb_sets/1, inf_loop1/1, int/1, mixed_opaque/1, + my_digraph/1, my_queue/1, opaque/1, queue/1, rec/1, timer/1, + union/1, wings/1, zoltan_kis1/1, zoltan_kis2/1, zoltan_kis3/1, + zoltan_kis4/1, zoltan_kis5/1, zoltan_kis6/1]). -end_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 1}}]. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, [{warnings,[no_unused,no_return]}]}, {watchdog, Dog} | Config]. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, [{warnings,[no_unused,no_return]}]}|Config] + end. -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [array,crash,dict,ets,gb_sets,inf_loop1,int,mixed_opaque,my_digraph, - my_queue,opaque,queue,rec,timer,union,wings,zoltan_kis1,zoltan_kis2, - zoltan_kis3,zoltan_kis4,zoltan_kis5,zoltan_kis6]. - -array(Config) when is_list(Config) -> - ?line run(Config, {array, dir}), - ok. - -crash(Config) when is_list(Config) -> - ?line run(Config, {crash, dir}), - ok. - -dict(Config) when is_list(Config) -> - ?line run(Config, {dict, dir}), - ok. - -ets(Config) when is_list(Config) -> - ?line run(Config, {ets, dir}), - ok. - -gb_sets(Config) when is_list(Config) -> - ?line run(Config, {gb_sets, dir}), - ok. - -inf_loop1(Config) when is_list(Config) -> - ?line run(Config, {inf_loop1, file}), - ok. - -int(Config) when is_list(Config) -> - ?line run(Config, {int, dir}), - ok. - -mixed_opaque(Config) when is_list(Config) -> - ?line run(Config, {mixed_opaque, dir}), - ok. - -my_digraph(Config) when is_list(Config) -> - ?line run(Config, {my_digraph, dir}), - ok. - -my_queue(Config) when is_list(Config) -> - ?line run(Config, {my_queue, dir}), - ok. - -opaque(Config) when is_list(Config) -> - ?line run(Config, {opaque, dir}), - ok. - -queue(Config) when is_list(Config) -> - ?line run(Config, {queue, dir}), - ok. - -rec(Config) when is_list(Config) -> - ?line run(Config, {rec, dir}), - ok. - -timer(Config) when is_list(Config) -> - ?line run(Config, {timer, dir}), - ok. - -union(Config) when is_list(Config) -> - ?line run(Config, {union, dir}), - ok. - -wings(Config) when is_list(Config) -> - ?line run(Config, {wings, dir}), - ok. - -zoltan_kis1(Config) when is_list(Config) -> - ?line run(Config, {zoltan_kis1, file}), - ok. - -zoltan_kis2(Config) when is_list(Config) -> - ?line run(Config, {zoltan_kis2, file}), - ok. - -zoltan_kis3(Config) when is_list(Config) -> - ?line run(Config, {zoltan_kis3, file}), - ok. - -zoltan_kis4(Config) when is_list(Config) -> - ?line run(Config, {zoltan_kis4, file}), - ok. - -zoltan_kis5(Config) when is_list(Config) -> - ?line run(Config, {zoltan_kis5, file}), - ok. - -zoltan_kis6(Config) when is_list(Config) -> - ?line run(Config, {zoltan_kis6, file}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. - -fail() -> - io:format("failed\n"), - ?t:fail(). + [opaque_tests_SUITE_consistency,array,crash,dict,ets,gb_sets,inf_loop1,int, + mixed_opaque,my_digraph,my_queue,opaque,queue,rec,timer,union,wings, + zoltan_kis1,zoltan_kis2,zoltan_kis3,zoltan_kis4,zoltan_kis5,zoltan_kis6]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +opaque_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +array(Config) -> + case dialyze(Config, array) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +crash(Config) -> + case dialyze(Config, crash) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +dict(Config) -> + case dialyze(Config, dict) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets(Config) -> + case dialyze(Config, ets) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +gb_sets(Config) -> + case dialyze(Config, gb_sets) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +inf_loop1(Config) -> + case dialyze(Config, inf_loop1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +int(Config) -> + case dialyze(Config, int) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mixed_opaque(Config) -> + case dialyze(Config, mixed_opaque) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +my_digraph(Config) -> + case dialyze(Config, my_digraph) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +my_queue(Config) -> + case dialyze(Config, my_queue) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +opaque(Config) -> + case dialyze(Config, opaque) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +queue(Config) -> + case dialyze(Config, queue) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +rec(Config) -> + case dialyze(Config, rec) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +timer(Config) -> + case dialyze(Config, timer) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +union(Config) -> + case dialyze(Config, union) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +wings(Config) -> + case dialyze(Config, wings) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zoltan_kis1(Config) -> + case dialyze(Config, zoltan_kis1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zoltan_kis2(Config) -> + case dialyze(Config, zoltan_kis2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zoltan_kis3(Config) -> + case dialyze(Config, zoltan_kis3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zoltan_kis4(Config) -> + case dialyze(Config, zoltan_kis4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zoltan_kis5(Config) -> + case dialyze(Config, zoltan_kis5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zoltan_kis6(Config) -> + case dialyze(Config, zoltan_kis6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + diff --git a/lib/dialyzer/test/options1_tests_SUITE.erl b/lib/dialyzer/test/options1_tests_SUITE.erl index f920dd7ab0..f971d1c3cf 100644 --- a/lib/dialyzer/test/options1_tests_SUITE.erl +++ b/lib/dialyzer/test/options1_tests_SUITE.erl @@ -1,63 +1,54 @@ --module(options1_tests_SUITE). - --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. --export([compiler/1]). - --define(default_timeout, ?t:minutes(10)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). +-module(options1_tests_SUITE). -groups() -> []. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). -init_per_group(_GroupName, Config) -> Config. +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([options1_tests_SUITE_consistency/1, compiler/1]). -end_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 20}}]. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, [{include_dirs,["my_include"]}, - {defines,[{'COMPILER_VSN',42}]}, - {warnings,[no_improper_lists]}]}, {watchdog, Dog} | Config]. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, [{include_dirs,["my_include"]}, + {defines,[{'COMPILER_VSN',42}]}, + {warnings,[no_improper_lists]}]}|Config] + end. -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [compiler]. - -compiler(Config) when is_list(Config) -> - ?line run(Config, {compiler, dir}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. - -fail() -> - io:format("failed\n"), - ?t:fail(). + [options1_tests_SUITE_consistency,compiler]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +options1_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +compiler(Config) -> + case dialyze(Config, compiler) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + diff --git a/lib/dialyzer/test/options1_tests_SUITE_data/dialyzer_options b/lib/dialyzer/test/options1_tests_SUITE_data/dialyzer_options index 30731d815b..d46fc459bc 100644 --- a/lib/dialyzer/test/options1_tests_SUITE_data/dialyzer_options +++ b/lib/dialyzer/test/options1_tests_SUITE_data/dialyzer_options @@ -1,2 +1,2 @@ {dialyzer_options, [{include_dirs, ["my_include"]}, {defines, [{'COMPILER_VSN', 42}]}, {warnings, [no_improper_lists]}]}. -{time_limit, 10}. +{time_limit, 20}. diff --git a/lib/dialyzer/test/options2_tests_SUITE.erl b/lib/dialyzer/test/options2_tests_SUITE.erl index e23ad1f326..43b5207744 100644 --- a/lib/dialyzer/test/options2_tests_SUITE.erl +++ b/lib/dialyzer/test/options2_tests_SUITE.erl @@ -1,61 +1,52 @@ --module(options2_tests_SUITE). - --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. --export([kernel/1]). - --define(default_timeout, ?t:minutes(1)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). +-module(options2_tests_SUITE). -groups() -> []. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). -init_per_group(_GroupName, Config) -> Config. +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([options2_tests_SUITE_consistency/1, kernel/1]). -end_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 1}}]. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, [{defines,[{vsn,4}]},{warnings,[no_return]}]}, {watchdog, Dog} | Config]. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, [{defines,[{vsn,4}]},{warnings,[no_return]}]}|Config] + end. -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [kernel]. - -kernel(Config) when is_list(Config) -> - ?line run(Config, {kernel, dir}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. - -fail() -> - io:format("failed\n"), - ?t:fail(). + [options2_tests_SUITE_consistency,kernel]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +options2_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +kernel(Config) -> + case dialyze(Config, kernel) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + diff --git a/lib/dialyzer/test/plt_tests_SUITE.erl b/lib/dialyzer/test/plt_tests_SUITE.erl new file mode 100644 index 0000000000..bf45020340 --- /dev/null +++ b/lib/dialyzer/test/plt_tests_SUITE.erl @@ -0,0 +1,21 @@ +%% This suite is the only hand made and simply +%% checks if we can build a plt. + +-module(plt_tests_SUITE). + +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). + +-export([suite/0, all/0, build_plt/1]). + +suite() -> + [{timetrap, ?plt_timeout}]. + +all() -> [build_plt]. + +build_plt(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + ok -> ok; + fail -> ct:fail(plt_build_fail) + end. diff --git a/lib/dialyzer/test/r9c_tests_SUITE.erl b/lib/dialyzer/test/r9c_tests_SUITE.erl index af5a77a432..cd5bd5ec61 100644 --- a/lib/dialyzer/test/r9c_tests_SUITE.erl +++ b/lib/dialyzer/test/r9c_tests_SUITE.erl @@ -1,69 +1,64 @@ --module(r9c_tests_SUITE). - --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. --export([asn1/1, inets/1, mnesia/1]). - --define(default_timeout, ?t:minutes(6)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). +-module(r9c_tests_SUITE). -groups() -> []. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). -init_per_group(_GroupName, Config) -> Config. +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([r9c_tests_SUITE_consistency/1, asn1/1, inets/1, mnesia/1]). -end_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 20}}]. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, [{defines,[{vsn,42}]}]}, {watchdog, Dog} | Config]. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, [{defines,[{vsn,42}]}]}|Config] + end. -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [asn1,inets,mnesia]. - -asn1(Config) when is_list(Config) -> - ?line run(Config, {asn1, dir}), - ok. - -inets(Config) when is_list(Config) -> - ?line run(Config, {inets, dir}), - ok. - -mnesia(Config) when is_list(Config) -> - ?line run(Config, {mnesia, dir}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. + [r9c_tests_SUITE_consistency,asn1,inets,mnesia]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +r9c_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +asn1(Config) -> + case dialyze(Config, asn1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +inets(Config) -> + case dialyze(Config, inets) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia(Config) -> + case dialyze(Config, mnesia) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. -fail() -> - io:format("failed\n"), - ?t:fail(). diff --git a/lib/dialyzer/test/r9c_tests_SUITE_data/dialyzer_options b/lib/dialyzer/test/r9c_tests_SUITE_data/dialyzer_options index ffbaec4748..e00e23bb66 100644 --- a/lib/dialyzer/test/r9c_tests_SUITE_data/dialyzer_options +++ b/lib/dialyzer/test/r9c_tests_SUITE_data/dialyzer_options @@ -1,2 +1,2 @@ {dialyzer_options, [{defines, [{vsn, 42}]}]}. -{time_limit, 6}. +{time_limit, 20}. diff --git a/lib/dialyzer/test/race_tests_SUITE.erl b/lib/dialyzer/test/race_tests_SUITE.erl index 0f7c4c3c70..cfc898d464 100644 --- a/lib/dialyzer/test/race_tests_SUITE.erl +++ b/lib/dialyzer/test/race_tests_SUITE.erl @@ -1,23 +1,29 @@ +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. + -module(race_tests_SUITE). --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). - --export([ets_insert_args1/1, ets_insert_args2/1, ets_insert_args3/1, - ets_insert_args4/1, ets_insert_args5/1, ets_insert_args6/1, - ets_insert_args7/1, ets_insert_args8/1, - ets_insert_control_flow1/1, ets_insert_control_flow2/1, - ets_insert_control_flow3/1, ets_insert_control_flow4/1, - ets_insert_control_flow5/1, ets_insert_diff_atoms_race1/1, - ets_insert_diff_atoms_race2/1, ets_insert_diff_atoms_race3/1, - ets_insert_diff_atoms_race4/1, ets_insert_diff_atoms_race5/1, - ets_insert_diff_atoms_race6/1, ets_insert_double1/1, - ets_insert_double2/1, ets_insert_funs1/1, ets_insert_funs2/1, - ets_insert_new/1, ets_insert_param/1, extract_translations/1, - mnesia_diff_atoms_race1/1, mnesia_diff_atoms_race2/1, - mnesia_dirty_read_one_write_two/1, +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). + +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([race_tests_SUITE_consistency/1, ets_insert_args1/1, + ets_insert_args2/1, ets_insert_args3/1, ets_insert_args4/1, + ets_insert_args5/1, ets_insert_args6/1, ets_insert_args7/1, + ets_insert_args8/1, ets_insert_control_flow1/1, + ets_insert_control_flow2/1, ets_insert_control_flow3/1, + ets_insert_control_flow4/1, ets_insert_control_flow5/1, + ets_insert_diff_atoms_race1/1, ets_insert_diff_atoms_race2/1, + ets_insert_diff_atoms_race3/1, ets_insert_diff_atoms_race4/1, + ets_insert_diff_atoms_race5/1, ets_insert_diff_atoms_race6/1, + ets_insert_double1/1, ets_insert_double2/1, ets_insert_funs1/1, + ets_insert_funs2/1, ets_insert_new/1, ets_insert_param/1, + extract_translations/1, mnesia_diff_atoms_race1/1, + mnesia_diff_atoms_race2/1, mnesia_dirty_read_one_write_two/1, mnesia_dirty_read_two_write_one/1, mnesia_dirty_read_write_double1/1, mnesia_dirty_read_write_double2/1, @@ -60,532 +66,734 @@ whereis_vars4/1, whereis_vars5/1, whereis_vars6/1, whereis_vars7/1, whereis_vars8/1, whereis_vars9/1]). --define(default_timeout, ?t:minutes(1)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). - -groups() -> []. - -init_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 1}}]. -end_per_group(_GroupName, Config) -> Config. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, [{warnings,[race_conditions]}]}|Config] + end. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, [{warnings,[race_conditions]}]}, {watchdog, Dog} | Config]. - -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [ets_insert_args1,ets_insert_args2,ets_insert_args3,ets_insert_args4, - ets_insert_args5,ets_insert_args6,ets_insert_args7,ets_insert_args8, - ets_insert_control_flow1,ets_insert_control_flow2, - ets_insert_control_flow3,ets_insert_control_flow4, - ets_insert_control_flow5,ets_insert_diff_atoms_race1, - ets_insert_diff_atoms_race2,ets_insert_diff_atoms_race3, - ets_insert_diff_atoms_race4,ets_insert_diff_atoms_race5, - ets_insert_diff_atoms_race6,ets_insert_double1,ets_insert_double2, - ets_insert_funs1,ets_insert_funs2,ets_insert_new,ets_insert_param, - extract_translations,mnesia_diff_atoms_race1,mnesia_diff_atoms_race2, - mnesia_dirty_read_one_write_two,mnesia_dirty_read_two_write_one, - mnesia_dirty_read_write_double1,mnesia_dirty_read_write_double2, - mnesia_dirty_read_write_double3,mnesia_dirty_read_write_double4, - mnesia_dirty_read_write_one,mnesia_dirty_read_write_two, - whereis_control_flow1,whereis_control_flow2,whereis_control_flow3, - whereis_control_flow4,whereis_control_flow5,whereis_control_flow6, - whereis_diff_atoms_no_race,whereis_diff_atoms_race, - whereis_diff_functions1,whereis_diff_functions1_nested, - whereis_diff_functions1_pathsens,whereis_diff_functions1_twice, - whereis_diff_functions2,whereis_diff_functions2_nested, - whereis_diff_functions2_pathsens,whereis_diff_functions2_twice, - whereis_diff_functions3,whereis_diff_functions3_nested, - whereis_diff_functions3_pathsens,whereis_diff_functions4, - whereis_diff_functions5,whereis_diff_functions6,whereis_diff_modules1, - whereis_diff_modules1_pathsens,whereis_diff_modules1_rec, - whereis_diff_modules2,whereis_diff_modules2_pathsens, - whereis_diff_modules2_rec,whereis_diff_modules3, - whereis_diff_modules_nested,whereis_diff_modules_twice, - whereis_diff_vars_no_race,whereis_diff_vars_race, - whereis_intra_inter_module1,whereis_intra_inter_module2, - whereis_intra_inter_module3,whereis_intra_inter_module4, - whereis_intra_inter_module5,whereis_intra_inter_module6, - whereis_intra_inter_module7,whereis_intra_inter_module8,whereis_param, - whereis_param_inter_module,whereis_rec_function1,whereis_rec_function2, - whereis_rec_function3,whereis_rec_function4,whereis_rec_function5, - whereis_rec_function6,whereis_rec_function7,whereis_rec_function8, - whereis_try_catch,whereis_vars1,whereis_vars10,whereis_vars11, - whereis_vars12,whereis_vars13,whereis_vars14,whereis_vars15, - whereis_vars16,whereis_vars17,whereis_vars18,whereis_vars19, - whereis_vars2,whereis_vars20,whereis_vars21,whereis_vars22,whereis_vars3, - whereis_vars4,whereis_vars5,whereis_vars6,whereis_vars7,whereis_vars8, - whereis_vars9]. - -ets_insert_args1(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args1, file}), - ok. - -ets_insert_args2(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args2, file}), - ok. - -ets_insert_args3(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args3, file}), - ok. - -ets_insert_args4(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args4, file}), - ok. - -ets_insert_args5(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args5, file}), - ok. - -ets_insert_args6(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args6, file}), - ok. - -ets_insert_args7(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args7, file}), - ok. - -ets_insert_args8(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_args8, file}), - ok. - -ets_insert_control_flow1(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_control_flow1, file}), - ok. - -ets_insert_control_flow2(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_control_flow2, file}), - ok. - -ets_insert_control_flow3(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_control_flow3, file}), - ok. - -ets_insert_control_flow4(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_control_flow4, file}), - ok. - -ets_insert_control_flow5(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_control_flow5, file}), - ok. - -ets_insert_diff_atoms_race1(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_diff_atoms_race1, file}), - ok. - -ets_insert_diff_atoms_race2(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_diff_atoms_race2, file}), - ok. - -ets_insert_diff_atoms_race3(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_diff_atoms_race3, file}), - ok. - -ets_insert_diff_atoms_race4(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_diff_atoms_race4, file}), - ok. - -ets_insert_diff_atoms_race5(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_diff_atoms_race5, file}), - ok. - -ets_insert_diff_atoms_race6(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_diff_atoms_race6, file}), - ok. - -ets_insert_double1(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_double1, file}), - ok. - -ets_insert_double2(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_double2, file}), - ok. - -ets_insert_funs1(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_funs1, file}), - ok. - -ets_insert_funs2(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_funs2, file}), - ok. - -ets_insert_new(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_new, file}), - ok. - -ets_insert_param(Config) when is_list(Config) -> - ?line run(Config, {ets_insert_param, file}), - ok. - -extract_translations(Config) when is_list(Config) -> - ?line run(Config, {extract_translations, file}), - ok. - -mnesia_diff_atoms_race1(Config) when is_list(Config) -> - ?line run(Config, {mnesia_diff_atoms_race1, file}), - ok. - -mnesia_diff_atoms_race2(Config) when is_list(Config) -> - ?line run(Config, {mnesia_diff_atoms_race2, file}), - ok. - -mnesia_dirty_read_one_write_two(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_one_write_two, file}), - ok. - -mnesia_dirty_read_two_write_one(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_two_write_one, file}), - ok. - -mnesia_dirty_read_write_double1(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_write_double1, file}), - ok. - -mnesia_dirty_read_write_double2(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_write_double2, file}), - ok. - -mnesia_dirty_read_write_double3(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_write_double3, file}), - ok. - -mnesia_dirty_read_write_double4(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_write_double4, file}), - ok. - -mnesia_dirty_read_write_one(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_write_one, file}), - ok. - -mnesia_dirty_read_write_two(Config) when is_list(Config) -> - ?line run(Config, {mnesia_dirty_read_write_two, file}), - ok. - -whereis_control_flow1(Config) when is_list(Config) -> - ?line run(Config, {whereis_control_flow1, file}), - ok. - -whereis_control_flow2(Config) when is_list(Config) -> - ?line run(Config, {whereis_control_flow2, file}), - ok. - -whereis_control_flow3(Config) when is_list(Config) -> - ?line run(Config, {whereis_control_flow3, file}), - ok. - -whereis_control_flow4(Config) when is_list(Config) -> - ?line run(Config, {whereis_control_flow4, file}), - ok. - -whereis_control_flow5(Config) when is_list(Config) -> - ?line run(Config, {whereis_control_flow5, file}), - ok. - -whereis_control_flow6(Config) when is_list(Config) -> - ?line run(Config, {whereis_control_flow6, file}), - ok. - -whereis_diff_atoms_no_race(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_atoms_no_race, file}), - ok. - -whereis_diff_atoms_race(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_atoms_race, file}), - ok. - -whereis_diff_functions1(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions1, file}), - ok. - -whereis_diff_functions1_nested(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions1_nested, file}), - ok. - -whereis_diff_functions1_pathsens(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions1_pathsens, file}), - ok. - -whereis_diff_functions1_twice(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions1_twice, file}), - ok. - -whereis_diff_functions2(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions2, file}), - ok. - -whereis_diff_functions2_nested(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions2_nested, file}), - ok. - -whereis_diff_functions2_pathsens(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions2_pathsens, file}), - ok. - -whereis_diff_functions2_twice(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions2_twice, file}), - ok. - -whereis_diff_functions3(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions3, file}), - ok. - -whereis_diff_functions3_nested(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions3_nested, file}), - ok. - -whereis_diff_functions3_pathsens(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions3_pathsens, file}), - ok. - -whereis_diff_functions4(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions4, file}), - ok. - -whereis_diff_functions5(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions5, file}), - ok. - -whereis_diff_functions6(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_functions6, file}), - ok. - -whereis_diff_modules1(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules1, dir}), - ok. - -whereis_diff_modules1_pathsens(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules1_pathsens, dir}), - ok. - -whereis_diff_modules1_rec(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules1_rec, dir}), - ok. - -whereis_diff_modules2(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules2, dir}), - ok. - -whereis_diff_modules2_pathsens(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules2_pathsens, dir}), - ok. - -whereis_diff_modules2_rec(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules2_rec, dir}), - ok. - -whereis_diff_modules3(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules3, dir}), - ok. - -whereis_diff_modules_nested(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules_nested, dir}), - ok. - -whereis_diff_modules_twice(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_modules_twice, dir}), - ok. - -whereis_diff_vars_no_race(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_vars_no_race, file}), - ok. - -whereis_diff_vars_race(Config) when is_list(Config) -> - ?line run(Config, {whereis_diff_vars_race, file}), - ok. - -whereis_intra_inter_module1(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module1, dir}), - ok. - -whereis_intra_inter_module2(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module2, dir}), - ok. - -whereis_intra_inter_module3(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module3, dir}), - ok. - -whereis_intra_inter_module4(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module4, dir}), - ok. - -whereis_intra_inter_module5(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module5, dir}), - ok. - -whereis_intra_inter_module6(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module6, dir}), - ok. - -whereis_intra_inter_module7(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module7, dir}), - ok. - -whereis_intra_inter_module8(Config) when is_list(Config) -> - ?line run(Config, {whereis_intra_inter_module8, dir}), - ok. - -whereis_param(Config) when is_list(Config) -> - ?line run(Config, {whereis_param, file}), - ok. - -whereis_param_inter_module(Config) when is_list(Config) -> - ?line run(Config, {whereis_param_inter_module, dir}), - ok. - -whereis_rec_function1(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function1, file}), - ok. - -whereis_rec_function2(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function2, file}), - ok. - -whereis_rec_function3(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function3, file}), - ok. - -whereis_rec_function4(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function4, file}), - ok. - -whereis_rec_function5(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function5, file}), - ok. - -whereis_rec_function6(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function6, file}), - ok. - -whereis_rec_function7(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function7, file}), - ok. - -whereis_rec_function8(Config) when is_list(Config) -> - ?line run(Config, {whereis_rec_function8, file}), - ok. + [race_tests_SUITE_consistency,ets_insert_args1,ets_insert_args2, + ets_insert_args3,ets_insert_args4,ets_insert_args5,ets_insert_args6, + ets_insert_args7,ets_insert_args8,ets_insert_control_flow1, + ets_insert_control_flow2,ets_insert_control_flow3,ets_insert_control_flow4, + ets_insert_control_flow5,ets_insert_diff_atoms_race1, + ets_insert_diff_atoms_race2,ets_insert_diff_atoms_race3, + ets_insert_diff_atoms_race4,ets_insert_diff_atoms_race5, + ets_insert_diff_atoms_race6,ets_insert_double1,ets_insert_double2, + ets_insert_funs1,ets_insert_funs2,ets_insert_new,ets_insert_param, + extract_translations,mnesia_diff_atoms_race1,mnesia_diff_atoms_race2, + mnesia_dirty_read_one_write_two,mnesia_dirty_read_two_write_one, + mnesia_dirty_read_write_double1,mnesia_dirty_read_write_double2, + mnesia_dirty_read_write_double3,mnesia_dirty_read_write_double4, + mnesia_dirty_read_write_one,mnesia_dirty_read_write_two, + whereis_control_flow1,whereis_control_flow2,whereis_control_flow3, + whereis_control_flow4,whereis_control_flow5,whereis_control_flow6, + whereis_diff_atoms_no_race,whereis_diff_atoms_race,whereis_diff_functions1, + whereis_diff_functions1_nested,whereis_diff_functions1_pathsens, + whereis_diff_functions1_twice,whereis_diff_functions2, + whereis_diff_functions2_nested,whereis_diff_functions2_pathsens, + whereis_diff_functions2_twice,whereis_diff_functions3, + whereis_diff_functions3_nested,whereis_diff_functions3_pathsens, + whereis_diff_functions4,whereis_diff_functions5,whereis_diff_functions6, + whereis_diff_modules1,whereis_diff_modules1_pathsens, + whereis_diff_modules1_rec,whereis_diff_modules2, + whereis_diff_modules2_pathsens,whereis_diff_modules2_rec, + whereis_diff_modules3,whereis_diff_modules_nested, + whereis_diff_modules_twice,whereis_diff_vars_no_race, + whereis_diff_vars_race,whereis_intra_inter_module1, + whereis_intra_inter_module2,whereis_intra_inter_module3, + whereis_intra_inter_module4,whereis_intra_inter_module5, + whereis_intra_inter_module6,whereis_intra_inter_module7, + whereis_intra_inter_module8,whereis_param,whereis_param_inter_module, + whereis_rec_function1,whereis_rec_function2,whereis_rec_function3, + whereis_rec_function4,whereis_rec_function5,whereis_rec_function6, + whereis_rec_function7,whereis_rec_function8,whereis_try_catch, + whereis_vars1,whereis_vars10,whereis_vars11,whereis_vars12,whereis_vars13, + whereis_vars14,whereis_vars15,whereis_vars16,whereis_vars17,whereis_vars18, + whereis_vars19,whereis_vars2,whereis_vars20,whereis_vars21,whereis_vars22, + whereis_vars3,whereis_vars4,whereis_vars5,whereis_vars6,whereis_vars7, + whereis_vars8,whereis_vars9]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +race_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +ets_insert_args1(Config) -> + case dialyze(Config, ets_insert_args1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args2(Config) -> + case dialyze(Config, ets_insert_args2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args3(Config) -> + case dialyze(Config, ets_insert_args3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args4(Config) -> + case dialyze(Config, ets_insert_args4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args5(Config) -> + case dialyze(Config, ets_insert_args5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args6(Config) -> + case dialyze(Config, ets_insert_args6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args7(Config) -> + case dialyze(Config, ets_insert_args7) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_args8(Config) -> + case dialyze(Config, ets_insert_args8) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_control_flow1(Config) -> + case dialyze(Config, ets_insert_control_flow1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_control_flow2(Config) -> + case dialyze(Config, ets_insert_control_flow2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_control_flow3(Config) -> + case dialyze(Config, ets_insert_control_flow3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_control_flow4(Config) -> + case dialyze(Config, ets_insert_control_flow4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_control_flow5(Config) -> + case dialyze(Config, ets_insert_control_flow5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_diff_atoms_race1(Config) -> + case dialyze(Config, ets_insert_diff_atoms_race1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_diff_atoms_race2(Config) -> + case dialyze(Config, ets_insert_diff_atoms_race2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_diff_atoms_race3(Config) -> + case dialyze(Config, ets_insert_diff_atoms_race3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_diff_atoms_race4(Config) -> + case dialyze(Config, ets_insert_diff_atoms_race4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_diff_atoms_race5(Config) -> + case dialyze(Config, ets_insert_diff_atoms_race5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_diff_atoms_race6(Config) -> + case dialyze(Config, ets_insert_diff_atoms_race6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_double1(Config) -> + case dialyze(Config, ets_insert_double1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_double2(Config) -> + case dialyze(Config, ets_insert_double2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_funs1(Config) -> + case dialyze(Config, ets_insert_funs1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_funs2(Config) -> + case dialyze(Config, ets_insert_funs2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_new(Config) -> + case dialyze(Config, ets_insert_new) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_insert_param(Config) -> + case dialyze(Config, ets_insert_param) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +extract_translations(Config) -> + case dialyze(Config, extract_translations) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_diff_atoms_race1(Config) -> + case dialyze(Config, mnesia_diff_atoms_race1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_diff_atoms_race2(Config) -> + case dialyze(Config, mnesia_diff_atoms_race2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_one_write_two(Config) -> + case dialyze(Config, mnesia_dirty_read_one_write_two) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_two_write_one(Config) -> + case dialyze(Config, mnesia_dirty_read_two_write_one) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_write_double1(Config) -> + case dialyze(Config, mnesia_dirty_read_write_double1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_write_double2(Config) -> + case dialyze(Config, mnesia_dirty_read_write_double2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_write_double3(Config) -> + case dialyze(Config, mnesia_dirty_read_write_double3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_write_double4(Config) -> + case dialyze(Config, mnesia_dirty_read_write_double4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_write_one(Config) -> + case dialyze(Config, mnesia_dirty_read_write_one) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mnesia_dirty_read_write_two(Config) -> + case dialyze(Config, mnesia_dirty_read_write_two) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_control_flow1(Config) -> + case dialyze(Config, whereis_control_flow1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_control_flow2(Config) -> + case dialyze(Config, whereis_control_flow2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_control_flow3(Config) -> + case dialyze(Config, whereis_control_flow3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_control_flow4(Config) -> + case dialyze(Config, whereis_control_flow4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_control_flow5(Config) -> + case dialyze(Config, whereis_control_flow5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_control_flow6(Config) -> + case dialyze(Config, whereis_control_flow6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_atoms_no_race(Config) -> + case dialyze(Config, whereis_diff_atoms_no_race) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_atoms_race(Config) -> + case dialyze(Config, whereis_diff_atoms_race) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions1(Config) -> + case dialyze(Config, whereis_diff_functions1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions1_nested(Config) -> + case dialyze(Config, whereis_diff_functions1_nested) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions1_pathsens(Config) -> + case dialyze(Config, whereis_diff_functions1_pathsens) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions1_twice(Config) -> + case dialyze(Config, whereis_diff_functions1_twice) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions2(Config) -> + case dialyze(Config, whereis_diff_functions2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions2_nested(Config) -> + case dialyze(Config, whereis_diff_functions2_nested) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions2_pathsens(Config) -> + case dialyze(Config, whereis_diff_functions2_pathsens) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions2_twice(Config) -> + case dialyze(Config, whereis_diff_functions2_twice) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions3(Config) -> + case dialyze(Config, whereis_diff_functions3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions3_nested(Config) -> + case dialyze(Config, whereis_diff_functions3_nested) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions3_pathsens(Config) -> + case dialyze(Config, whereis_diff_functions3_pathsens) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions4(Config) -> + case dialyze(Config, whereis_diff_functions4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions5(Config) -> + case dialyze(Config, whereis_diff_functions5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_functions6(Config) -> + case dialyze(Config, whereis_diff_functions6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules1(Config) -> + case dialyze(Config, whereis_diff_modules1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules1_pathsens(Config) -> + case dialyze(Config, whereis_diff_modules1_pathsens) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules1_rec(Config) -> + case dialyze(Config, whereis_diff_modules1_rec) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules2(Config) -> + case dialyze(Config, whereis_diff_modules2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules2_pathsens(Config) -> + case dialyze(Config, whereis_diff_modules2_pathsens) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules2_rec(Config) -> + case dialyze(Config, whereis_diff_modules2_rec) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules3(Config) -> + case dialyze(Config, whereis_diff_modules3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules_nested(Config) -> + case dialyze(Config, whereis_diff_modules_nested) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_modules_twice(Config) -> + case dialyze(Config, whereis_diff_modules_twice) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_vars_no_race(Config) -> + case dialyze(Config, whereis_diff_vars_no_race) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_diff_vars_race(Config) -> + case dialyze(Config, whereis_diff_vars_race) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module1(Config) -> + case dialyze(Config, whereis_intra_inter_module1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module2(Config) -> + case dialyze(Config, whereis_intra_inter_module2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module3(Config) -> + case dialyze(Config, whereis_intra_inter_module3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module4(Config) -> + case dialyze(Config, whereis_intra_inter_module4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module5(Config) -> + case dialyze(Config, whereis_intra_inter_module5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module6(Config) -> + case dialyze(Config, whereis_intra_inter_module6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module7(Config) -> + case dialyze(Config, whereis_intra_inter_module7) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_intra_inter_module8(Config) -> + case dialyze(Config, whereis_intra_inter_module8) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_param(Config) -> + case dialyze(Config, whereis_param) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_param_inter_module(Config) -> + case dialyze(Config, whereis_param_inter_module) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function1(Config) -> + case dialyze(Config, whereis_rec_function1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function2(Config) -> + case dialyze(Config, whereis_rec_function2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function3(Config) -> + case dialyze(Config, whereis_rec_function3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function4(Config) -> + case dialyze(Config, whereis_rec_function4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function5(Config) -> + case dialyze(Config, whereis_rec_function5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function6(Config) -> + case dialyze(Config, whereis_rec_function6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function7(Config) -> + case dialyze(Config, whereis_rec_function7) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_rec_function8(Config) -> + case dialyze(Config, whereis_rec_function8) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_try_catch(Config) -> + case dialyze(Config, whereis_try_catch) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars1(Config) -> + case dialyze(Config, whereis_vars1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars10(Config) -> + case dialyze(Config, whereis_vars10) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars11(Config) -> + case dialyze(Config, whereis_vars11) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars12(Config) -> + case dialyze(Config, whereis_vars12) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars13(Config) -> + case dialyze(Config, whereis_vars13) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars14(Config) -> + case dialyze(Config, whereis_vars14) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars15(Config) -> + case dialyze(Config, whereis_vars15) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars16(Config) -> + case dialyze(Config, whereis_vars16) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars17(Config) -> + case dialyze(Config, whereis_vars17) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars18(Config) -> + case dialyze(Config, whereis_vars18) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars19(Config) -> + case dialyze(Config, whereis_vars19) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars2(Config) -> + case dialyze(Config, whereis_vars2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars20(Config) -> + case dialyze(Config, whereis_vars20) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars21(Config) -> + case dialyze(Config, whereis_vars21) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars22(Config) -> + case dialyze(Config, whereis_vars22) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars3(Config) -> + case dialyze(Config, whereis_vars3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars4(Config) -> + case dialyze(Config, whereis_vars4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars5(Config) -> + case dialyze(Config, whereis_vars5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars6(Config) -> + case dialyze(Config, whereis_vars6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars7(Config) -> + case dialyze(Config, whereis_vars7) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars8(Config) -> + case dialyze(Config, whereis_vars8) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +whereis_vars9(Config) -> + case dialyze(Config, whereis_vars9) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. -whereis_try_catch(Config) when is_list(Config) -> - ?line run(Config, {whereis_try_catch, file}), - ok. - -whereis_vars1(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars1, file}), - ok. - -whereis_vars10(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars10, file}), - ok. - -whereis_vars11(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars11, file}), - ok. - -whereis_vars12(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars12, file}), - ok. - -whereis_vars13(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars13, file}), - ok. - -whereis_vars14(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars14, file}), - ok. - -whereis_vars15(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars15, file}), - ok. - -whereis_vars16(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars16, file}), - ok. - -whereis_vars17(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars17, file}), - ok. - -whereis_vars18(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars18, file}), - ok. - -whereis_vars19(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars19, file}), - ok. - -whereis_vars2(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars2, file}), - ok. - -whereis_vars20(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars20, file}), - ok. - -whereis_vars21(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars21, file}), - ok. - -whereis_vars22(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars22, file}), - ok. - -whereis_vars3(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars3, file}), - ok. - -whereis_vars4(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars4, file}), - ok. - -whereis_vars5(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars5, file}), - ok. - -whereis_vars6(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars6, file}), - ok. - -whereis_vars7(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars7, file}), - ok. - -whereis_vars8(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars8, file}), - ok. - -whereis_vars9(Config) when is_list(Config) -> - ?line run(Config, {whereis_vars9, file}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. - -fail() -> - io:format("failed\n"), - ?t:fail(). diff --git a/lib/dialyzer/test/remake b/lib/dialyzer/test/remake index 1b8af050ef..654bdd9e88 100755 --- a/lib/dialyzer/test/remake +++ b/lib/dialyzer/test/remake @@ -1,5 +1,9 @@ #!/bin/bash -erlc +warn_exported_vars +warn_unused_import +warn_untyped_record +warn_missing_spec generator.erl -erl -noshell -run generator suite "$1" -s erlang halt -rm generator.beam
\ No newline at end of file +erlc +warn_exported_vars +warn_unused_import +warn_untyped_record +warn_missing_spec dialyzer_common.erl file_utils.erl +if [ -n "$1" ]; then + erl -noshell -run dialyzer_common create_suite "$1" -s erlang halt +else + erl -noshell -run dialyzer_common create_all_suites -s erlang halt +fi +rm dialyzer_common.beam file_utils.beam
\ No newline at end of file diff --git a/lib/dialyzer/test/small_tests_SUITE.erl b/lib/dialyzer/test/small_tests_SUITE.erl index d07a80647d..21a2c76160 100644 --- a/lib/dialyzer/test/small_tests_SUITE.erl +++ b/lib/dialyzer/test/small_tests_SUITE.erl @@ -1,357 +1,483 @@ +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. + -module(small_tests_SUITE). --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). - --export([app_call/1, appmon_place/1, areq/1, atom_call/1, atom_guard/1, - atom_widen/1, bs_fail_constr/1, bs_utf8/1, cerl_hipeify/1, - comm_layer/1, compare1/1, confusing_warning/1, contract2/1, - contract3/1, contract5/1, disj_norm_form/1, eqeq/1, - ets_select/1, exhaust_case/1, failing_guard1/1, flatten/1, - fun_app/1, fun_ref_match/1, fun_ref_record/1, gencall/1, - gs_make/1, inf_loop2/1, letrec1/1, list_match/1, lzip/1, - make_tuple/1, minus_minus/1, mod_info/1, my_filter/1, - my_sofs/1, no_match/1, no_unused_fun/1, no_unused_fun2/1, - non_existing/1, not_guard_crash/1, or_bug/1, orelsebug/1, - orelsebug2/1, overloaded1/1, port_info_test/1, - process_info_test/1, pubsub/1, receive1/1, record_construct/1, - record_pat/1, record_send_test/1, record_test/1, - recursive_types1/1, recursive_types2/1, recursive_types3/1, - recursive_types4/1, recursive_types5/1, recursive_types6/1, - recursive_types7/1, refine_bug1/1, toth/1, trec/1, try1/1, - tuple1/1, unsafe_beamcode_bug/1, unused_cases/1, - unused_clauses/1, zero_tuple/1]). - --define(default_timeout, ?t:minutes(1)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). - -groups() -> []. - -init_per_group(_GroupName, Config) -> Config. - -end_per_group(_GroupName, Config) -> Config. - -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, []}, {watchdog, Dog} | Config]. - -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). + +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([small_tests_SUITE_consistency/1, app_call/1, appmon_place/1, + areq/1, atom_call/1, atom_guard/1, atom_widen/1, + bs_fail_constr/1, bs_utf8/1, cerl_hipeify/1, comm_layer/1, + compare1/1, confusing_warning/1, contract2/1, contract3/1, + contract5/1, disj_norm_form/1, eqeq/1, ets_select/1, + exhaust_case/1, failing_guard1/1, flatten/1, fun_app/1, + fun_ref_match/1, fun_ref_record/1, gencall/1, gs_make/1, + inf_loop2/1, letrec1/1, list_match/1, lzip/1, make_tuple/1, + minus_minus/1, mod_info/1, my_filter/1, my_sofs/1, no_match/1, + no_unused_fun/1, no_unused_fun2/1, non_existing/1, + not_guard_crash/1, or_bug/1, orelsebug/1, orelsebug2/1, + overloaded1/1, port_info_test/1, process_info_test/1, pubsub/1, + receive1/1, record_construct/1, record_pat/1, + record_send_test/1, record_test/1, recursive_types1/1, + recursive_types2/1, recursive_types3/1, recursive_types4/1, + recursive_types5/1, recursive_types6/1, recursive_types7/1, + refine_bug1/1, toth/1, trec/1, try1/1, tuple1/1, + unsafe_beamcode_bug/1, unused_cases/1, unused_clauses/1, + zero_tuple/1]). + +suite() -> + [{timetrap, {minutes, 1}}]. + +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, []}|Config] + end. + +end_per_suite(_Config) -> + ok. all() -> - [app_call,appmon_place,areq,atom_call,atom_guard,atom_widen, - bs_fail_constr,bs_utf8,cerl_hipeify,comm_layer,compare1, - confusing_warning,contract2,contract3,contract5,disj_norm_form,eqeq, - ets_select,exhaust_case,failing_guard1,flatten,fun_app,fun_ref_match, - fun_ref_record,gencall,gs_make,inf_loop2,letrec1,list_match,lzip, - make_tuple,minus_minus,mod_info,my_filter,my_sofs,no_match,no_unused_fun, - no_unused_fun2,non_existing,not_guard_crash,or_bug,orelsebug,orelsebug2, - overloaded1,port_info_test,process_info_test,pubsub,receive1, - record_construct,record_pat,record_send_test,record_test, - recursive_types1,recursive_types2,recursive_types3,recursive_types4, - recursive_types5,recursive_types6,recursive_types7,refine_bug1,toth,trec, - try1,tuple1,unsafe_beamcode_bug,unused_cases,unused_clauses,zero_tuple]. - -app_call(Config) when is_list(Config) -> - ?line run(Config, {app_call, file}), - ok. - -appmon_place(Config) when is_list(Config) -> - ?line run(Config, {appmon_place, file}), - ok. - -areq(Config) when is_list(Config) -> - ?line run(Config, {areq, file}), - ok. - -atom_call(Config) when is_list(Config) -> - ?line run(Config, {atom_call, file}), - ok. - -atom_guard(Config) when is_list(Config) -> - ?line run(Config, {atom_guard, file}), - ok. - -atom_widen(Config) when is_list(Config) -> - ?line run(Config, {atom_widen, file}), - ok. - -bs_fail_constr(Config) when is_list(Config) -> - ?line run(Config, {bs_fail_constr, file}), - ok. - -bs_utf8(Config) when is_list(Config) -> - ?line run(Config, {bs_utf8, file}), - ok. - -cerl_hipeify(Config) when is_list(Config) -> - ?line run(Config, {cerl_hipeify, file}), - ok. - -comm_layer(Config) when is_list(Config) -> - ?line run(Config, {comm_layer, dir}), - ok. - -compare1(Config) when is_list(Config) -> - ?line run(Config, {compare1, file}), - ok. - -confusing_warning(Config) when is_list(Config) -> - ?line run(Config, {confusing_warning, file}), - ok. - -contract2(Config) when is_list(Config) -> - ?line run(Config, {contract2, file}), - ok. - -contract3(Config) when is_list(Config) -> - ?line run(Config, {contract3, file}), - ok. - -contract5(Config) when is_list(Config) -> - ?line run(Config, {contract5, file}), - ok. - -disj_norm_form(Config) when is_list(Config) -> - ?line run(Config, {disj_norm_form, file}), - ok. - -eqeq(Config) when is_list(Config) -> - ?line run(Config, {eqeq, file}), - ok. - -ets_select(Config) when is_list(Config) -> - ?line run(Config, {ets_select, file}), - ok. - -exhaust_case(Config) when is_list(Config) -> - ?line run(Config, {exhaust_case, file}), - ok. - -failing_guard1(Config) when is_list(Config) -> - ?line run(Config, {failing_guard1, file}), - ok. - -flatten(Config) when is_list(Config) -> - ?line run(Config, {flatten, file}), - ok. - -fun_app(Config) when is_list(Config) -> - ?line run(Config, {fun_app, file}), - ok. - -fun_ref_match(Config) when is_list(Config) -> - ?line run(Config, {fun_ref_match, file}), - ok. - -fun_ref_record(Config) when is_list(Config) -> - ?line run(Config, {fun_ref_record, file}), - ok. - -gencall(Config) when is_list(Config) -> - ?line run(Config, {gencall, file}), - ok. - -gs_make(Config) when is_list(Config) -> - ?line run(Config, {gs_make, file}), - ok. - -inf_loop2(Config) when is_list(Config) -> - ?line run(Config, {inf_loop2, file}), - ok. - -letrec1(Config) when is_list(Config) -> - ?line run(Config, {letrec1, file}), - ok. - -list_match(Config) when is_list(Config) -> - ?line run(Config, {list_match, file}), - ok. - -lzip(Config) when is_list(Config) -> - ?line run(Config, {lzip, file}), - ok. - -make_tuple(Config) when is_list(Config) -> - ?line run(Config, {make_tuple, file}), - ok. - -minus_minus(Config) when is_list(Config) -> - ?line run(Config, {minus_minus, file}), - ok. - -mod_info(Config) when is_list(Config) -> - ?line run(Config, {mod_info, file}), - ok. - -my_filter(Config) when is_list(Config) -> - ?line run(Config, {my_filter, file}), - ok. - -my_sofs(Config) when is_list(Config) -> - ?line run(Config, {my_sofs, file}), - ok. - -no_match(Config) when is_list(Config) -> - ?line run(Config, {no_match, file}), - ok. - -no_unused_fun(Config) when is_list(Config) -> - ?line run(Config, {no_unused_fun, file}), - ok. - -no_unused_fun2(Config) when is_list(Config) -> - ?line run(Config, {no_unused_fun2, file}), - ok. - -non_existing(Config) when is_list(Config) -> - ?line run(Config, {non_existing, file}), - ok. - -not_guard_crash(Config) when is_list(Config) -> - ?line run(Config, {not_guard_crash, file}), - ok. - -or_bug(Config) when is_list(Config) -> - ?line run(Config, {or_bug, file}), - ok. - -orelsebug(Config) when is_list(Config) -> - ?line run(Config, {orelsebug, file}), - ok. - -orelsebug2(Config) when is_list(Config) -> - ?line run(Config, {orelsebug2, file}), - ok. - -overloaded1(Config) when is_list(Config) -> - ?line run(Config, {overloaded1, file}), - ok. - -port_info_test(Config) when is_list(Config) -> - ?line run(Config, {port_info_test, file}), - ok. + [small_tests_SUITE_consistency,app_call,appmon_place,areq,atom_call, + atom_guard,atom_widen,bs_fail_constr,bs_utf8,cerl_hipeify,comm_layer, + compare1,confusing_warning,contract2,contract3,contract5,disj_norm_form, + eqeq,ets_select,exhaust_case,failing_guard1,flatten,fun_app,fun_ref_match, + fun_ref_record,gencall,gs_make,inf_loop2,letrec1,list_match,lzip, + make_tuple,minus_minus,mod_info,my_filter,my_sofs,no_match,no_unused_fun, + no_unused_fun2,non_existing,not_guard_crash,or_bug,orelsebug,orelsebug2, + overloaded1,port_info_test,process_info_test,pubsub,receive1, + record_construct,record_pat,record_send_test,record_test,recursive_types1, + recursive_types2,recursive_types3,recursive_types4,recursive_types5, + recursive_types6,recursive_types7,refine_bug1,toth,trec,try1,tuple1, + unsafe_beamcode_bug,unused_cases,unused_clauses,zero_tuple]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +small_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +app_call(Config) -> + case dialyze(Config, app_call) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +appmon_place(Config) -> + case dialyze(Config, appmon_place) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +areq(Config) -> + case dialyze(Config, areq) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +atom_call(Config) -> + case dialyze(Config, atom_call) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +atom_guard(Config) -> + case dialyze(Config, atom_guard) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +atom_widen(Config) -> + case dialyze(Config, atom_widen) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +bs_fail_constr(Config) -> + case dialyze(Config, bs_fail_constr) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +bs_utf8(Config) -> + case dialyze(Config, bs_utf8) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +cerl_hipeify(Config) -> + case dialyze(Config, cerl_hipeify) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +comm_layer(Config) -> + case dialyze(Config, comm_layer) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +compare1(Config) -> + case dialyze(Config, compare1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +confusing_warning(Config) -> + case dialyze(Config, confusing_warning) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +contract2(Config) -> + case dialyze(Config, contract2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +contract3(Config) -> + case dialyze(Config, contract3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +contract5(Config) -> + case dialyze(Config, contract5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +disj_norm_form(Config) -> + case dialyze(Config, disj_norm_form) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +eqeq(Config) -> + case dialyze(Config, eqeq) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +ets_select(Config) -> + case dialyze(Config, ets_select) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +exhaust_case(Config) -> + case dialyze(Config, exhaust_case) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +failing_guard1(Config) -> + case dialyze(Config, failing_guard1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +flatten(Config) -> + case dialyze(Config, flatten) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +fun_app(Config) -> + case dialyze(Config, fun_app) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +fun_ref_match(Config) -> + case dialyze(Config, fun_ref_match) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +fun_ref_record(Config) -> + case dialyze(Config, fun_ref_record) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +gencall(Config) -> + case dialyze(Config, gencall) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +gs_make(Config) -> + case dialyze(Config, gs_make) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +inf_loop2(Config) -> + case dialyze(Config, inf_loop2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +letrec1(Config) -> + case dialyze(Config, letrec1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +list_match(Config) -> + case dialyze(Config, list_match) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +lzip(Config) -> + case dialyze(Config, lzip) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +make_tuple(Config) -> + case dialyze(Config, make_tuple) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +minus_minus(Config) -> + case dialyze(Config, minus_minus) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +mod_info(Config) -> + case dialyze(Config, mod_info) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +my_filter(Config) -> + case dialyze(Config, my_filter) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +my_sofs(Config) -> + case dialyze(Config, my_sofs) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +no_match(Config) -> + case dialyze(Config, no_match) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +no_unused_fun(Config) -> + case dialyze(Config, no_unused_fun) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +no_unused_fun2(Config) -> + case dialyze(Config, no_unused_fun2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +non_existing(Config) -> + case dialyze(Config, non_existing) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +not_guard_crash(Config) -> + case dialyze(Config, not_guard_crash) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +or_bug(Config) -> + case dialyze(Config, or_bug) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +orelsebug(Config) -> + case dialyze(Config, orelsebug) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +orelsebug2(Config) -> + case dialyze(Config, orelsebug2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +overloaded1(Config) -> + case dialyze(Config, overloaded1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +port_info_test(Config) -> + case dialyze(Config, port_info_test) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +process_info_test(Config) -> + case dialyze(Config, process_info_test) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +pubsub(Config) -> + case dialyze(Config, pubsub) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +receive1(Config) -> + case dialyze(Config, receive1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +record_construct(Config) -> + case dialyze(Config, record_construct) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +record_pat(Config) -> + case dialyze(Config, record_pat) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +record_send_test(Config) -> + case dialyze(Config, record_send_test) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +record_test(Config) -> + case dialyze(Config, record_test) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types1(Config) -> + case dialyze(Config, recursive_types1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types2(Config) -> + case dialyze(Config, recursive_types2) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types3(Config) -> + case dialyze(Config, recursive_types3) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types4(Config) -> + case dialyze(Config, recursive_types4) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types5(Config) -> + case dialyze(Config, recursive_types5) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types6(Config) -> + case dialyze(Config, recursive_types6) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +recursive_types7(Config) -> + case dialyze(Config, recursive_types7) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +refine_bug1(Config) -> + case dialyze(Config, refine_bug1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +toth(Config) -> + case dialyze(Config, toth) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +trec(Config) -> + case dialyze(Config, trec) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +try1(Config) -> + case dialyze(Config, try1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +tuple1(Config) -> + case dialyze(Config, tuple1) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +unsafe_beamcode_bug(Config) -> + case dialyze(Config, unsafe_beamcode_bug) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +unused_cases(Config) -> + case dialyze(Config, unused_cases) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +unused_clauses(Config) -> + case dialyze(Config, unused_clauses) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +zero_tuple(Config) -> + case dialyze(Config, zero_tuple) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. -process_info_test(Config) when is_list(Config) -> - ?line run(Config, {process_info_test, file}), - ok. - -pubsub(Config) when is_list(Config) -> - ?line run(Config, {pubsub, dir}), - ok. - -receive1(Config) when is_list(Config) -> - ?line run(Config, {receive1, file}), - ok. - -record_construct(Config) when is_list(Config) -> - ?line run(Config, {record_construct, file}), - ok. - -record_pat(Config) when is_list(Config) -> - ?line run(Config, {record_pat, file}), - ok. - -record_send_test(Config) when is_list(Config) -> - ?line run(Config, {record_send_test, file}), - ok. - -record_test(Config) when is_list(Config) -> - ?line run(Config, {record_test, file}), - ok. - -recursive_types1(Config) when is_list(Config) -> - ?line run(Config, {recursive_types1, file}), - ok. - -recursive_types2(Config) when is_list(Config) -> - ?line run(Config, {recursive_types2, file}), - ok. - -recursive_types3(Config) when is_list(Config) -> - ?line run(Config, {recursive_types3, file}), - ok. - -recursive_types4(Config) when is_list(Config) -> - ?line run(Config, {recursive_types4, file}), - ok. - -recursive_types5(Config) when is_list(Config) -> - ?line run(Config, {recursive_types5, file}), - ok. - -recursive_types6(Config) when is_list(Config) -> - ?line run(Config, {recursive_types6, file}), - ok. - -recursive_types7(Config) when is_list(Config) -> - ?line run(Config, {recursive_types7, file}), - ok. - -refine_bug1(Config) when is_list(Config) -> - ?line run(Config, {refine_bug1, file}), - ok. - -toth(Config) when is_list(Config) -> - ?line run(Config, {toth, file}), - ok. - -trec(Config) when is_list(Config) -> - ?line run(Config, {trec, file}), - ok. - -try1(Config) when is_list(Config) -> - ?line run(Config, {try1, file}), - ok. - -tuple1(Config) when is_list(Config) -> - ?line run(Config, {tuple1, file}), - ok. - -unsafe_beamcode_bug(Config) when is_list(Config) -> - ?line run(Config, {unsafe_beamcode_bug, file}), - ok. - -unused_cases(Config) when is_list(Config) -> - ?line run(Config, {unused_cases, file}), - ok. - -unused_clauses(Config) when is_list(Config) -> - ?line run(Config, {unused_clauses, file}), - ok. - -zero_tuple(Config) when is_list(Config) -> - ?line run(Config, {zero_tuple, file}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. - -fail() -> - io:format("failed\n"), - ?t:fail(). diff --git a/lib/dialyzer/test/user_tests_SUITE.erl b/lib/dialyzer/test/user_tests_SUITE.erl index 5d65142cd9..9654114725 100644 --- a/lib/dialyzer/test/user_tests_SUITE.erl +++ b/lib/dialyzer/test/user_tests_SUITE.erl @@ -1,78 +1,78 @@ --module(user_tests_SUITE). - --include_lib("test_server/include/test_server.hrl"). - --export([all/0, groups/0, init_per_group/2, end_per_group/2, - init_per_testcase/2, fin_per_testcase/2]). +%% ATTENTION! +%% This is an automatically generated file. Do not edit. +%% Use './remake' script to refresh it if needed. +%% All Dialyzer options should be defined in dialyzer_options +%% file. --export([broken_dialyzer/1, gcpFlowControl/1, qlc_error/1, spvcOrig/1, - wsp_pdu/1]). - --define(default_timeout, ?t:minutes(1)). --define(dialyzer_options, ?config(dialyzer_options, Config)). --define(datadir, ?config(data_dir, Config)). --define(privdir, ?config(priv_dir, Config)). +-module(user_tests_SUITE). -groups() -> []. +-include("ct.hrl"). +-include("dialyzer_test_constants.hrl"). -init_per_group(_GroupName, Config) -> Config. +-export([suite/0, init_per_suite/0, init_per_suite/1, + end_per_suite/1, all/0]). +-export([user_tests_SUITE_consistency/1, broken_dialyzer/1, + gcpFlowControl/1, qlc_error/1, spvcOrig/1, wsp_pdu/1]). -end_per_group(_GroupName, Config) -> Config. +suite() -> + [{timetrap, {minutes, 3}}]. -init_per_testcase(_Case, Config) -> - ?line Dog = ?t:timetrap(?default_timeout), - [{dialyzer_options, []}, {watchdog, Dog} | Config]. +init_per_suite() -> + [{timetrap, ?plt_timeout}]. +init_per_suite(Config) -> + OutDir = ?config(priv_dir, Config), + case dialyzer_common:check_plt(OutDir) of + fail -> {skip, "Plt creation/check failed."}; + ok -> [{dialyzer_options, []}|Config] + end. -fin_per_testcase(_Case, _Config) -> - Dog = ?config(watchdog, _Config), - ?t:timetrap_cancel(Dog), - ok. +end_per_suite(_Config) -> + ok. all() -> - [broken_dialyzer,gcpFlowControl,qlc_error,spvcOrig,wsp_pdu]. - -broken_dialyzer(Config) when is_list(Config) -> - ?line run(Config, {broken_dialyzer, file}), - ok. - -gcpFlowControl(Config) when is_list(Config) -> - ?line run(Config, {gcpFlowControl, file}), - ok. - -qlc_error(Config) when is_list(Config) -> - ?line run(Config, {qlc_error, file}), - ok. - -spvcOrig(Config) when is_list(Config) -> - ?line run(Config, {spvcOrig, file}), - ok. - -wsp_pdu(Config) when is_list(Config) -> - ?line run(Config, {wsp_pdu, file}), - ok. - -run(Config, TestCase) -> - case run_test(Config, TestCase) of - ok -> ok; - {fail, Reason} -> - ?t:format("~s",[Reason]), - fail() - end. - -run_test(Config, {TestCase, Kind}) -> - Dog = ?config(watchdog, Config), - Options = ?dialyzer_options, - Dir = ?datadir, - OutDir = ?privdir, - case dialyzer_test:dialyzer_test(Options, TestCase, Kind, - Dir, OutDir, Dog) of - same -> ok; - {differ, DiffList} -> - {fail, - io_lib:format("\nTest ~p failed:\n~p\n", - [TestCase, DiffList])} - end. + [user_tests_SUITE_consistency,broken_dialyzer,gcpFlowControl,qlc_error, + spvcOrig,wsp_pdu]. + +dialyze(Config, TestCase) -> + Opts = ?config(dialyzer_options, Config), + Dir = ?config(data_dir, Config), + OutDir = ?config(priv_dir, Config), + dialyzer_common:check(TestCase, Opts, Dir, OutDir). + +user_tests_SUITE_consistency(Config) -> + Dir = ?config(data_dir, Config), + case dialyzer_common:new_tests(Dir, all()) of + [] -> ok; + New -> ct:fail({missing_tests,New}) + end. + +broken_dialyzer(Config) -> + case dialyze(Config, broken_dialyzer) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +gcpFlowControl(Config) -> + case dialyze(Config, gcpFlowControl) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +qlc_error(Config) -> + case dialyze(Config, qlc_error) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +spvcOrig(Config) -> + case dialyze(Config, spvcOrig) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. + +wsp_pdu(Config) -> + case dialyze(Config, wsp_pdu) of + 'same' -> 'same'; + Error -> ct:fail(Error) + end. -fail() -> - io:format("failed\n"), - ?t:fail(). diff --git a/lib/dialyzer/test/user_tests_SUITE_data/dialyzer_options b/lib/dialyzer/test/user_tests_SUITE_data/dialyzer_options index d428785af4..513ed7752b 100644 --- a/lib/dialyzer/test/user_tests_SUITE_data/dialyzer_options +++ b/lib/dialyzer/test/user_tests_SUITE_data/dialyzer_options @@ -1 +1,2 @@ -{dialyzer_options, []}.
\ No newline at end of file +{dialyzer_options, []}. +{time_limit, 3}.
\ No newline at end of file |