aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
AgeCommit message (Collapse)Author
2015-04-30stdlib: Silence some of qlc's warningsHans Bolinder
As long as the Erlang Compiler and qlc do not agree on the location of LC warnings, qlc's own warnings about patterns and filters that always fail have been silenced.
2015-04-30stdlib: Use module erl_annoHans Bolinder
2015-04-30stdlib: Add module erl_annoHans Bolinder
Introduce erl_anno, an abstraction of the second element of tokens and tuples in the abstract format. The convention that negative line numbers can be used for silencing compiler warnings will no longer work in OTP 19; instead the annotation 'generated' is to be used.
2015-04-22supervisor: Correct restart handlingBjörn Gustavsson
fbaa0bec replaced the use of now/0 with erlang:monotonic_time/1 but at the same time introduced a bug in inPeriod/3 so that it would always return 'true' (the subtraction Time - Now would always result in a non-positive number that would always be less than Period). The symptoms of the bug is that when a child has been restarted the maximum number of times allowed, the supervisor will terminate, regardless of how much time that elapses between the restarts. There was no test case that detected this problem. Add the missing test case to ensure that this bug stays killed. Reported-by: Rafał Studnicki
2015-04-16Merge branch 'bjorn/maps'Björn Gustavsson
* bjorn/maps: Document the new {badmap,Term} and {badkey,Key} exceptions Raise more descriptive error messages for failed map operations erl_term.h: Add is_not_map() macro Tigthen code for the i_get_map_elements/3 instruction Pre-compute hash values for the general get_map_elements instruction Teach the loader to pre-compute the hash value for single-key lookups Optimize use of i_get_map_element/4 beam_emu: Slightly optimize update_map_{assoc,exact} v3_codegen: Don't sort map keys in map creation/update beam_validator: No longer require strict literal term order Sort maps keys in the loader De-optimize the has_map_fields instructions erts/map_SUITE.erl: Add a test case that tests has_map_fields Fully evaluate is_map/1 for literals at load-time map_SUITE: Add tests of is_map/1 with literal maps Run a clone of map_SUITE without optimizations Remove the fail label operand of the new_map instruction Correct transformation of put_map_assoc to new_map Remove support for put_map_exact without a source map
2015-04-15Raise more descriptive error messages for failed map operationsBjörn Gustavsson
According to EEP-43 for maps, a 'badmap' exception should be generated when an attempt is made to update non-map term such as: <<>>#{a=>42} That was not implemented in the OTP 17. José Valim suggested that we should take the opportunity to improve the errors coming from map operations: http://erlang.org/pipermail/erlang-questions/2015-February/083588.html This commit implement better errors from map operations similar to his suggestion. When a map update operation (Map#{...}) or a BIF that expects a map is given a non-map term, the exception will be: {badmap,Term} This kind of exception is similar to the {badfun,Term} exception from operations that expect a fun. When a map operation requires a key that is not present in a map, the following exception will be raised: {badkey,Key} José Valim suggested that the exception should be {badkey,Key,Map}. We decided not to do that because the map could potentially be huge and cause problems if the error propagated through links to other processes. For BIFs, it could be argued that the exceptions could be simply 'badmap' and 'badkey', because the bad map and bad key can be found in the argument list for the BIF in the stack backtrace. However, for the map update operation (Map#{...}), the bad map or bad key will not be included in the stack backtrace, so that information must be included in the exception reason itself. For consistency, the BIFs should raise the same exceptions as update operation. If more than one key is missing, it is undefined which of keys that will be reported in the {badkey,Key} exception.
2015-04-13stdlib: Correct maps module exceptions upon errorsBjörn-Egil Dahlberg
Bad input to maps module function will now yield exceptions: * {badmap,NotMap} or, * badarg
2015-04-10Merge branch 'bjorn/stdlib/cuddle-with-tests'Björn Gustavsson
* bjorn/stdlib/cuddle-with-tests: Eliminate deprecated now/0 used as timestamp Eliminate use of now/0 for creating a unique filename Eliminate use of deprecated now/0 for measuring time Eliminate use of deprecated now/0 for random number generation Speed up timer_simple_SUITE:timer_perf/1 Speed up timer_SUITE Optimize gen_server_SUITE:hibernate/1 Optimize gen_event_SUITE:hibernate/1 Optimize gen_fsm_SUITE:hibernate/1 Optimize unicode_SUITE:ex_binaries_errors* test cases Optimize unicode_SUITE:binaries_errors/1 binary_module_SUITE: Remove unnecessary calls to the binref module Optimize binary_module:random_ref_comp/1 Optimize io_proto_SUITE:unicode_options_gen/1
2015-04-10Eliminate deprecated now/0 used as timestampBjörn Gustavsson
Rewrite the code to measure and print elapsed time instead of just printing timestamps for the start and stop of each operation.
2015-04-10Eliminate use of now/0 for creating a unique filenameBjörn Gustavsson
Use erlang:unique_integer/1 instead.
2015-04-10Eliminate use of deprecated now/0 for measuring timeBjörn Gustavsson
Use erlang:monotonic_time/1 instead of now/0.
2015-04-10Eliminate use of deprecated now/0 for random number generationBjörn Gustavsson
Use erlang:timestamp/0 instead now/0 when seeding the random number generator.
2015-04-10Speed up timer_simple_SUITE:timer_perf/1Björn Gustavsson
In big_test/1, there is 9 seconds sleep before spawning any timers. Why? Before the sleep nrev processes are started, but they are likely to finish running before the 9 seconds have elapsed. Since I see no reason at all for the sleep, I will remove it.
2015-04-10Speed up timer_SUITEBjörn Gustavsson
The single test case in timer_SUITE is annoyingly slow. On average, its running time is about 4 minutes (estimated by a back-of-the-envelope calculation). Scale down the delay times in the main loop and the length of timers started. The running average time should now be around 80 seconds.
2015-04-10Optimize gen_server_SUITE:hibernate/1Björn Gustavsson
The running time for gen_server_SUITE:hibernate/1 is about 12 seconds because of 1000 ms sleeps in the test case. Introduce a helper function to avoid sleeping more than necessary. While we are it, also remove all ?line macros in the test case.
2015-04-10Optimize gen_event_SUITE:hibernate/1Björn Gustavsson
The running time for gen_event_SUITE:hibernate/1 is about 20 seconds because of 1000 ms sleeps in the test case. Introduce helper functions to avoid sleeping more than necessary. While we are it, also remove all ?line macros in the test case.
2015-04-10Optimize gen_fsm_SUITE:hibernate/1Björn Gustavsson
The running time for gen_fsm_SUITE:hibernate/1 is almost 30 seconds because of 1000 ms sleeps in the test case. Introduce helper functions to avoid sleeping more than necessary. While we are it, also remove all ?line macros in the test case.
2015-04-10Optimize unicode_SUITE:ex_binaries_errors* test casesBjörn Gustavsson
Refactor the code so that the error test cases for utf16 can share the code for big and little endian. Do the same for utf32. The major optimization is the observation that the following code: byte_size(unicode:characters_to_binary(List, unicode, {utf16,big}) can be replaced with: 2*length(List) which is much faster. (That optimization is not safe in general, but for the lists used in the error tests cases, it is.)
2015-04-10Optimize unicode_SUITE:binaries_errors/1Björn Gustavsson
unicode_SUITE:binaries_errors/1 is the slowest test case in unicode_SUITE. Its running time is about 50 seconds on my computer. Break apart unicode_SUITE:binaries_errors/1 into several test cases that can run in parallel.
2015-04-10binary_module_SUITE: Remove unnecessary calls to the binref moduleBjörn Gustavsson
The compile_pattern/1 function in the binref module is a dummy function. Therefore, calling binref:match/2 once with the plain pattern and once with a "pre-compiled" pattern will take twice as long, but will not help us find more errors. I shaved off one fourth of the running time for random_ref_comp/1 by eliminating the unnecessary calls to the binref module.
2015-04-08Merge branch 'sverk/ets-grow-faulty-assert/OTP-12647'Sverker Eriksson
* sverk/ets-grow-faulty-assert/OTP-12647: erts: Fix ets bug in debug VM
2015-04-08erts: Fix ets bug in debug VMSverker Eriksson
Symptom: ASSERT(segtab[seg_ix] == NULL) in alloc_seg() fails. Remedy: Make sure we set segment pointer to NULL in free_seg() even when we switch to smaller segtab.
2015-04-07Fix a qlc testcaseHans Bolinder
2015-03-26Optimize binary_module:random_ref_comp/1Björn Gustavsson
The most expensive part of random_ref_comp/1 is do_matches_loop_comp/4. The running time was reduced from roughly 80 seconds to roughly 40 seconds on my computer when I modified the caller to pre-compile the pattern.
2015-03-26Optimize io_proto_SUITE:unicode_options_gen/1Björn Gustavsson
The time to run io_proto_SUITE:unicode_options_gen/1 on my computer was about 110 seconds. After modifying the test case so that it does several file operations in parallel the time was reduced to about 60 seconds.
2015-03-19Merge branch 'egil/maps/hamt/OTP-12585'Björn-Egil Dahlberg
* egil/maps/hamt/OTP-12585: (113 commits) erts: Fix bug in ESTACK and WSTACK kernel: Add spec for erts_debug:map_info/1 mnesia: Update mnesia tests to reflect new ETS hash erts: Ensure maps uses _rel functions in halfword erts: Do not treat errors as fatal in erl_printf_term erts: Update preloaded erts_internal.beam erts: Add map decomposition wrappers erts: Ensure halfword has correct temp-heap for maps hipe: Handle separate hashmap tag correctly erts: Fix map bug in dec_term for 32-bit debug VM stdlib: Update qlc tests to reflect new ETS hash stdlib: Remove obsolete hashmap references in io_lib erts: Enhance maps ordering tests hipe: Fix maps sort order testcase erts: Remove unused variable in crashdump creation erts: Fix typo in copy_struct for halfword emulator erts: Restrict GCC intrinsics by compiler version erts: Fix windows bug in hashmap_info erts: Fix typo in make_hash2 for 32-bit arch Fix beam_load assert ... Conflicts: erts/emulator/beam/bif.tab
2015-03-19stdlib: Update qlc tests to reflect new ETS hashBjörn-Egil Dahlberg
2015-03-17Merge branch 'danielwhite/zip-port-leak-fix'Zandra Hird
OTP-12566 * danielwhite/zip-port-leak-fix: Describe zip handles an opaque type Document the termination semantics of a zip handle Prevent zip:zip_open/1,2 from leaking ports
2015-03-16Merge branch 'nox/ets-update_counter-4'Zandra Hird
* nox/ets-update_counter-4: Create new BIF ets:update_counter/4 Allow 4-ary BIFs OTP-12563
2015-03-12Merge branch 'nox/maps-match_specs-fixes/OTP-12270'Björn-Egil Dahlberg
* nox/maps-match_specs-fixes/OTP-12270: erts: Strengthen maps match spec compilation tests Properly collect variables in match specs with maps Fix compilation of match specs with maps
2015-03-12Create new BIF ets:update_counter/4Anthony Ramine
Conflicts: erts/emulator/beam/bif.tab lib/stdlib/src/ets.erl
2015-03-11Properly collect variables in match specs with mapsAnthony Ramine
2015-03-10Make the scanned form of the io_lib format strings available for processingRichard Carlsson
This adds three new functions to io_lib - scan_format/2, unscan_format/1, and build_text/1 - which expose the parsed form of the format control sequences to make it possible to easily modify or filter the input to io_lib:format/2. This can e.g. be used in order to replace unbounded-size control sequences like ~w or ~p with corresponding depth-limited ~W and ~P before doing the actual formatting.
2015-02-25Merge branch 'nox/stdlib/erl_lint-maps/OTP-12515'Björn Gustavsson
* nox/stdlib/erl_lint-maps/OTP-12515: Properly lint map expressions in erl_lint
2015-02-18Merge branch 'bjorn/stdlib/string-tokens/OTP-12422'Björn Gustavsson
* bjorn/stdlib/string-tokens/OTP-12422: Optimize string:tokens/2 Modernize and strengthen the test case for string:tokens/2
2015-02-16Properly lint map expressions in erl_lintAnthony Ramine
The returned variable table when linting a map expression shouldn't include variables that didn't appear in the expression. Reported-By: Alexei Sholik
2015-02-16Modernize and strengthen the test case for string:tokens/2Björn Gustavsson
2015-01-28[ct] Improve support for upgrade test of applicationSiri Hansen
Add functions: ct_release_test:get_app_vsns/2 ct_release_test:get_appup/2 This implies a change in callback functions for ct_release_test, which now all have two arguments - [CtData,State]. The new CtData is an opaque data structure which must be given as the first argument to the two new functions.
2015-01-17Prevent zip:zip_open/1,2 from leaking portsDaniel White
The case was discovered where a parent process would exit before closing the zip file. The result was that a port would be left open indefinitely, as the small zip server would not detect this condition. By comparison, the file module will close the associated port when the parent exits for any reason. This change would make the zip module more consistent with the semantics of similar modules. This change is breaking for any callers expecting to pass the handle to another process for processing (assuming it exits).
2014-12-29Merge branch 'lemenkov/use_os_getenv_2'Marcus Arendt
* lemenkov/use_os_getenv_2: fix missing include Start using os:getenv/2 fun Introduce os:getenv/2
2014-12-16Merge branch 'sverk/ets-take-2/OTP-12309'Sverker Eriksson
* sverk/ets-take-2/OTP-12309: erts: Optimize ets:lookup and ets:take for bags Implement ets:take/2
2014-12-15Start using os:getenv/2 funPeter Lemenkov
See #535 Signed-off-by: Peter Lemenkov <[email protected]>
2014-11-26Merge branch 'maint'Dan Gudmundsson
2014-11-26Merge branch 'dgud/testcasecuddling' into maintDan Gudmundsson
* dgud/testcasecuddling: stdlib: Fix timing issue in testcase
2014-11-20Merge branch 'maint'Henrik Nord
2014-11-20Merge branch 'legoscia/io-message-queue-optimisation' into maintHenrik Nord
* legoscia/io-message-queue-optimisation: Optimise io requests for long message queues
2014-11-20stdlib: remove the last traces of Mnemosyne RulesHans Bolinder
Robert has OK'ed the removal of the token ':-'.
2014-11-18Merge branch 'maint'Hans Nilsson
2014-11-18erl_tar: Extend api to define own storage media access functions.Hans Nilsson
The reason for this is a requirement on enabling ssh_sftp to write a tar file on the server. This new api function is used by ssh_sftp:open_tar/3,4.
2014-11-17Merge branch 'maint'Björn Gustavsson
* maint: Fix miscompilation when module contains multiple named funs Fix locations of shadowing warnings in ms_transform