diff options
author | Björn-Egil Dahlberg <[email protected]> | 2016-05-20 19:43:10 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2016-05-20 19:43:10 +0200 |
commit | e1cef0d4f0f151476f99eb18e7a7263e8e9cb2f5 (patch) | |
tree | 958d51da3b0b71be04eebf4f19c459a4d92dbf3a /lib/xmerl/test/xmerl_xsd_lib.erl | |
parent | 3b5bfab5235cb045c4c24d076006ded3e5d1a423 (diff) | |
download | otp-e1cef0d4f0f151476f99eb18e7a7263e8e9cb2f5.tar.gz otp-e1cef0d4f0f151476f99eb18e7a7263e8e9cb2f5.tar.bz2 otp-e1cef0d4f0f151476f99eb18e7a7263e8e9cb2f5.zip |
Eliminate use of ?config() macro
Diffstat (limited to 'lib/xmerl/test/xmerl_xsd_lib.erl')
-rw-r--r-- | lib/xmerl/test/xmerl_xsd_lib.erl | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/lib/xmerl/test/xmerl_xsd_lib.erl b/lib/xmerl/test/xmerl_xsd_lib.erl index 46134288f1..6006cf500f 100644 --- a/lib/xmerl/test/xmerl_xsd_lib.erl +++ b/lib/xmerl/test/xmerl_xsd_lib.erl @@ -104,7 +104,7 @@ return_results2({NewFail, NewSuccess, NewMal, NewNotMal}, NumSucc, SkippedN, Tot process_reference_results(Config, {ErrsST, MalST}, {ErrsIT, MalIT}) -> {RefFailed, RefMalicious} = xsd_reference_log(Config), -io:format("A: ~p : ~p\n\n",[RefFailed, RefMalicious]), + io:format("A: ~p : ~p\n\n",[RefFailed, RefMalicious]), AllErrs = ErrsST ++ ErrsIT, AllMals = MalST ++ MalIT, %% test cases failed now but succeeded in reference results. @@ -116,44 +116,45 @@ io:format("A: ~p : ~p\n\n",[RefFailed, RefMalicious]), %% test cases succeeded now but malicious in reference results. NewNotMal = [X||X<-RefMalicious, lists:member(X, AllMals) == false], write_in_log(Config, AllErrs, AllMals), -% io:format("process_reference_results:~n AllErrs = ~p~n NewFailures = ~p~n",[AllErrs,NewFailures]), + % io:format("process_reference_results:~n AllErrs = ~p~n NewFailures = ~p~n",[AllErrs,NewFailures]), {length(RefFailed) + length(RefMalicious), {NewFailures, NewSucceeds, NewMalicious, NewNotMal}}. xsd_reference_log(Config) -> - DataDir = ?config(data_dir, Config), - Suite = ?config(suite, Config), + DataDir = datadir(Config), + Suite = proplists:get_value(suite, Config), SuiteReferenceLog = - filename:join([DataDir, lists:concat([Suite, "_failed_cases.log"])]), -io:format("B: ~p\n\n",[SuiteReferenceLog]), + filename:join([DataDir,lists:concat([Suite,"_failed_cases.log"])]), + io:format("B: ~p\n\n",[SuiteReferenceLog]), case file:consult(SuiteReferenceLog) of - {ok,List} when is_list(List) -> -io:format("C: ~p\n\n",[List]), - case lists:keysearch(?config(testcase, Config), 1, List) of - {value,{_, TCRefFails}} -> -io:format("D: ~p\n\n",[TCRefFails]), - TCRefFails; - _ -> -io:format("D: ~no result\n\n",[]), - {[], []} - end; - _ -> - {[], []} + {ok,List} when is_list(List) -> + io:format("C: ~p\n\n",[List]), + case lists:keysearch(proplists:get_value(testcase, Config), 1, List) of + {value,{_, TCRefFails}} -> + io:format("D: ~p\n\n",[TCRefFails]), + TCRefFails; + _ -> + io:format("D: ~no result\n\n",[]), + {[], []} + end; + _ -> + {[], []} end. write_in_log(_Config, [], []) -> ok; write_in_log(Config, AllErrs, AllMals) -> - LogFileName = ?config(xmerl_error_log, Config), + LogFileName = proplists:get_value(xmerl_error_log, Config), {ok,IO}=file:open(LogFileName, [append]), - TestCase = ?config(testcase, Config), + TestCase = proplists:get_value(testcase, Config), io:format(IO,"{~p,{~p,~p}}.~n", [TestCase, AllErrs, AllMals]), file:close(IO), ok. schema_test(Config,FileName,XsdBase,Validity) -> ModuleName = filename:basename(FileName), - DataDir = ?config(data_dir, Config), - case xmerl_xsd:process_schema(filename:join([DataDir, FileName]), [{xsdbase,filename:join([DataDir, XsdBase])}]) of + DataDir = datadir(Config), + case xmerl_xsd:process_schema(filename:join([DataDir, FileName]), + [{xsdbase,filename:join([DataDir, XsdBase])}]) of {error, enoent} -> {{ModuleName, enoent},#xsd_state{}}; {Ok, S} -> @@ -176,9 +177,9 @@ schema_test(Config,FileName,XsdBase,Validity) -> end. schema_test(Config, FileName, XsdBase, Validity, AccState) -> ModuleName = filename:basename(FileName), - DataDir = ?config(data_dir, Config), + DataDir = datadir(Config), case xmerl_xsd:process_schema(filename:join([DataDir, FileName]), - [{xsdbase, filename:join([DataDir, XsdBase])}, AccState]) of + [{xsdbase,filename:join([DataDir, XsdBase])}, AccState]) of {error, enoent} -> {{ModuleName, enoent}, AccState}; {Ok, S} -> @@ -197,9 +198,9 @@ schema_test(Config, FileName, XsdBase, Validity, AccState) -> end. instance_test(Config, FileName, XMLBase, Validity, State) -> ModuleName = filename:basename(FileName), - DataDir = ?config(data_dir, Config), + DataDir = datadir(Config), case xmerl_scan:file(filename:join([DataDir, FileName]), - [{xmlbase, filename:join([DataDir, XMLBase])}]) of + [{xmlbase,filename:join([DataDir, XMLBase])}]) of {error, enoent} -> {ModuleName, enoent}; {E, _} -> @@ -231,7 +232,7 @@ no_internal_error(R) -> unpack(Config, Suite) -> TarFile = suite_tar(Suite), - file:set_cwd(?config(data_dir, Config)), + file:set_cwd(datadir(Config)), ok=erl_tar:extract(TarFile, [compressed]), change_mode(filename:rootname(TarFile, ".tar.gz")). @@ -272,7 +273,7 @@ chmod(F) -> end. rmdir(Config, Suite) -> - file:set_cwd(?config(data_dir, Config)), + file:set_cwd(datadir(Config)), SuiteDir = filename:rootname(suite_tar(Suite), ".tar.gz"), ok=rm_f_(SuiteDir). @@ -301,12 +302,12 @@ create_error_log_file(Config, Suite) -> {{Y, M, D}, {H, Min, S}} = calendar:local_time(), DTString=lists:concat([Y, "-", M,"-", D, "_", H, ".", Min, ".", S]), FileName = lists:concat([Suite, "_", DTString, ".errorlog"]), -%% {ok,_IO} = file:open(filename:join([?config(priv_dir,Config), +%% {ok,_IO} = file:open(filename:join([privdir(Config), %% FileName]),[append]). %% {ok,_IO} = file:open(FileName,[append]). - io:format("error log file: ~p~n", [filename:join([?config(priv_dir,Config), FileName])]), - {ok, filename:join([?config(priv_dir,Config), FileName])}. + io:format("error log file: ~p~n", [filename:join([privdir(Config), FileName])]), + {ok, filename:join([privdir(Config), FileName])}. close_error_log_file(Config) -> case lists:keysearch(xmerl_error_log, 1, Config) of @@ -315,3 +316,8 @@ close_error_log_file(Config) -> _ -> ok end. + +privdir(Config) -> + proplists:get_value(priv_dir, Config). +datadir(Config) -> + proplists:get_value(data_dir, Config). |