-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
khepri_fun: Work around Rebar's use of cth_readable
parse_transform
#176
khepri_fun: Work around Rebar's use of cth_readable
parse_transform
#176
Conversation
Codecov ReportBase: 90.73% // Head: 90.74% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #176 +/- ##
==========================================
+ Coverage 90.73% 90.74% +0.01%
==========================================
Files 19 19
Lines 3388 3427 +39
==========================================
+ Hits 3074 3110 +36
- Misses 314 317 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Thank you @the-mikedavis for the quick review! I can't reproduce the problem outside of |
31f5f81
to
97e5208
Compare
To improve the output of common_test in the terminal, Rebar uses `cth_readable`. This library comes with a parse_transform module to convert all calls to `ct:pal()`. The application modules are thus recompiled on-the-fly (i.e. the result is not written to disk) with this parse_transform. The result is that the module loaded in memory doesn't match the one on disk (different checksums). This causes the following exception while trying to extract a transaction function. Here is an example: {khepri_ex, failed_to_prepare_tx_fun, #{error => {mismatching_module_checksum, #{checksum_from_fun => <<194,208,71,94,61,101,247,31,220,109,126,242,101,120,40,129>>, checksum_on_disk => <<152,39,250,105,94,89,145,46,251,4,237,114,45,132,63,33>>, compile_info_from_fun => [{version, "8.2.1"}, {options, [{d, 'COMMON_TEST'}, {d, 'TEST'}, {i, ".../_build/test/lib/khepri_mnesia_migration/src"}, {i, ".../_build/test/lib/khepri_mnesia_migration/test"}, {i, ".../_build/test/lib/khepri_mnesia_migration/include"}, {i, ".../_build/test/lib/khepri_mnesia_migration"}]}, {source, ".../src/m2k_table_copy.erl"}], compile_info_on_disk => [{version, "8.2.1"}, {options, [debug_info,no_spawn_compiler_process, {d, 'COMMON_TEST'}, warn_export_vars, {d, 'TEST'}, {parse_transform,cth_readable_transform}, {i, ".../_build/test/lib/khepri_mnesia_migration/src"}, {i, ".../_build/test/lib/khepri_mnesia_migration/test"}, {i, ".../_build/test/lib/khepri_mnesia_migration/include"}, {i, ".../_build/test/lib/khepri_mnesia_migration"}]}, {source, ".../src/m2k_table_copy.erl"}], module => m2k_table_copy}}}} The solutions consists in comparing the source filename and compiler options. If both copies are compiled for tests and one of them uses `cth_readable_transform`, we accept the inconsistency and continue. While here, the error returned when modules mismatch was updated to include more details.
…d functions If the processed function calls another function in the same module but we don't extract it, we need to transform this instruction into an external call. Before this fix, the compiler would fail with the following error: {error, [{[], [{none,compile, {crash,beam_asm,function_clause, [{beam_asm,encode_arg, [{SameModule, Function, Arity}, ...
97e5208
to
e0af4b3
Compare
To improve the output of common_test in the terminal, Rebar uses
cth_readable
. This library comes with a parse_transform module to convert all calls toct:pal()
.The application modules are thus recompiled on-the-fly (i.e. the result is not written to disk) with this parse_transform. The result is that the module loaded in memory doesn't match the one on disk (different checksums).
This causes the following exception while trying to extract a transaction function. Here is an example:
The solutions consists in comparing the source filename and compiler options. If both copies are compiled for tests and one of them uses
cth_readable_transform
, we accept the inconsistency and continue.While here, the error returned when modules mismatch was updated to include more details.