aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
AgeCommit message (Collapse)Author
2010-04-20Add testcase for infinite loop problem caused by reset of match_call_countPatrik Nyblom
2010-04-19OTP-8567 The word 'spec' is no longer reserved.Hans Bolinder
The function erl_scan:reserved_word/1 no longer returns true when given the word spec. This bug was introduced in STDLIB-1.15.3 (R12B-3).
2010-04-14re_SUITE: Add pcre_compile_workspace_overflow/1Björn Gustavsson
2010-04-09OTP-8562 Closing right parenthesis in macro definitions is mandatory.Hans Bolinder
When defining macros the closing right parenthesis before the dot is now mandatory.
2010-03-17OTP-8522 Avoid duplicated 'undefined' in record field typesHans Bolinder
The Erlang parser no longer duplicates the singleton type undefined in the type of record fields without initial value.
2010-03-16Add functions to create and extract escriptsHåkan Mattsson
Both reltool and rebar needs to parse escripts. They are currently using an undocumented function called escript:foldl/3. It folds a function over all files in the body of an escript. If the body contains source code the function compiles it and the gives debug compiled beam code to the fold fun. If the body is an archive the fun is applied for all files in the archive. Instead of making the undocumented function public, the new functions escript:create/2 and escript:extract/2 has been introduced. Together with the new zip:foldl/3 function they have the same functionality as escript:foldl/3 in a more flexible and generic way. escript:foldl/3 should be removed as soon as reltool and rebar has been adopted to use the new functions. The simplest way for reltool and rebar to do this is to just copy the code from escript_SUITE:escript_foldl/3, which happens to provide a future compatible implementation of an emulated escript:foldl/3 function. I was quite hesitant when I introduced the compile_source option. It feels that it does not belong there but the alternative felt worse. The rationale for the compile_source option is that it is a bit cumbersome to compile the source code, as the source in most cases is partial. In order to do compile the source you need to know about some internals in escript. Without compile_source I think that these internals should be documented. Further you need to duplicate parts of the code. Without the compile_source option you need to first parse the source to forms, using an undocumented function in epp with an extended format of predefined macros which also is undocumented. Then you need to investigate the forms to see if you need to add an export form for main. When that is done you can run the rest of the compiler passes as usual. It is not so much code (60 lines or so) to write, but I do not want to urge people to write it. I actually wrote the code (see escript_SUITE:escript_foldl/3) before I decided to introduce the compile_source option.
2010-03-16Add function zip:foldl/3 to iterate over zip archivesHåkan Mattsson
This is the public interface of prim_zip:open/3, which has been used in earlier releases by both erl_prim_loader and escript. The new function can be used as a replacement for the undocumented function escript:foldl/3 that is likely to be removed without further notice. The error handling of prim_zip:open/3 (and prim_zip:foldl/3) has been improved in order to better suite a public interface. For example it could happen that a file or a zlib port could be left open in some errors cases. The documentation of the FileSpec parameter to zip:create/3 has been updated to show that file info can be explicitly specified. A FileSpec may contain {Filename, binary(), #file_info{}} elements. The function zip:create/3 was already prepared to partly support this, but now after a few minor fixes it is fully supported.
2010-03-15Update copyright headersBjörn Gustavsson
2010-03-09OTP-8503 stdlib: records with no fields is considered typed by eppHans Bolinder
The empty record (no fields) is now considered typed. It is more consistent than before; the base case is the logical one. A record is typed iff all its fields are typed. A record is tagged 'typed' iff it is typed.
2010-03-02OTP-8473 stdlib: erl_pp bugfix abstract type 'fun'Hans Bolinder
The abstract type 'fun' could not be printed. This bug has been fixed.
2010-03-02OTP-8470 stdlib: epp bugHans Bolinder
The Erlang code preprocessor (epp) sent extra messages on the form {eof,Location} to the client when parsing the file attribute. This bug, introduced in R11B, has been fixed.
2010-02-12Merge branch 'ms/pcre-security' into ccase/r13b04_devErlang/OTP
* ms/pcre-security: Fix CVE-2008-2371 (outer level option with alternatives caused crash). OTP-8438 The re module: A regular expression with an option change at the start of a pattern that had top-level alternatives could cause overwriting and/or a crash. (Thanks to Michael Santos.)
2010-02-12Merge branch 'jn/supervisor_child_count_only' into ccase/r13b04_devErlang/OTP
* jn/supervisor_child_count_only: Add count_children/1 to supervisor.erl to determine the number of OTP-8436 Added supervisor:count_children/1 to count the number of children being managed without the memory impact of which_children/1. (Thanks to Jay Nelson.)
2010-02-11Fix CVE-2008-2371 (outer level option with alternatives caused crash).Michael Santos
The patch is from: http://vcs.pcre.org/viewvc?revision=360&view=revision Test case: re:compile(<<"(?i)[\xc3\xa9\xc3\xbd]|[\xc3\xa9\xc3\xbdA]">>, [unicode]). An option change at the start of a pattern that had top-level alternatives could cause overwriting and/or a crash. This potential security problem was recorded as CVE-2008-2371.
2010-02-10Add count_children/1 to supervisor.erl to determine the number ofJay Nelson
children being managed without the memory impact of which_children/1 The function which_children/1 returns a list of the child processes currently being supervised, but it has the penalty of creating a new list thereby consuming more memory. In low memory situations it is often desirable to know which supervisor may have generated many processes, but the act of discovering the culprit should not cause the node to crash (or worse a different node if the kernel kills one randomly). The new function count_children/1 can give an indication of which supervisor is taxing resources the most without adding to the burden. Rather than creating a new list, it walks the supervisor's internal children structure using an accumulator function so that any used memory can be incrementally collected yet the resulting count can still be obtained. The return result of count_children/1 is a property list of counts containing: - {specs, Total_Num_Child_Specs} - {active, Num_Active_Child_Processes_Of_Supervisor_Or_Worker_Type} - {supervisors, Num_Supervisor_Type_Children_Including_Dead_Processes} - {workers, Num_Worker_Type_Children_Including_Dead_Processes} This patch was made in response to mailing list discussions of the problem diagnosing heavily taxed production systems. I cannot find the original request, but http://www.erlang.org/cgi-bin/ezmlm-cgi/4/35060 is my original post of the patch.
2010-02-10OTP-8418 user.erl (used in oldshell) is updated to handle unicode inPatrik Nyblom
prompt strings (io:get_line/{1,2}). io_lib is also updated to format prompts with the 't' modifier (i.e. ~ts instead of ~s).
2010-02-10Merge branch 'ks/erl_lint' into ccase/r13b04_devErlang/OTP
* ks/erl_lint: erl_lint_SUITE: adjust failing test case Allow recursive types and check for undefined types OTP-8421: ks/erl_lint
2010-02-09erl_lint_SUITE: adjust failing test caseBjörn Gustavsson
Errors are now reported slightly differently, so we'll need to adjust the test case.
2010-02-05OTP-8393 The new function shell:prompt_func/1 and the new applicationHans Bolinder
configuration parameter shell_prompt_func can be used for customizing the Erlang shell prompt.
2010-02-01epp_SUITE: Increase code coverageHans Bolinder
2010-02-01epp: change rules to choose the right version of a macroChristopher Faulet
Now, when we have only the constant definition of a macro (without arguments), we always use it. In all other cases, we try to find the exact matching definition. We throw an error if we don't find it.
2010-02-01epp: Add support of macros overloadingChristopher Faulet
This feature simplifies the definition of macros by avoiding to have a different name for each version (with different arities) of the same macros. New rules: - can have multiple definitions of the same macro with different arities - cannot overload macro with the same arity - the overloading of predefined macros (?MODULE, ?LINE, ...) is forbidden - the directive '-undef' removes all definitions of a macro
2010-02-01Merge branch 'bg/hipe-fixes' into ccase/r13b04_devErlang/OTP
* bg/hipe-fixes: compiler: make ignore_native_errors also handle internal hipe errors re tests: disable native-code compilation for huge modules Teach the compiler the no_native option
2010-01-31Merge branch 'bg/cleanup-tests' into ccase/r13b04_devErlang/OTP
* bg/cleanup-tests: file_SUITE: eliminate a warning for an unused variable kernel tests: modernize guard tests unicode_SUITE: replace deprecated concat_binary/1 with list_to_binary/1 stdlib tests: modernize guard tests Test suites: fix creation of Emakefiles
2010-01-30re tests: disable native-code compilation for huge modulesBjörn Gustavsson
Two generated modules contains too big functions for the native-code compiler to handle (even the BEAM compiler struggles when compiling them).
2010-01-30Update copyright headerBjörn Gustavsson
2010-01-30Merge branch 'ta/ensure_dir_eexist' into ccase/r13b04_devErlang/OTP
* ta/ensure_dir_eexist: filelib_SUITE: strenghten tests of filelib:ensure_dir/1 Don't return a false {error,eexist} in filelib:ensure_dir/1 OTP-8389 Because of a race condition, using filelib:ensure_dir/1 from multiple processes to create the same path or parts of the same directory structure, filelib:ensure_dir/1 could return a meaningless {error,eexist}. That race condition has been eliminated, and {error,eexist} will now be returned only if there exists a regular file, device file, or some other non-directory file with the same name. (Thanks to Tuncer Ayaz.)
2010-01-29unicode_SUITE: replace deprecated concat_binary/1 with list_to_binary/1Björn Gustavsson
2010-01-29stdlib tests: modernize guard testsBjörn Gustavsson
Don't change any guard tests in the id_transform_SUITE module, because it intentionally use the old guard tests to test that id_transform can handle them.
2010-01-29Test suites: fix creation of EmakefilesBjörn Gustavsson
The Emakefiles in some test suite directories are only appended to, never created from scratch, which can cause problems especially when swithching branches in a git repository.
2010-01-27Merge branch 'rb/stdlib_re_unicode_fixes' into ccase/r13b04_devErlang/OTP
* rb/stdlib_re_unicode_fixes: Fix lost unicode option in re:compile() Refactor out repeated block in re module Fix re:replace/4 to handle unicode charlist Replacement argument Fix re:replace/4 to handle unicode charlist RE argument Fix re:replace/4 to handle binary unicode output when nothing replaced OTP-8394 A number of bugs concerning re and unicode are corrected: - re:compile no longer loses unicode option, which also fixes bug in re:split. - re:replace now handles unicode charlist replacement argument - re:replace now handles unicode RE charlist argument correctly - re:replace now handles binary unicode output correctly when nothing is replaced. Most code, testcases and error isolation done by Rory Byrne.
2010-01-27Fix lost unicode option in re:compile()Patrik Nyblom
Noticed-by: Rory Byrne
2010-01-27Fix re:replace/4 to handle unicode charlist Replacement argumentRory Byrne
A bug in re:replace/4 causes a badarg exception to be thrown when the Replacement argument is a charlist containing non-ascii codepoints. The problem is that the code incorrectly assumes that the Replacement text is iodata() and calls iolist_to_binary/1 on it. This patch fixes it to obey the 'unicode' option and handle charlist() Replacement arguments correctly.
2010-01-27Fix re:replace/4 to handle unicode charlist RE argumentPatrik Nyblom
The real problem is in the re:run/3 BIF. Noticed-by: Rory Byrne Tests-by: Rory Byrne
2010-01-27Fix re:replace/4 to handle binary unicode output when nothing replacedRory Byrne
A bug with re:replace/4 causes an exception when: (a) it's given a unicode charlist as input; (b) it's set to {return,binary}; and (c) it finds nothing to replace. The problem is: when re:replace/4 does not find anything to replace in its Subject input, it calls iolist_to_binary on this data. This fails if the original input is a charlist with non-ascii codepoints.
2010-01-27Added a small timeout to take care of race in newshell. Also removed ↵Patrik Nyblom
deletion of files when compiled with debug option. Changed LC_CTYPE for sunos of certain versions.
2010-01-23filelib_SUITE: strenghten tests of filelib:ensure_dir/1Björn Gustavsson
Test that filelib:ensure_dir/1 returns {error,eexist} if there already exists a regular file with the name as a directory that should be created. While at it, slightly strenghten the otp_5960/1 test case by repeating each call to filelib:ensure_dir/1.
2010-01-20Merge branch 'uw/shell-tab-completion' into ccase/r13b04_devErlang/OTP
* uw/shell-tab-completion: Shell tab completion now works for quoted module and function names OTP-8383 Shell tab completion now works for quoted module and function names. (Thanks to Ulf Wiger.)
2010-01-13OTP-8240 Improved GC performance after BIF/NIF call when a lot of heapSverker Eriksson
fragments was created. This will mainly benefit NIFs that return large compound terms.
2010-01-07Shell tab completion now works for quoted module and function namesUlf Wiger
While quoted atoms in module and function names are not common, they are allowed, and sometimes quite useful. In OTP, they are commonplace in ORBER, and can also be found in XMERL. Tab completion needs to recognize quoted atoms and act accordingly. This patch includes changes in edlin:over_word/1. It should be noted that these changes also affect the 'kill word', 'forward word' and 'backward word' commands in the line editor. The author thinks that the changes are for the better. There are also minor changes in edlin_expand.erl - mainly in regard to the conversion between atoms and strings. Another change is that the list of matches is now sorted, partly to simplify testing, but also because it seems sensible to present the matches that way. A test suite, edlin_expand_SUITE, has been added to the stdlib test suites. (amended 2009-12-18 to actually include the modified files too and again to rename the capitalized test modules for portability.)
2009-12-14Merge branch 'as/c_nc-fix' into ccase/r13b04_devErlang/OTP
* as/c_nc-fix: c_SUITE: Use new style guard tests Fix c:nc to use outdir or cwd to find compiled object file OTP-8337 c:nc/{1,2} used to assume that the beam file was created in the same directory as the source code and failed to load the code if it was not. Corrected to look for the beam file in the current directory or in the directory specified by the {outdir,Dir} option. (Thanks to Alex Suraci.)
2009-12-14c_SUITE: Use new style guard testsBjörn Gustavsson
2009-12-14Fix c:nc to use outdir or cwd to find compiled object fileAlex Suraci
Before this patch, c:nc would naively assume the object file was created in the same location as the .erl file. This is often false, for example when an outdir is specified (often the case in make:all([netload])) or calling with c:nc("foo/bar") (because compile:file places bar.beam in the cwd, not foo/). [ Squashed in minor style changes. /bg ]
2009-12-04Merge branch 'sv/sys_get_status' into ccase/r13b04_devErlang/OTP
* sv/sys_get_status: Teach sys:get_status/1,2 to call Mod:format_status/2 gen_fsm: Fix format_status/2 to handle Pids OTP-8324 The ability for the gen_server and gen_fsm callback modules to format their own state for display under the sys:get_status/1,2 calls has been restored and documented. (Thanks to Steve Vinoski.)
2009-12-01Teach sys:get_status/1,2 to call Mod:format_status/2Steve Vinoski
Restore the ability for gen_server and gen_fsm callback modules to format their own state for display under the sys:get_status/1,2 calls. This ability is extremely useful for new behavior modules based on gen_server or gen_fsm, so that they can display their status in a more meaningful way than just dumping the state record. It is also generally useful for applications wanting to display their gen_server or gen_fsm callback module state in something other than the default manner. Also document the previously undocumented the gen_server:format_status/2 and gen_fsm:format_status/2 optional callback functions that, if exported by the callback module, are invoked when sys:get_status/1,2 are called. Add unit tests to ensure that format_status/2 functions exported from a gen_fsm callback module and a gen_server callback module are called when sys:get_status/1,2 are called.
2009-11-26Added more tests for array:reset/2.Dan Gudmundsson
Code coverage was bad for my new optimizations.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP