diff options
author | Erlang/OTP <otp@erlang.org> | 2019-11-15 09:44:28 +0100 |
---|---|---|
committer | Erlang/OTP <otp@erlang.org> | 2019-11-15 09:44:28 +0100 |
commit | f12a0dc3543f02c0da3843729fcbb1e7a4b91a21 (patch) | |
tree | 22ce82d40ac25258edd164aa4553d326c97fc8ee | |
parent | 58356c67ece3bce61ae5df9cd37ae0fff387f2bf (diff) | |
parent | 0bf2241b3d9dad2c5f3e262311c12868f3cb97e6 (diff) | |
download | erlang-f12a0dc3543f02c0da3843729fcbb1e7a4b91a21.tar.gz |
Merge branch 'hans/common_test/ct_proptest_log_improvement/OTP-16287' into maint-20
* hans/common_test/ct_proptest_log_improvement/OTP-16287:
common_test: Improve ct_property_test logging
-rw-r--r-- | lib/common_test/src/ct_property_test.erl | 67 |
1 files changed, 48 insertions, 19 deletions
diff --git a/lib/common_test/src/ct_property_test.erl b/lib/common_test/src/ct_property_test.erl index 94ccb59af9..64422646ec 100644 --- a/lib/common_test/src/ct_property_test.erl +++ b/lib/common_test/src/ct_property_test.erl @@ -92,16 +92,27 @@ init_per_suite(Config) -> case which_module_exists([eqc,proper,triq]) of {ok,ToolModule} -> - ct:pal("Found property tester ~p",[ToolModule]), - Path = property_tests_path("property_test", Config), - case compile_tests(Path,ToolModule) of - error -> - {fail, "Property test compilation failed in "++Path}; - up_to_date -> - add_code_pathz(Path), - [{property_dir,Path}, - {property_test_tool,ToolModule} | Config] - end; + case code:where_is_file(lists:concat([ToolModule,".beam"])) of + non_existing -> + ct:log("Found ~p, but ~tp is not found", + [ToolModule, lists:concat([ToolModule,".beam"])]), + {skip, "Strange Property testing tool installation"}; + ToolPath -> + ct:pal("Found property tester ~p~n" + "at ~tp", + [ToolModule, ToolPath]), + Path = property_tests_path("property_test", Config), + case compile_tests(Path,ToolModule) of + error -> + {fail, "Property test compilation failed in "++Path}; + {skip,Reason} -> + {skip,Reason}; + up_to_date -> + add_code_pathz(Path), + [{property_dir,Path}, + {property_test_tool,ToolModule} | Config] + end + end; not_found -> ct:pal("No property tester found",[]), @@ -169,15 +180,33 @@ add_code_pathz(Dir) -> compile_tests(Path, ToolModule) -> MacroDefs = macro_def(ToolModule), {ok,Cwd} = file:get_cwd(), - ok = file:set_cwd(Path), - {ok,FileNames} = file:list_dir("."), - BeamFiles = [F || F<-FileNames, - filename:extension(F) == ".beam"], - _ = [file:delete(F) || F<-BeamFiles], - ct:pal("Compiling in ~tp:~n Deleted ~p~n MacroDefs=~p",[Path,BeamFiles,MacroDefs]), - Result = make:all([load|MacroDefs]), - ok = file:set_cwd(Cwd), - Result. + case file:set_cwd(Path) of + ok -> + case file:list_dir(".") of + {ok,[]} -> + ct:pal("No files found in ~tp", [Path]), + ok = file:set_cwd(Cwd), + {skip, "No files found"}; + {ok,FileNames} -> + BeamFiles = [F || F<-FileNames, + filename:extension(F) == ".beam"], + ErlFiles = [F || F<-FileNames, + filename:extension(F) == ".erl"], + _ = [file:delete(F) || F<-BeamFiles], + ct:pal("Compiling in ~tp~n" + " Deleted: ~p~n" + " ErlFiles: ~tp~n" + " MacroDefs: ~p", + [Path,BeamFiles,ErlFiles,MacroDefs]), + Result = make:all([load|MacroDefs]), + ok = file:set_cwd(Cwd), + Result + end; + + {error,Error} -> + ct:pal("file:set_cwd(~tp) returned ~p.~nCwd = ~tp", [Path, {error,Error}, Cwd]), + error + end. macro_def(eqc) -> [{d, 'EQC'}]; |