aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
AgeCommit message (Collapse)Author
2017-04-21Implement Xoroshiro116+ and improve statisticalsRaimo Niskanen
Implement Xoroshiro116+ as 'exrop' with fixes. Deprecate all old algorithms but reincarnate 'exs1024' as 'exs1024s' and 'exsplus' as 'exsp' with fixes. Fixes: * Avoid skew for uniform integers caused by using a simple 'rem' operation for range confinement. Correctness requires retry with new random value for an unfortunate first value. * Implement a correct algorithm that collects enough random bits for ranges larger than the generator's precision. * Fix uniform density for floats by acquiring 53 bits then multiplying with 2.0^(-53) which produces floats on the form N * 2.0^(-53).
2017-04-04Merge branch 'g-andrade/strong-random-numbers/PR-1367/OTP-14317'Raimo Niskanen
* g-andrade/strong-random-numbers/PR-1367/OTP-14317: Clean up documentation and test cases Attempt faster approach to strong random floats Allow for crypto upgrades when using rand plugin fixup! Support cryptographically strong rand plugin fixup! Support cryptographically strong rand plugin fixup! Support cryptographically strong rand plugin fixup! Support cryptographically strong rand plugin No longer expose strong_rand_(range|float) Support cryptographically strong rand plugin Restyle crypto strong numeric generators for usage in rand Support generation of strong random numbers
2017-04-04Clean up documentation and test casesRaimo Niskanen
2017-03-24Fix double hit bug of select/3 with bound keySverker Eriksson
2017-03-22Add more complete key-safety checkSverker Eriksson
2017-03-22Reject unsafe matchspecs on ets:select_replace/2Guilherme Andrade
Preemptively fail operation with badarg if the replacement object might have a different key.
2017-03-22Disable ets:select_replace/2 for bagsGuilherme Andrade
The existing implementation presented both semantic inconsistencies and performance issues.
2017-03-22Add unit tests for ets:select_replace/2Guilherme Andrade
2017-03-22Merge branch 'sverker/ets-table-identifiers/OTP-14094'Sverker Eriksson
* sverker/ets-table-identifiers: observer: Polish crashdump viewer for ETS observer: Polish Table Viewer tab stdlib: Remove ets_SUITE:memory_check_summary erts: Improve reduction count during table cleanup erts: Cleanup table status bits erts: Remove now redundant 'id' from DbTableCommon erts: Remove meta_main_tab erts: Pass tid argument down to trapping functions erts: Print table id as ref in crashdump and break menu erts: Replace meta_pid_to{_fixed}_tab with linked lists erts: Correct erl_rbtree comments about yielding erts: Add ERTS_RBT_YIELD_STAT_INIT to erl_rbtree Fix node_container_SUITE list_to_ref/1 Implement ets:all() using scheduler specific data Rename fixation count in ets table to avoid confusion Introduce references as table identifiers
2017-03-22stdlib: Remove ets_SUITE:memory_check_summarySverker Eriksson
and let each test case fail, like it was before. Seems growing/shrinking meta tables was causing the sporadic failed memory checks.
2017-03-22erts: Replace meta_pid_to{_fixed}_tab with linked listsSverker Eriksson
from process psd through all owned/fixed tables. As meta_pid_to{_fixed}_tab maps to slot in meta_main_tab which is planned for destruction. In this commit we no longer seize table lock while freeing the table (free_table_cont) as it's not needed and makes the code a bit simpler. Any concurrent operation on the table will only access lock, owner and status and then bail out.
2017-03-21Merge branch 'ingela/corrct-otp-internal'Ingela Anderton Andin
* ingela/corrct-otp-internal: ssl, public_key, crypto: Change deprecated to removed
2017-03-20ssl, public_key, crypto: Change deprecated to removedIngela Anderton Andin
2017-03-16Don't allow module names with non-latin1 charactersBjörn Gustavsson
In OTP 20, all Unicode characters are allowed in atoms. However, we have decided that we will not allow non-latin1 characters in module names in OTP 20. This restriction may be lifted in a future major release of OTP. Enforce the restriction in erl_lint, so that it will be a compilation error to have a module name containing non-latin1 characters. That means that tools such as debugger, xref, dialyzer, syntax_tools, and so on, do not have to be modified to handle non-latin1 module names.
2017-03-15Merge branch 'bjorn/stdlib/erl_tar'Björn Gustavsson
* bjorn/stdlib/erl_tar: erl_tar: Close files after reading from a tar file
2017-03-10erl_tar: Close files after reading from a tar fileBjörn Gustavsson
Also let the test suite verify that all files that are opened will be closed before the end of each test case. aa0c4b0df7cdc7 introduced the file descriptor leak.
2017-03-08stdlib: Fix handling of locations and annotationsHans Bolinder
2017-03-03Merge branch 'maint'Raimo Niskanen
2017-03-03Merge branch 'raimo/kernel/gen_statem-progress/OTP-14114' into maintRaimo Niskanen
* raimo/kernel/gen_statem-progress/OTP-14114: Make code_change/4 optional Implement fallback for terminate/3 Clarify code_change and callback mode change Stop pampering with stacktraces Clean up timer handling Remove event timer optimization Clean up timer handling Reduce number of loop variables hence code mass Optimize by using async cancel_timer Bugfix: callback mode not cached after code change Implement repeat_state and repeat_state_and_data Correct type checking function for action {next_event,,} Change arity of type to init_result/1
2017-03-02Implement ets:all() using scheduler specific dataRickard Green
2017-03-01Merge branch 'maint'Björn Gustavsson
* maint: zip: Eliminate leak of open file after crash zip: Don't crash when a zip file has an Unix extra header
2017-03-01Merge pull request #1358 from bjorng/bjorn/stdlib/fix-zip-bugs/OTP-14189Björn Gustavsson
zip: Fix bugs ERL-348 and ERL-349 OTP-14246
2017-02-28Merge branch 'maint'Hans Bolinder
* maint: stdlib: Add maps to term traversal
2017-02-28zip: Eliminate leak of open file after crashBjörn Gustavsson
Make sure that zip:extract() and zip:create() closes the zip file if there is an error. ERL-349
2017-02-27stdlib: Add maps to term traversalHans Bolinder
2017-02-24Merge branch 'maint'Björn Gustavsson
* maint: filename: Add safe_relative_path/1 Conflicts: lib/stdlib/src/filename.erl
2017-02-24Merge pull request #1350 from bjorng/bjorn/stdlib/safe-relative-path/OTP-14215Björn Gustavsson
filename: Add safe_relative_path/1 OTP-14215
2017-02-22stdlib: Simplify error handling of the sofs moduleHans Bolinder
Atoms ('badarg', 'type_mismatch', &c) are used as errors instead of tuples containing the parameters. This makes it possible for the garbage collector to reclaim memory earlier. Since the exact format of error tuples is undocumented no release note is deemed necessary.
2017-02-22Merge branch 'maint'Hans Bolinder
* maint: [xmerl] Remove faulty throws [xmerl] Fix XML "well-formedness" bug i SAX parser [xmerl] Correct bug handling multiple documents on a stream stdlib: Improve pretty-printing of terms with maps Conflicts: lib/stdlib/test/io_SUITE.erl
2017-02-21stdlib: Improve pretty-printing of terms with mapsHans Bolinder
As of committing this branch maps:fold/3 calls maps:to_list/1, which means that the time and memory needed for printing maps is not always proportional to the size of the generated deep list of characters.
2017-02-21filename: Add safe_relative_path/1Björn Gustavsson
Add safe_relative_path/1 to guard against directory traversal attacks. It either returns a shorter path without any ".." or "." components, or 'unsafe' if an ".." component would climb up above the root of the relative path. Here are a few examples: safe_relative_path("a/b/..") => "a" safe_relative_path("a/..") => "" safe_relative_path("a/../..") => unsafe safe_relative_path("/absolute/path") => unsafe The returned path can be used directly or combined with an absolute path using filename:join/2.
2017-02-16Merge pull request #1323 from bitwalker/erl_tar2Björn Gustavsson
Update erl_tar to support PAX format (redux) OTP-14226
2017-02-16Update erl_tar to support PAX format, etc.Paul Schoenfelder
This commit introduces the following key changes: - Support for reading tar archives in formats currently in common use, such as v7, STAR, USTAR, PAX, and GNU tar's extensions to the STAR/USTAR format. - Support for writing PAX archives, only when necessary, using USTAR when possible for greater portability. These changes result in lifting of some prior restrictions: - Support for reading archives produced by modern tar implementations when other restrictions described below are present. - Support for filenames which exceed 100 bytes in length, or paths which exceed 255 bytes (see USTAR format specification for more details on this restriction). - Support for filenames of arbitrary length - Support for unicode metadata (the previous behaviour of erl_tar was actually violating the spec, by writing unicode-encoded data to fields which are defined to be 7-bit ASCII, even though this technically worked when using erl_tar at source and destination, it may not have worked with other tar utilities, and this implementation now conforms to the spec). - Support for uid/gid values which cannot be converted to octal integers.
2017-02-15Merge pull request #1321 from bjorng/bjorn/stdlib/tilde-s-for-atomsBjörn Gustavsson
Make "~s" fail for Unicode atoms
2017-02-14Fixed typos in lib/stdlibAndrew Dryga
2017-02-13Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: ets_tough_SUITE: Add the gen_server behavior ets_tough_SUITE: Remove functions that are never called ets_SUITE: Eliminate internal exports used for spawn/apply lists_SUITE: Run the droplast/1 test case random_{iolist,unicode_list}: Remove unused functions stdlib test: Eliminate export_all from re_SUITE and friends asn1_SUITE: Make sure that there are no unused functions Simplify running of asn1 app tests asn1_SUITE: Remove unused functions
2017-02-10ets_tough_SUITE: Add the gen_server behaviorBjörn Gustavsson
Add a declaration to make it clear for tools that this module uses the gen_server behavior. While at it, also remove the totally unnecessary 'export_all' option.
2017-02-10ets_tough_SUITE: Remove functions that are never calledBjörn Gustavsson
2017-02-10ets_SUITE: Eliminate internal exports used for spawn/applyBjörn Gustavsson
In the future we will run xref to make sure that all functions that are exported are also used. Having internal exports only used for spawning or applying will mess with that.
2017-02-10lists_SUITE: Run the droplast/1 test caseBjörn Gustavsson
The testcase was never actually run.
2017-02-10random_{iolist,unicode_list}: Remove unused functionsBjörn Gustavsson
2017-02-10stdlib test: Eliminate export_all from re_SUITE and friendsBjörn Gustavsson
There is no actual need to use export_all, since very few functions are actually called from the outside. While we are it, remove the unused functions in run_pcre_tests.erl.
2017-02-09Merge branch 'maint'Hans Bolinder
* maint: stdlib: Improve Erlang shell's tab-completion of long names
2017-02-09Merge pull request #1312 from richcarl/shell-smart-compileBjörn Gustavsson
Extend shell c(...) to find and recompile modules OTP-14190
2017-02-08stdlib: Improve Erlang shell's tab-completion of long namesHans Bolinder
2017-02-06Use magic refs for compiled match specsRickard Green
2017-02-06Add shell shortcut for recompiling existing modulesRichard Carlsson
This extends the shell function c/1 and c/2 so that if the argument is a module name instead of a file name, it automatically locates the .beam file and the corresponding source file, and then recompiles the module using the same compiler options (plus any options passed to c/2). If compilation fails, the old beam file is preserved. Also adds c(Mod, Opts, Filter), where the Filter argument allows you to remove old compiler options before the new options are added.
2017-02-04Add filelib:find_file/2/3 and filelib:find_source/1/2/3Richard Carlsson
This moves, extends and exports functionality that previously existed only internally in filename:find_src/1/2, adding the ability to automatically substitute file suffixes and use different rules for different suffixes.
2017-02-04Fix broken test for filename:find_src/2Richard Carlsson
2017-02-02Make "~s" fail for Unicode atomsBjörn Gustavsson
26b59dfe67e introduced support for arbitrary Unicode characters in atoms. After that commit, it is possible to print any atom with a "~s" format string: 1> io:format("~s\n", ['спутник']). спутник Note that the same text as a string will fail: 2> io:format("~s\n", ["спутник"]). ** exception error: bad argument in function io:format/3 called as io:format(<0.53.0>,"~s\n", [[1089,1087,1091,1090,1085,1080,1082]]) Being more permissive for atoms is probably beneficial for io:format/2. However, for io_lib:format/2, the new behavior breaks this guarantee in the documentation for io_lib:format/2: If and only if the Unicode translation modifier is used in the format string (that is, ~ts or ~tc), the resulting list can contain characters beyond the ISO Latin-1 character range (that is, numbers > 255). The problem is that you can no longer be sure whether io_lib:format/2 will return an iolist that can be successfully passed to a port or iolist_to_binary/1. We see three solutions: 1. Keep the new behavior. That means that you can get non-iolist data when you use ~s for printing an atom, but a 'badarg' when printing Unicode strings. That is inconsistent, and it delays error detection if the result is passed to a port or iolist_to_binary/1. 2. Always allow Unicode characters for ~s. That would be incompatible, because ~s says that any binary is encoded in latin1, while ~ts says that any binary is encoded in UTF-8. To implement this solution, we could no longer support latin1 binaries; all binaries would have to be encoded in UTF-8. 3. Only allow ~s for atoms where all characters are less than 256. Require ~ts to print atoms such as 'спутник'. We reject solution 1 because it is slightly incompatible and is inconsistent. We reject solution 2 because it too incompatible. Therefore, this commit implements solution 3.