aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
AgeCommit message (Collapse)Author
2013-04-19Remove the "coding: utf-8" comment from all Erlang source filesHans Bolinder
2013-04-17Merge branch 'bjorn/fix-encoding/OTP-11041' into maintBjörn Gustavsson
* bjorn/fix-encoding/OTP-11041: Encode Erlang source files with non-ascii characters in UTF-8
2013-04-17Encode Erlang source files with non-ascii characters in UTF-8Björn Gustavsson
To ensure that 'master' compiles when we merge 'maint' to it, regardless of which encoding is default in 'master', all source files with non-ascii characters *must* have the encoding specified.
2013-04-15Merge branch 'lh/demonitor-flush/OTP-11039' into maintFredrik Gustafsson
* lh/demonitor-flush/OTP-11039: Use erlang:demonitor(Ref, [flush]) where applicable
2013-04-11Optimize communication with file io serverAnthony Ramine
The file module communicates with a file io server with the following protocol for file operations: > {file_request,From,ReplyAs,Request} < {file_reply,ReplyAs,Reply} The ReplyAs value is sent by the client side to match against when receiving the reply and is otherwise left untouched and passed as is by the server. This commit enables receive optimizations by using the reference of the server monitor, changing the protocol to: > {file_request,From,MonitorRef,Request} < {file_reply,MonitorRef,Reply} As the shape of the messages is not changed, backwards compatibility is not a concern.
2013-04-05Use erlang:demonitor(Ref, [flush]) where applicableLoïc Hoguin
2013-03-18Fix a test caseHans Bolinder
interactive_shell_SUITE: nodes names with '-'
2013-03-18Correct a disk_log testcaseHans Bolinder
2013-03-05tests: Refactor away ?line macro in test suiteBjörn-Egil Dahlberg
Refactor away ?line macro in application_SUITE
2013-03-05kernel: Tests for application:ensure_started/1,2Björn-Egil Dahlberg
2013-02-25Update to work with new default windows max portsLukas Larsson
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-22Merge branch 'hb/file_name_type/OTP-10852'Patrik Nyblom
* hb/file_name_type/OTP-10852: Introduce new type file:name_all()
2013-02-21Merge branch 'pan/unicode_filename_warnings'Björn Gustavsson
* pan/unicode_filename_warnings: prim_file: Fix error return from prim_file:list_dir/1
2013-02-21Introduce new type file:name_all()Hans Bolinder
2013-02-20Merge branch 'ks/hipe_bif-remove_refs_from/OTP-10851'Fredrik Gustafsson
* ks/hipe_bif-remove_refs_from/OTP-10851: Fixed test to allow for lists:foreach/2 call Change the return value of hipe_bifs:remove_refs_from/1
2013-02-20Merge branch 'sverk/is_module_native-fix'Sverker Eriksson
* sverk/is_module_native-fix: erts: Fix code:is_module_native OTP-10870
2013-02-20prim_file: Fix error return from prim_file:list_dir/1Björn Gustavsson
When the run-time system was started with +fnue, the error tuple indicating a non-translatable filename was added as a non-proper list tail inside an {ok,Files} term.
2013-02-19Fixed test to allow for lists:foreach/2 callKostis Sagonas
2013-02-18erts: Fix code:is_module_nativeSverker Eriksson
code:is_module_native returned false for hipe compiled module if the first function in the module was a BIF stub
2013-02-18Update file_name_SUITEBjörn Gustavsson
Because {prim_file,file}:list_dir/1 no longer returns untranslatable filenames, we must use list_dir_all/1 instead. We also need to use read_link_all/1 instead of read_link/1.
2013-02-18Fix broken prim_file:list_dir_all/1Björn Gustavsson
6d516de001dde82c02fe050db8e3aab47914fa90 added prim_file:list_dir_all/1. Unfortunately, only the first element in the list would be handled as intended.
2013-02-13Rethink the filelib:wildcard() functionsBjörn Gustavsson
Commit 70b5e24c9498225fadc08d19503269c8aad851bf broke filelib:wildcard(Pattern, "."). Over the years, the logic for filelib:wilcard() has become a mess of special cases. Probably because of premature optimization, filelib:wildcard(Pattern) and filelib:wildcard(Pattern, Cwd) are handled differently. They can be consolidated if we use a "." as the default Cwd argument. We can also simplify things by compiling the Cwd argument into the wildcard. We did not that in the initial implementation because it used to be possible to pre-compile a wildcard and pass it to filelib:wildcard/{1,2}. Since that is no longer possible, there is no point in keeping the compiled wildcard "portable" (not dependent on the Cwd argument).
2013-02-12Merge branch 'pan/unicode_filename_warnings'Björn Gustavsson
* pan/unicode_filename_warnings: Add file:list_dir_all/1 and file:read_link_all/1 prim_file: Add list_dir_all() and read_link_all() Teach prim_file:set_cwd() to avoid entering non-translatable directories Make prim_file skip invalid filenames in unicode mode prim_file: Refactor functions that return filenames prim_file: Refactor handling of responses prim_file: Always open non-file ports in binary mode Test that list_dir("non-existing-dir") fails with the correct error
2013-02-11Add file:list_dir_all/1 and file:read_link_all/1Björn Gustavsson
2013-02-11prim_file: Add list_dir_all() and read_link_all()Björn Gustavsson
2013-02-08Test that list_dir("non-existing-dir") fails with the correct errorBjörn Gustavsson
2013-02-01Add a new function code:get_mode() can be used to detect how the code ↵Vlad Dumitrescu
servers behaves Rationale: Some applications (like erlide) have code to be loaded dynamically on a node. It may be slow to load everything upfront every time, so if the node is in interactive mode, we would like to just append to the load path. Currently, there is no direct way to detect if the node is running in embedded mode or not so that we can do the right thing.
2013-01-25Update copyright yearsBjörn-Egil Dahlberg
2013-01-25Make adjustments for UnicodeHans Bolinder
2013-01-23Add testcase for oct countersPatrik Nyblom
2013-01-23Fix efile_drv crash when using async thread poolFilipe David Borba Manana
When using the async thread pool and compressed files, when an efile driver port instance is shutdown, the efile_drv stop callback closes the file descriptor (a gzFile instance actually) - this is dangerous if at the same time there's an async thread performing an operation against the file, for example calling invoke_read(), which can result in a segmentation fault, or calling invoke_close() which double closes the gzFile and this in turn causes 2 consecutive calls to driver_free() against same gzFile instance (resulting in later unexpected crashes in erl_bestfit_alloc.c for example). The following test program makes the emulator crash when using the async thread pool: -module(t2). -export([t/1]). t(N) -> file:delete("foo.bar"), % Use of 'compressed' option, for creating/writing the file, % is irrelevant. It only matters when opening it later for % reads - a non-compressed file open with the 'compressed' % option goes through an internal gzFile handle (instead of % a plain integer fd), just like a compressed file. %{ok, Fd} = file:open("foo.bar", [raw, write, binary]), {ok, Fd} = file:open("foo.bar", [raw, write, binary, compressed]), ok = file:write(Fd, <<"qwerty">>), ok = file:close(Fd), Pid = spawn_link(fun() -> process_flag(trap_exit, true), loop(N) end), Ref = erlang:monitor(process, Pid), receive {'DOWN', Ref, _, _, _} -> ok end. loop(0) -> ok; loop(N) -> Server = self(), Pid = spawn(fun() -> {ok, Fd} = file:open("foo.bar", [read, raw, binary, compressed]), Server ! continue, % Comment the file:read/2 call to make the file:close/1 call much % more likely to crash or end up causing efile_drv to close twice % the fd (gzFile), which will make the emulator crash later in the % best fit allocator (erl_bestfit_alloc.c). _ = file:read(Fd, 5), file:close(Fd) end), receive continue -> ok end, exit(Pid, shutdown), loop(N - 1). Running this test when using the async thread pool: shell> erl +A 4 Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:4] [hipe] [kernel-poll:false] Eshell V5.9.3.1 (abort with ^G) 1> c(t2). {ok,t2} 2> t2:t(500000). Segmentation fault (core dumped) When not using the async thread pool, there are no issues: shell> erl Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.9.3.1 (abort with ^G) 1> c(t2). {ok,t2} 2> t2:t(500000). ok 3> An example stack trace when the crash happens because there's an ongoing read operation is: Thread 1 (Thread 0x7f021cf2c700 (LWP 10687)): #0 updatewindow (strm=0x2691bf8, out=5) at zlib/inflate.c:338 #1 0x00000000005a2ba0 in inflate (strm=0x2691bf8, flush=0) at zlib/inflate.c:1141 #2 0x000000000055c46a in erts_gzread (file=0x2691bf8, buf=0x7f0215b29e80, len=5) at drivers/common/gzio.c:523 #3 0x00000000005849ef in invoke_read (data=0x26b2228) at drivers/common/efile_drv.c:1114 #4 0x000000000050adcb in async_main (arg=0x7f021bf5cf40) at beam/erl_async.c:488 #5 0x00000000005c21a0 in thr_wrapper (vtwd=0x7fff69c6ff10) at pthread/ethread.c:106 #6 0x00007f021c573e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #7 0x00007f021c097cbd in clone () from /lib/x86_64-linux-gnu/libc.so.6 #8 0x0000000000000000 in ?? () And when there's an ongoing close operation when the driver is stopped: Thread 1 (Thread 0x7fe5f5654700 (LWP 747)): #0 0x0000000000459b64 in bf_unlink_free_block (block=0x10b2a70, allctr=<optimized out>, flags=<optimized out>) at beam/erl_bestfit_alloc.c:792 #1 bf_unlink_free_block (flags=0, block=0x10b2a70, allctr=0x873380) at beam/erl_bestfit_alloc.c:822 #2 bf_get_free_block (allctr=0x873380, size=<optimized out>, cand_blk=<optimized out>, cand_size=<optimized out>, flags=0) at beam/erl_bestfit_alloc.c:869 #3 0x000000000044f0dd in mbc_alloc_block (alcu_flgsp=<synthetic pointer>, blk_szp=<synthetic pointer>, size=200, allctr=0x873380) at beam/erl_alloc_util.c:1198 #4 mbc_alloc (allctr=0x873380, size=200) at beam/erl_alloc_util.c:1345 #5 0x000000000045449b in do_erts_alcu_alloc (size=200, extra=0x873380, type=165) at beam/erl_alloc_util.c:3442 #6 erts_alcu_alloc_thr_pref (type=165, extra=<optimized out>, size=192) at beam/erl_alloc_util.c:3520 #7 0x000000000055c0bf in gz_open (mode=0x5d98b2 "rb", path=0x1103418 "foo.bar") at drivers/common/gzio.c:164 #8 erts_gzopen (path=0x1103418 "foo.bar", mode=0x5d98b2 "rb") at drivers/common/gzio.c:307 #9 0x0000000000584e47 in invoke_open (data=0x1103330) at drivers/common/efile_drv.c:1857 #10 0x000000000050adcb in async_main (arg=0x7fe5f698af80) at beam/erl_async.c:488
2013-01-21Merge branch 'lukas/kernel/iter_max_socks_to_node/OTP-10734'Lukas Larsson
* lukas/kernel/iter_max_socks_to_node/OTP-10734: Isolate iter_max_socks to own node
2013-01-21Isolate iter_max_socks to own nodeLukas Larsson
This prevents this testcase from ruining the entire testrun if it should fail critically.
2013-01-18Merge branch 'bjorn/kernel/undefined-function-handler/OTP-10617'Björn Gustavsson
* bjorn/kernel/undefined-function-handler/OTP-10617: Teach error_handler to call '$handle_undefined_function'
2013-01-17global_SUITE: Eliminate redundant registration of 'test_server' processBjörn Gustavsson
global_SUITE registers the name 'test_server' in the global registry for what seems to be only historical reasons. Exactly how it happened is lost in the mists of time, but I think the following is a reasonable reconstruction: * At one point in time, the test_server application started to do a global registration of a 'test_server' process to support embedded systems when the test_server application was run on both a host and a target system. * global_SUITE had to be modified to take the pre-existing 'test_server' registration into account. * When Erlang/OTP switched to using common_test, global_SUITE was modified to register the 'test_server' name itself in commit 8bd07f450816eaaae52d28740d89ead1f930cd02 (since the test_server application does not register the 'test_server' name when run under control of common_test). To slightly reduce the size of global_SUITE, remove the redundant registration and stop expecting 'test_server' to be registered.
2013-01-17Merge branch 'sal/get_env/OTP-10694'Fredrik Gustafsson
* sal/get_env/OTP-10694: Moved documentation in a separate entry Removed obsolete ?line macro Add application:get_key/3
2013-01-14Removed obsolete ?line macroSerge Aleynikov
2013-01-14Add application:get_key/3serge
The new function provides a default value for a configuration parameter.
2013-01-14Teach error_handler to call '$handle_undefined_function'Björn Gustavsson
2013-01-11Merge branch 'fdm/file-allocate/OTP-10680'Björn-Egil Dahlberg
* fdm/file-allocate/OTP-10680: Update preloaded prim_file.beam erts: Fix xcomp configure for fallocate Add file:allocate/3 operation
2013-01-09Merge branch 'egil/ignore-core'Björn-Egil Dahlberg
* egil/ignore-core: test: Ignore cores in debug build for crash dumps
2013-01-09Add file:allocate/3 operationFilipe David Manana
This operation allows pre-allocation of space for files. It succeeds only on systems that support such operation. The POSIX standard defines the optional system call posix_fallocate() to implement this feature. However, some systems implement more specific functions to accomplish the same operation. On Linux, if the more specific function fallocate() is implemented, it is used instead of posix_fallocate(), falling back to posix_fallocate() if the fallocate() call failed (it's only supported for the ext4, ocfs2, xfs and btrfs file systems at the moment). On Mac OS X it uses the specific fcntl() operation F_PREALLOCATE, falling back to posix_fallocate() if it's available (at the moment Mac OS X doesn't provide posix_fallocate()). On any other UNIX system, it uses posix_fallocate() if it's available. Any other system not providing this system call or any function to pre-allocate space for files, this operation always fails with the ENOTSUP POSIX error.
2013-01-09Prepare OTP files for Unicode as default encodingHans Bolinder
2013-01-08test: Ignore cores in debug build for crash dumpsBjörn-Egil Dahlberg
2012-12-07Merge branch 'rickard/port-optimizations/OTP-10336' into ↵Rickard Green
rickard/r16/port-optimizations/OTP-10336 * rickard/port-optimizations/OTP-10336: Change annotate level for emacs-22 in cerl Update etp-commands Add documentation on communication in Erlang Add support for busy port message queue Add driver callback epilogue Implement true asynchronous signaling between processes and ports Add erl_drv_[send|output]_term Move busy port flag Use rwlock for driver list Optimize management of port tasks Improve configuration of process and port tables Remove R9 compatibility features Use ptab functionality also for ports Prepare for use of ptab functionality also for ports Atomic port state Generalize process table implementation Implement functionality for delaying thread progress from unmanaged threads Conflicts: erts/doc/src/erl_driver.xml erts/doc/src/erlang.xml erts/emulator/beam/beam_bif_load.c erts/emulator/beam/beam_bp.c erts/emulator/beam/beam_emu.c erts/emulator/beam/bif.c erts/emulator/beam/copy.c erts/emulator/beam/erl_alloc.c erts/emulator/beam/erl_alloc.types erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_bif_port.c erts/emulator/beam/erl_bif_trace.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_message.c erts/emulator/beam/erl_port_task.c erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_process_lock.c erts/emulator/beam/erl_trace.c erts/emulator/beam/export.h erts/emulator/beam/global.h erts/emulator/beam/io.c erts/emulator/sys/unix/sys.c erts/emulator/sys/vxworks/sys.c erts/emulator/test/port_SUITE.erl erts/etc/unix/cerl.src erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/prim_inet.beam erts/preloaded/src/prim_inet.erl lib/hipe/cerl/erl_bif_types.erl lib/kernel/doc/src/inet.xml lib/kernel/src/inet.erl
2012-12-03Remove R9 compatibility featuresRickard Green
2012-11-30Merge branch 'fredrik/inet/export-ip-funcs/OTP-8067'Fredrik Gustafsson
* fredrik/inet/export-ip-funcs/OTP-8067: Inet doc clarifications Documentation changes inet Changes to function names, tests and docs of inet Added specs and doc Exported ipv4address and ipv6address functions to inet module, changed and made testcases
2012-11-23Merge branch 'maint'Björn-Egil Dahlberg
2012-11-23Update copyright yearsBjörn-Egil Dahlberg