aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
AgeCommit message (Collapse)Author
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
2012-11-21Changes to function names, tests and docs of inetFredrik Gustafsson
2012-11-19Exported ipv4address and ipv6address functions to inet module, changed and ↵Fredrik Gustafsson
made testcases
2012-11-02Merge branch 'maint'Lukas Larsson
* maint: Skip ct_netconf tests if there is no crypto Migrate timers from test_server to ct interface Update tests to run with an oldshell emulator Move crypto check so that tc is skipped and not failed Update for new version of ppc compilation chain Verify that ebin folder of applications exists Conflicts: lib/asn1/test/asn1_SUITE.erl lib/kernel/test/interactive_shell_SUITE.erl
2012-11-02Merge branch 'lukas/rcs-ppc-cross-tests/OTP-10265' into maintLukas Larsson
* lukas/rcs-ppc-cross-tests/OTP-10265: Skip ct_netconf tests if there is no crypto Migrate timers from test_server to ct interface Update tests to run with an oldshell emulator Move crypto check so that tc is skipped and not failed Update for new version of ppc compilation chain Verify that ebin folder of applications exists
2012-10-31Merge branch 'siri/cover-tests'Siri Hansen
* siri/cover-tests: (21 commits) [common_test] Extend timer for flushing error logger [cover] Allow reconnection if node has been disconnected or down [cover] Don't kill remote nodes when connection to main node is lost [test_server] Add option {start_cover,false} to test_server:start_node Use code:lib_dir instead of code:which to get application directory [common_test] Add test for OTP-9956 Include all kernel modules in code coverage analysis [common_test] Add test suite for code coverage support [common_test, test_server] Don't flush cover if cover is not running [common_test] Add option cover_stop [test_server] Allow cross cover analysis when testing through common_test [test_server] Start cover in test_server:wait_for_node [test_server] Multiply timers with timetrap_scale_factor when starting nodes Include all stdlib modules in code coverage analysis [test_server] Include all test_server modules in code coverage analysis Skip epp_SUITE:otp_8911 if cover is running [common_test] Start cover on slave nodes if running cover tests [common_test] Don't stop cover before stopping slave node [test_server] Don't stop cover after test is finished [cover] Add support for test_server ... OTP-10427
2012-10-31Merge branch 'raimo/IPV6_V6ONLY/OTP-8928'Raimo Niskanen
* raimo/IPV6_V6ONLY/OTP-8928: kernel: Document socket option ipv6_v6only kernel: Add test cases for socket option ipv6_v6only erts,kernel: Implement socket option ipv6_v6only in erlang code erts: Implement socket option IPV6_V6ONLY erts: Add configure test for IPV6_V6ONLY
2012-10-31kernel: Add test cases for socket option ipv6_v6onlyRaimo Niskanen
2012-10-30kernel: Extend test timeout for cover testsDan Gudmundsson
2012-10-30Use code:lib_dir instead of code:which to get application directorySiri Hansen
code_SUITE:ext_mod_dep used code:which(kernel) to get the path to the kernel ebin directory. This failed when kernel was cover compiled, since code:which then returns 'cover_compiled'. Using code:lib_dir instead solved the problem.
2012-10-30Include all kernel modules in code coverage analysisSiri Hansen
2012-10-24Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: erts/etc/common/heart.c
2012-10-23test: Relax timeouts for heart_SUITEBjörn-Egil Dahlberg
Timeouts were set too narrow and timedout on slow machines
2012-10-22Migrate timers from test_server to ct interfaceLukas Larsson
2012-10-22Update tests to run with an oldshell emulatorLukas Larsson
Some of the tests which tested shell output assumed that when starting a shell using `erl` a shell with newshell was used. This is not true for systems built with --disable-termcap, so the on some embedded systems those tests failed.
2012-10-18test: Add test for heart restart on crashBjörn-Egil Dahlberg
* node_start_soon_after_crash tests that heart restarts beam upon a crash and only lets beam write its crash dump for a certain amount of time
2012-10-16test: Add test for heart restart on crashBjörn-Egil Dahlberg
* node_start_immediately_after_crash tests that heart restarts beam upon a crash and will not generate a crash dump
2012-10-15test: Refactor away ?line macros in heart_SUITEBjörn-Egil Dahlberg
2012-10-08SCTP test case with socket active options once and trueJonas Falkevik
Test case for testing socket option {active, true} after association is peeled off.
2012-08-31Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: lib/diameter/autoconf/vxworks/sed.general xcomp/README.md
2012-08-31Update copyright yearsBjörn-Egil Dahlberg