{"action":"created","issue":{"url":"https://api.github.com/repos/eproxus/meck/issues/195","repository_url":"https://api.github.com/repos/eproxus/meck","labels_url":"https://api.github.com/repos/eproxus/meck/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/eproxus/meck/issues/195/comments","events_url":"https://api.github.com/repos/eproxus/meck/issues/195/events","html_url":"https://github.com/eproxus/meck/pull/195","id":360868809,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1OTgxMDc2","number":195,"title":"Fix include directives inclusion","user":{"login":"lemenkov","id":41835,"node_id":"MDQ6VXNlcjQxODM1","avatar_url":"https://avatars1.githubusercontent.com/u/41835?v=4","gravatar_id":"","url":"https://api.github.com/users/lemenkov","html_url":"https://github.com/lemenkov","followers_url":"https://api.github.com/users/lemenkov/followers","following_url":"https://api.github.com/users/lemenkov/following{/other_user}","gists_url":"https://api.github.com/users/lemenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/lemenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemenkov/subscriptions","organizations_url":"https://api.github.com/users/lemenkov/orgs","repos_url":"https://api.github.com/users/lemenkov/repos","events_url":"https://api.github.com/users/lemenkov/events{/privacy}","received_events_url":"https://api.github.com/users/lemenkov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-09-17T13:26:34Z","updated_at":"2018-09-17T14:02:52Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/eproxus/meck/pulls/195","html_url":"https://github.com/eproxus/meck/pull/195","diff_url":"https://github.com/eproxus/meck/pull/195.diff","patch_url":"https://github.com/eproxus/meck/pull/195.patch"},"body":"Hello!\r\nI think I've found something really awful.\r\n\r\nSurprisingly but compiler_opts from BEAM-file doesn't contain include\r\ndirectives (at least on some Erlang versions). So we have to try read\r\ndebug_info contents as well and merge these two.\r\n\r\nUnfortunately this means that we cannot rely on output of\r\nModule:module_info(compile). Instead we need to find a binary BeamFile\r\nand parse it with beam_lib.\r\n\r\nThe result of this missing include is that meck fails to recompile and\r\nrestore original file (it cannot compile becausxe includes are missing).\r\nUnfortunately it doesn't tell us anything reasonable about the problem\r\noccured. \r\n\r\nThis fixes strange and cryptic errors like:\r\n\r\n```\r\n    meck_tests: cover_options_test_...*skipped*\r\n    undefined\r\n    *unexpected termination of test process*\r\n::{{badmatch,{error,\"/home/petro/work/meck/.eunit/../test/cover_test_module.erl\"}},\r\n   [{meck_proc,restore_original,4,[{file,\"src/meck_proc.erl\"},{line,558}]},\r\n    {meck_proc,terminate,2,[{file,\"src/meck_proc.erl\"},{line,330}]},\r\n    {gen_server,try_terminate,3,[{file,\"gen_server.erl\"},{line,648}]},\r\n    {gen_server,terminate,10,[{file,\"gen_server.erl\"},{line,833}]},\r\n    {gen_server,handle_msg,6,[{file,[...]},{line,...}]},\r\n    {proc_lib,init_p_do_apply,3,[{file,...},{...}]}]}\r\n\r\n=ERROR REPORT==== 17-Sep-2018::15:17:58 ===\r\n** Generic server cover_test_module_meck terminating\r\n** Last message in was stop\r\n** When Server state == {state,cover_test_module,\r\n                         [{a,0},{b,0},{c,2}],\r\n                         {dict,1,16,16,8,80,48,\r\n                          {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},\r\n                          {{[],[],[],\r\n                            [[{a,0}|\r\n                              {{a,0},\r\n                               [{{args_matcher,[],\r\n                                  #Ref<0.3664874906.3086876677.41258>,false},\r\n                                 {meck_exec,\r\n                                  #Fun<meck_tests.383.64411938>}}]}]],\r\n                            [],[],[],[],[],[],[],[],[],[],[],[]}}},\r\n                         true,\r\n                         [{<0.936.0>,{cover_test_module,a,[]},c}],\r\n                         {{\"/home/petro/work/meck/.eunit/../test/cover_test_module.erl\",\r\n                           \"/home/petro/work/meck/.eunit/cover_test_module.coverdata\",\r\n                           [{d,'TEST',true}]},\r\n                          no_binary},\r\n                         false,false,false,undefined,[]}\r\n** Reason for termination ==\r\n** {{badmatch,{error,\"/home/petro/work/meck/.eunit/../test/cover_test_module.erl\"}},\r\n    [{meck_proc,restore_original,4,[{file,\"src/meck_proc.erl\"},{line,558}]},\r\n     {meck_proc,terminate,2,[{file,\"src/meck_proc.erl\"},{line,330}]},\r\n     {gen_server,try_terminate,3,[{file,\"gen_server.erl\"},{line,648}]},\r\n     {gen_server,terminate,10,[{file,\"gen_server.erl\"},{line,833}]},\r\n     {gen_server,handle_msg,6,[{file,\"gen_server.erl\"},{line,679}]},\r\n     {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}\r\n** Client <0.936.0> stacktrace\r\n** [{gen,do_call,4,[{file,\"gen.erl\"},{line,169}]},\r\n    {gen_server,call,2,[{file,\"gen_server.erl\"},{line,202}]},\r\n    {meck_proc,gen_server,3,[{file,\"src/meck_proc.erl\"},{line,470}]},\r\n    {meck,unload,1,[{file,\"src/meck.erl\"},{line,475}]},\r\n    {meck_tests,run_mock_no_cover_file,1,\r\n                [{file,\"test/meck_tests.erl\"},{line,1094}]},\r\n    {meck_tests,cover_options_,1,[{file,\"test/meck_tests.erl\"},{line,1039}]},\r\n    {eunit_test,run_testfun,1,[{file,\"eunit_test.erl\"},{line,71}]},\r\n    {eunit_proc,run_test,1,[{file,\"eunit_proc.erl\"},{line,510}]}]\r\n  meck_tests: cover_options_test_...*failed*\r\nin function meck_tests:'-cover_options_fail_/1-fun-0-'/2 (test/meck_tests.erl, line 1066)\r\nin call from meck_tests:cover_options_fail_/1 (test/meck_tests.erl, line 1064)\r\n**error:{assertEqual,[{module,meck_tests},\r\n              {line,1066},\r\n              {expression,\"proplists : delete ( outdir , lists : sort ( meck_code : compile_options ( Module ) ) )\"},\r\n              {expected,[debug_info,{i,\"../test/include\"},{d,'TEST',true}]},\r\n              {value,[debug_info,{d,'TEST',true}]}]}\r\n  output:<<\"\">>\r\n```\r\n\r\nSigned-off-by: Peter Lemenkov <lemenkov@gmail.com>"},"comment":{"url":"https://api.github.com/repos/eproxus/meck/issues/comments/422029251","html_url":"https://github.com/eproxus/meck/pull/195#issuecomment-422029251","issue_url":"https://api.github.com/repos/eproxus/meck/issues/195","id":422029251,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjAyOTI1MQ==","user":{"login":"lemenkov","id":41835,"node_id":"MDQ6VXNlcjQxODM1","avatar_url":"https://avatars1.githubusercontent.com/u/41835?v=4","gravatar_id":"","url":"https://api.github.com/users/lemenkov","html_url":"https://github.com/lemenkov","followers_url":"https://api.github.com/users/lemenkov/followers","following_url":"https://api.github.com/users/lemenkov/following{/other_user}","gists_url":"https://api.github.com/users/lemenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/lemenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemenkov/subscriptions","organizations_url":"https://api.github.com/users/lemenkov/orgs","repos_url":"https://api.github.com/users/lemenkov/repos","events_url":"https://api.github.com/users/lemenkov/events{/privacy}","received_events_url":"https://api.github.com/users/lemenkov/received_events","type":"User","site_admin":false},"created_at":"2018-09-17T14:02:52Z","updated_at":"2018-09-17T14:02:52Z","author_association":"CONTRIBUTOR","body":"@eproxus I have them just by running meck tests.  100% reproducible.\r\n\r\nHere is the last attempt to build it w/o this patch:\r\n\r\n* https://koji.fedoraproject.org/koji/taskinfo?taskID=29496273\r\n\r\nFor example a test run on x86_64:\r\n\r\n* https://kojipkgs.fedoraproject.org//work/tasks/6277/29496277/build.log"}}
{"actor":{"display_login":"lemenkov"}}