aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/Makefile
AgeCommit message (Collapse)Author
2017-03-21compiler tests: Eliminate creation of untracked filesBjörn Gustavsson
Two dummy .erl files are created while releasing the tests for the compiler. Remove the files after they have been copied to the release directory to avoid that they show up as untracked files in the output of "git status".
2016-11-18Add test using LFE-generated Core Erlang modulesBjörn Gustavsson
Ensure that correct (not necessarily optimal) code is generated for Core Erlang code not originating from v3_core.
2016-11-18Remove beam_boolBjörn Gustavsson
The guard optimizations in v3_kernel has removed the need for beam_bool.
2016-09-02Fix overridden BIFsBjörn Gustavsson
The filters in a list comprehension can be guard expressions or an ordinary expressions. If a guard expression is used as a filter, an exception will basically mean the same as 'false': t() -> L = [{some_tag,42},an_atom], [X || X <- L, element(1, X) =:= some_tag] %% Returns [{some_tag,42}] On the other hand, if an ordinary expression is used as a filter, there will be an exception: my_element(N, T) -> element(N, T). t() -> L = [{some_tag,42},an_atom], [X || X <- L, my_element(1, X) =:= some_tag] %% Causes a 'badarg' exception when element(1, an_atom) is evaluated It has been allowed for several releases to override a BIF with a local function. Thus, if we define a function called element/2, it will be called instead of the BIF element/2 within the module. We must use the "erlang:" prefix to call the BIF. Therefore, the following code is expected to work the same way as in our second example above: -compile({no_auto_import,[element/2]}). element(N, T) -> erlang:element(N, T). t() -> L = [{some_tag,42},an_atom], [X || X <- L, element(1, X) =:= some_tag]. %% Causes a 'badarg' exception when element(1, an_atom) is evaluated But the compiler refuses to compile the code with the following diagnostic: call to local/imported function element/2 is illegal in guard
2016-06-29compiler: Eliminate num_bif_SUITEBjörn Gustavsson
num_bif_SUITE.erl was originally copied from the emulator test suite. It does not test much of the compiler. Therefore, remove num_bif_SUITE. Add a new test to bif_SUITE to test trunc/1 and round/1 in contexts that could be tricky for the compiler to handle correctly. Note that there is no need to test abs/1 in bif_SUITE, since it is tested in many other places (e.g. in guard_SUITE).
2016-05-30beam_validator: Add is_bitstring/1 as a safe BIFBjörn Gustavsson
beam_validator wrongly complained that the following was not safe because it didn't know that is_bitstring/1 is safe: food(Curriculum) -> [try is_bitstring(functions) catch _ -> 0 end, Curriculum]. While we are it, also add a new bif_SUITE test suite to cover some more code in beam_validator.
2016-05-25beam_jump: Clean up handling of labels before func_infoBjörn Gustavsson
In complicated code with many indirect jumps to the func_info label, a label could get lost.
2016-05-16Add beam_bool_SUITEBjörn Gustavsson
It's time that we have a dedicated test suite for beam_bool.
2016-03-10beam_block: Eliminate unsafe optimizationBjörn Gustavsson
Consider this code: %% Start of block get_tuple_element Tuple 0 Element get_map_elements Fail Map [Key => Dest] . . . move Element UltimateDest %% End of block Fail: %% Code that uses Element. beam_block (more precisely, otp_tuple_element/1) would incorrectly transform the code to this: %% Start of block get_map_elements Fail Map [Key => Dest] . . . get_tuple_element Tuple 0 UltimateDest %% End of block Fail: %% Code that uses Element. That is, the code at label Fail would use register Element, which is either uninitalized or contains the wrong value. We could fix this problem by always keeping label information at hand when optimizing blocks so that we could check the code at the failure label for get_map_elements. That would require changes to beam_block and beam_utils. We might consider doing that in the future if it turns out be worth it. For now, I have decided that I want to keep the simplicity of blocks (allowing them to be optimized without keeping label information). That could be achieved by not including get_map_elements in blocks. Another way, which I have chosen, is to only allow get_map_elements as the first instruction in the block. For background on the bug: c288ab8 introduced the beam_reorder pass and 5f431276 introduced opt_tuple_element() in beam_block.
2016-02-17Makefiles: Remove test_server from include path and code pathBjörn Gustavsson
Since no test suites includede test_server.hrl, there is no need to have test_server in the include path or code path.
2015-10-05beam_reorder: Eliminate compiler crashBjörn Gustavsson
c288ab87 added beam_reorder to move get_tuple_element instructions. Compiling code such as the following would crash the compiler: alloc(_U1, _U2, R) -> V = R#alloc.version, Res = id(V), _ = id(0), Res. The crash would occur because the following two instructions: {get_tuple_element,{x,2},1,{x,1}}. {allocate_zero,1,2}. were swapped and rewritten to: {allocate_zero,1,1}. {get_tuple_element,{x,2},1,{x,1}}. That transformation is not safe because the allocate_zero instruction would kill {x,2}, which is the register that is holding the reference to the tuple. Only do the transformation when the tuple reference is in an x register with a lower number than the destination register.
2015-09-28beam_type: Improve optimization by keeping track of integersBjörn Gustavsson
The ASN.1 compiler often generates code similar to: f(<<0:1,...>>) -> ...; f(<<1:1,...>>) -> .... Internally that will be rewritten to (conceptually): f(<<B:1,Tail/binary>>) -> case B of 0 -> case Tail of ... end; 1 -> case Tail of ... end; _ -> error(case_clause) end. Since B comes from a bit field of one bit, we know that the only possible values are 0 and 1. Therefore the error clause can be eliminated like this: f(<<B:1,Tail/binary>>) -> case B of 0 -> case Tail of ... end; _ -> case Tail of ... end end. Similarly, we can also a deduce the range for an integer from a 'band' operation with a literal integer. While we are at it, also add a test case to improve the coverage.
2015-06-17compiler: Add regressions_SUITEBjörn-Egil Dahlberg
regressions_SUITE will have code snippets which previously crashed the compiler. This commits includes a test for Maps crash in beam_bool.
2015-04-22Add z_SUITE to validate loaded codeBjörn Gustavsson
If we want to have test cases that run eprof, we must make sure that there are no modules loaded that don't have a working module_info/1 function, since eprof calls module_info(functions) to retrieve the list of functions in the module. Some test cases load modules compiled from Core Erlang that don't have any module_info/1 functions, so we will need make sure that all such modules have been unloaded. Add z_SUITE:loaded/1 to run after all other test cases to verify that all modules that the code server consider loaded are indeed loaded and all have working module_info/0,1 functions.
2015-04-22test suite: Always place .core files in data directoriesBjörn Gustavsson
For tidiness, always place .core files in data directories.
2015-01-21Add beam_utils_SUITE to cover more lines in beam_utilsBjörn Gustavsson
2014-08-07Use +clint0 in compiler's test suitesAnthony Ramine
2014-02-21compiler: Fix map inliningBjörn-Egil Dahlberg
Added coverage of operating map variable.
2014-02-07erts,compiler: Correct and amend tests for MapsBjörn-Egil Dahlberg
Faulty test for maps update
2014-01-31compiler: Strengthen Maps testsBjörn-Egil Dahlberg
2013-02-04Add two tests for unused multiple values in effect contextAnthony Ramine
2013-01-18Remove support for parameterized modulesBjörn Gustavsson
2012-10-23Correct typo in test suite nameBjörn Gustavsson
It should be beam_except_SUITE, since it tests the beam_except module (introduced in 726f6e4c7afe8ce37b30eedbebe583e7b9bfc51b).
2012-06-05Update to work with whitespace in exec pathLukas Larsson
OTP-10106 OTP-10107
2012-01-04Remove part_eval_SUITEBjörn Gustavsson
This test suite has been superseded by other test suites (e.g. guard_SUITE). Removing it does not decrease the coverage.
2012-01-04Add the beam_except pass to optimize exceptionsBjörn Gustavsson
In order to save space, rewrite suitable calls to erlang:error/{1,2} to special BEAM instructions. This code is probably longer than the code taken out of v3_life and v3_codegen in the previous commit, but it is much easier to understand and maintain since the BEAM assembler format is better understood than the v3_life format.
2011-09-21beam_disasm: Handle stripped BEAM filesHaitao Li
beam_disasm:file/1 would crash if asked to disassemble a stripped BEAM file without an "Attr" chunk.
2011-03-30Merge branch 'hw/call-chmod-without-f' into devHenrik Nord
* hw/call-chmod-without-f: Call chmod without the "-f" flag Conflicts: erts/emulator/test/Makefile lib/asn1/test/Makefile lib/crypto/test/Makefile lib/debugger/test/Makefile lib/docbuilder/test/Makefile lib/edoc/test/Makefile lib/erl_interface/test/Makefile lib/inviso/test/Makefile lib/parsetools/test/Makefile lib/percept/test/Makefile lib/ssl/test/Makefile lib/syntax_tools/test/Makefile lib/test_server/test/Makefile lib/tools/test/Makefile OTP-9170
2011-02-17Update all test specsLukas Larsson
2010-11-15Call chmod without the "-f" flagHolger Weiß
"-f" is a non-standard chmod option which at least SGI IRIX and HP UX do not support. As the only effect of the "-f" flag is to suppress warning messages, it can be safely omitted.
2010-03-26compiler tests: Compile a few more modules with 'inline'Björn Gustavsson
Since a function_clause exception in an inlined function will be changed to a case_clause exception, we must test for both.
2010-03-26compiler tests: Test the 'inline' option betterBjörn Gustavsson
Clone some test suites and compile them with the 'inline' option to test inlining more thorughly.
2010-03-22compiler: Don't support the r11 optionBjörn Gustavsson
The r11 option was used to generate BEAM modules that could loaded both on both R11 and R12/R13 to facilitate testing that R11 and R13 nodes could communicate with each other. Since R14 is only required to be compatible with R12 and R13 nodes, the r11 option is no longer needed.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP