aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
AgeCommit message (Collapse)Author
2019-04-18erts: Yield correctly when iterating over distr exit messagesLukas Larsson
Before this fix the process would continue to process more distributed down or exit messages until it ran out of reductions instead of being suspended immediately.
2019-04-18erts: Make dump_SUITE:free_dump not dump via rpcLukas Larsson
Doing the dump via rpc can introduce all kins of strange timing issiues. So instead we dump 5ms after the exit has been started.
2019-04-18erts: Add extra debugging to dist frag testcasesLukas Larsson
2019-04-18erts: Run smaller dist frag test to 32 bit machinesLukas Larsson
Because of fragmentation of memory it is not always possible to allocate enough 320 MB segments on 32-bit so we only sent smaller packets there.
2019-04-10Merge pull request #2204 from jhogberg/john/erts/optimize-arith-ops/OTP-15740John Högberg
erts: Optimize arithmetic ops using overflow intrinsics
2019-04-09erts: Fix driver_SUITE:use_fallback_pollsetLukas Larsson
We don't check for io errors as the pollset will be unstable.
2019-04-09erts: Skip large dist testcases on machines with little memoryLukas Larsson
2019-04-08Merge branch 'bjorn/erts/cuddle-with-tests'Björn Gustavsson
* bjorn/erts/cuddle-with-tests: statistics_SUITE: Make wall_clock_update/1 more tolerant
2019-04-08erts: Optimize arithmetic ops using overflow intrinsicsJohn Högberg
2019-04-03lcnt_SUITE: Ignore socket-NIF locks in toggle testsJohn Högberg
2019-04-01efile_SUITE: Fix proc_zero_sized_files on systems with empty /procJohn Högberg
This test would fail on some versions of FreeBSD because /proc was present but empty. This commit makes the test fail if and only if a known zero-sized file is found and turns out to be empty empty.
2019-03-29Merge branch 'maint'Sverker Eriksson
2019-03-29Merge branch 'sverker/process_info-reductions-fix/OTP-15709' into maintSverker Eriksson
* sverker/process_info-reductions-fix/OTP-15709: erts: Fix bug in process_info(reductions) erts: Use ptr_val for pointer in gc msg copy
2019-03-29Fix out of memory bug in the implementation of mapsKjell Winblad
This commit fixes a bug that could cause a crash or memory usage to grow until the machine ran out of memory when adding a key-value pair to a map. This could happen when inserting a new key-value pair with a key K1 containing a binary B1 into a map M having a key K2 with a binary B2 if the following conditions were met: * size(B1) >= 4294967296 * size(B2) >= 4294967296 * size(M) >= 32 * (size(B1) rem 4294967296) == (size(B2) rem 4294967296) * the first (size(B1) rem 4294967296) bytes are the same both in B1 and B2 * substituting B1 in K1 with B2 would result in a term with the same value as K2 The root cause of the bug is that the map implementation only hashed the first (X modulo 4294967296) bytes of binaries so that different binaries could get hashed to the same hash value independently of the hash seed.
2019-03-28erts: Fix bug in process_info(reductions)Sverker Eriksson
returning incorrect result as * current process might not be RUNNING in which case REDS_IN is actually used as def_arg_reg[5] * FCALLS might not have been swapped out * the SAVED_CALLS case was wrong and returned number of reds left
2019-03-28Merge branch 'john/erts/remove-destructive-bs_get_binary2/ERL-901'John Högberg
* john/erts/remove-destructive-bs_get_binary2/ERL-901: erts: Remove unsafe bs_get_binary2 optimization from loader
2019-03-27erts: Remove unsafe bs_get_binary2 optimization from loaderJohn Högberg
A load-time optimization assumed that match contexts had no further uses when a bs_get_binary2 overwrote the match context's register, and figured it would be safe to reuse the match context's memory for the resulting binary. This is no longer safe as of OTP 22, as a match context may be reused after being passed to another function.
2019-03-25Merge branch 'sverker/bug-fixing'Sverker Eriksson
* sverker/bug-fixing: erts: Fix erts_debug:set_internal_state(reds_left) erts: Fix binary_SUITE:cmp_old_impl
2019-03-25erts: Fix binary_SUITE:cmp_old_implSverker Eriksson
since DFLAG_BIG_CREATION became mandatory in 321dc6ee0241f802c940def174c0a77262e11f21.
2019-03-25erts: Yield when exiting/free process is suspended by deLukas Larsson
2019-03-25Fix tests to work better in debug emulatorLukas Larsson
2019-03-25erts: Skip heavy process tab tests in debug emuLukas Larsson
2019-03-25Revert "erts: Always run fds check after each testcase"Lukas Larsson
This reverts commit 1eb0a2c47edd036731ee1e4e4f7b5bdfc7d576fa.
2019-03-25erts: Always run fds check after each testcaseLukas Larsson
2019-03-25erts: Always stop any testnodes before testcase exitsLukas Larsson
This needs to be done in order for automatic fd leak checking to work properly.
2019-03-25erts: Add crash dumping of EXITING and FREE processesLukas Larsson
2019-03-25erts: Fix verify_nc in distribution suiteLukas Larsson
When the calling process is trapping exits a stray message will end up in the mailbox which is problematic. This change uses a monitor instead.
2019-03-25erts: Fix atom16 testcase after dist frag implLukas Larsson
2019-03-25statistics_SUITE: Make wall_clock_update/1 more tolerantBjörn Gustavsson
Be more tolerant of time deviations, to avoid that this test case fails on slow computers.
2019-03-22Merge branch 'john/erts/fix-badarg-fixed_apply'John Högberg
* john/erts/fix-badarg-fixed_apply: erts: Include argument list on badarg in fixed_apply
2019-03-21Merge 'sverker/master/enif_whereis_pid-dirty-dtor/OTP-15694'Sverker Eriksson
* sverker/master/enif_whereis_pid-dirty-dtor: erts: Add test of enif_whereis* from resource destructor erts: Simplify nif_SUITE:nif_whereis* tests erts: Schedule resource destructors always
2019-03-21Merge branch 'maint'Rickard Green
* maint: Fix reception of resume signal on process executing dirty
2019-03-21erts: Include argument list on badarg in fixed_applyJohn Högberg
2019-03-21Merge branch 'bmk/20190320/esock/test_case_adjustements'Micael Karlberg
2019-03-20Fix reception of resume signal on process executing dirtyRickard Green
If a suspend/resume signal pair was sent to a process while it was executing dirty the resume counter on the process got into an inconsistent state. This in turn could cause the process to enter a suspended state indefinitely.
2019-03-20[socket|test] Improve test case preconditionMicael Karlberg
Added a fun for precondition check run before each test case is actually run. The primary reason for this is the api_to_connect test case, which does not work for a number of platforms. Also, moved the IPv6 check into this fun (instead of an explicit skip in the test case fun) for the IPv6 test cases.
2019-03-20Merge branch 'sverker/nif-test-cuddle'Sverker Eriksson
2019-03-19Merge branch 'sverker/enif_whereis_pid-dirty-dtor'Sverker Eriksson
into sverker/master/enif_whereis_pid-dirty-dtor
2019-03-19erts: Add test of enif_whereis* from resource destructorSverker Eriksson
2019-03-19erts: Simplify nif_SUITE:nif_whereis* testsSverker Eriksson
and change some argc checks from badarg to assert.
2019-03-19erts: Schedule resource destructors alwaysSverker Eriksson
to run user NIF code in a more known execution context. Fixes problems like user calling enif_whereis_pid() in destructor which may need to release process main lock in order to lock reg_tab.
2019-03-18Merge branch 'bmk/20190312/linked_test_procs'Micael Karlberg
2019-03-15erts: Fix some racy testsSverker Eriksson
Wait for resource-holding processes to garbage collect before exiting to know destructors have been called.
2019-03-13Merge pull request #2177 from bjorng/bjorn/erts/tail-recursive-bifsBjörn Gustavsson
Optimize tail-recursive calls of BIFs OTP-15674
2019-03-13Merge branch 'bmk/20190301/cleanup_through_macro_abuse/OTP-15565'Micael Karlberg
2019-03-12[socket|test] Make the evaluator processes linkedMicael Karlberg
If a test case timed out, all processes created by it should die. But because the 'evaluator' processes where created with spawn_monitor, that was not the case, and therefor, these processes could linger.
2019-03-09Optimize tail-recursive calls of BIFsBjörn Gustavsson
BEAM currently does not call BIFs at the end of a function in a tail-recursive way. That is, when calling a BIF at the end of a function, the BIF is first called, and then the stack frame is deallocated, and then control is transferred to the caller. If there is no stack frame when a BIF is called in the tail position, the loader will emit a sequence of three instructions: first an instruction that allocates a stack frame and saves the continuation pointer (`allocate`), then an instruction that calls the BIF (`call_bif`), and lastly an instruction that deallocates the stack frame and returns to the caller (`deallocate_return`). The old compiler would essentially allocate a stack frame for each clause in a function, so it would not be that common that a BIF was called in the tail position when there was no stack frame, so the three-instruction sequence was deemed acceptable. The new compiler only allocates stack frames when truly needed, so the three-instruction BIF call sequence has become much more common. This commit introduces a new `call_bif_only` instruction so that only one instruction will be needed when calling a BIF in the tail position when there is no stack frame. This instruction is also used when there is a stack frame to make it possible to deallocate the stack frame **before** calling the BIF, which may make a subsequent garbage collection at the end of the BIF call cheaper (copying less garbage). The one downside of this change is that the function that called the BIF will not be included in the stack backtrace (similar to how a tail-recursive call to an Erlang function will not be included in the backtrace). That was the quick summary of the commit. Here comes a detailed look at how BIF calls are translated by the loader. The first example is a function that calls `setelement/3` in the tail position: update_no_stackframe(X) -> setelement(5, X, new_value). Here is the BEAM code: {function, update_no_stackframe, 1, 12}. {label,11}. {line,[...]}. {func_info,{atom,t},{atom,update_no_stackframe},1}. {label,12}. {move,{x,0},{x,1}}. {move,{atom,new_value},{x,2}}. {move,{integer,5},{x,0}}. {line,[...]}. {call_ext_only,3,{extfunc,erlang,setelement,3}}. Because there is no stack frame, the `call_ext_only` instruction will be used to call `setelement/3`: {call_ext_only,3,{extfunc,erlang,setelement,3}}. The loader will transform this instruction to a three-instruction sequence: 0000000020BD8130: allocate_tt 0 3 0000000020BD8138: call_bif_e erlang:setelement/3 0000000020BD8148: deallocate_return_Q 0 Using the `call_bif_only` instruction introduced in this commit, only one instruction is needed: 000000005DC377F0: call_bif_only_e erlang:setelement/3 `call_bif_only` calls the BIF and returns to the caller. Now let's look at a function that already has a stack frame when `setelement/3` is called: update_with_stackframe(X) -> foobar(X), setelement(5, X, new_value). Here is the BEAM code: {function, update_with_stackframe, 1, 14}. {label,13}. {line,[...]}. {func_info,{atom,t},{atom,update_with_stackframe},1}. {label,14}. {allocate,1,1}. {move,{x,0},{y,0}}. {line,[...]}. {call,1,{f,16}}. {move,{y,0},{x,1}}. {move,{atom,new_value},{x,2}}. {move,{integer,5},{x,0}}. {line,[...]}. {call_ext_last,3,{extfunc,erlang,setelement,3},1}. Since there is a stack frame, the `call_ext_last` instruction will be used to deallocate the stack frame and call the function: {call_ext_last,3,{extfunc,erlang,setelement,3},1}. Before this commit, the loader would translate this instruction to: 0000000020BD81B8: call_bif_e erlang:setelement/3 0000000020BD81C8: deallocate_return_Q 1 That is, the BIF is called before deallocating the stack frame and returning to the calling function. After this commit, the loader will translate the `call_ext_last` like this: 000000005DC37868: deallocate_Q 1 000000005DC37870: call_bif_only_e erlang:setelement/3 There are still two instructions, but now the stack frame will be deallocated before calling the BIF, which could make the potential garbage collection after the BIF call slightly more efficient (copying less garbage). We could have introduced a `call_bif_last` instruction, but the code for calling a BIF is relatively large and there does not seem be a practical way to share the code between `call_bif` and `call_bif_only` (since the difference is at the end, after the BIF call). Therefore, we did not want to clone the BIF calling code yet another time to make a `call_bif_last` instruction.
2019-03-07erts: Add enif_term_typeJohn Högberg
This helps avoid long sequences of enif_is_xxx in code that serializes terms (such as JSON encoders) by letting the user switch on the type.
2019-03-04[socket|net] Macro abuseMicael Karlberg
Make use of macro concat magic to simplify declarations. OTP-15565
2019-03-01[socket|test] Quiet logger and ttest improvementsMicael Karlberg
Add a quiet logger mode (default) which limits the printouts in the (erlang) shell (the web log will be as verbose as usual). Also added a way to configure the runtime of the ttest cases.