aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-12-12 21:58:25 +0100
committerSverker Eriksson <[email protected]>2017-12-12 21:58:25 +0100
commita72a33e51218b1584f87629a9725665c22f9eb09 (patch)
tree553295ed42a5275b0907c04f454798f385877435 /erts
parent003e5450924c4d8202e2013cac41eff58fa90584 (diff)
downloadotp-a72a33e51218b1584f87629a9725665c22f9eb09.tar.gz
otp-a72a33e51218b1584f87629a9725665c22f9eb09.tar.bz2
otp-a72a33e51218b1584f87629a9725665c22f9eb09.zip
erts: Trim driver_SUITE:smp_select for slow valgrind
Symptom: "Closing pipe in state Waiting. Event lost?" Snake oil: Do erlang:yield() instead of busy spinning in "Waiting" state.
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/test/driver_SUITE.erl5
-rw-r--r--erts/emulator/test/driver_SUITE_data/chkio_drv.c17
2 files changed, 14 insertions, 8 deletions
diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl
index 6810729285..c31ceb4d4b 100644
--- a/erts/emulator/test/driver_SUITE.erl
+++ b/erts/emulator/test/driver_SUITE.erl
@@ -1673,7 +1673,10 @@ smp_select0(Config) ->
smp_select_loop(_, 0) ->
ok;
smp_select_loop(Port, N) ->
- "ok" = erlang:port_control(Port, ?CHKIO_SMP_SELECT, []),
+ case erlang:port_control(Port, ?CHKIO_SMP_SELECT, []) of
+ "yield" -> erlang:yield();
+ "ok" -> ok
+ end,
receive
stop ->
io:format("Worker ~p stopped with ~p laps left\n",[self(), N]),
diff --git a/erts/emulator/test/driver_SUITE_data/chkio_drv.c b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
index 8e5e81665c..e55b9e10ba 100644
--- a/erts/emulator/test/driver_SUITE_data/chkio_drv.c
+++ b/erts/emulator/test/driver_SUITE_data/chkio_drv.c
@@ -1225,7 +1225,6 @@ chkio_drv_control(ErlDrvData drv_data,
break;
}
case CHKIO_SMP_SELECT: {
- int rounds = 1; /*rand(); */
ChkioSmpSelect* pip = (ChkioSmpSelect*) cddp->test_data;
if (pip == NULL) {
erl_drv_mutex_lock(smp_pipes_mtx);
@@ -1242,7 +1241,8 @@ chkio_drv_control(ErlDrvData drv_data,
}
erl_drv_mutex_unlock(smp_pipes_mtx);
}
- while (rounds--) {
+ res_str = NULL;
+ {
int op = rand_r(&pip->rand_state);
switch (pip->state) {
case Closed: {
@@ -1252,7 +1252,6 @@ chkio_drv_control(ErlDrvData drv_data,
fcntl(fds[0], F_SETFL, flags|O_NONBLOCK) < 0) {
driver_failure_posix(cddp->port, errno);
- rounds = 0;
break;
}
TRACEF(("%T: Created pipe [%d->%d]\n", cddp->id, fds[1], fds[0]));
@@ -1332,7 +1331,9 @@ chkio_drv_control(ErlDrvData drv_data,
pip->next_write++;
}
break;
- case Waiting:
+ case Waiting:
+ res_str = "yield";
+ res_len = -1;
break;
default:
fprintf(stderr, "Strange state %d\n", pip->state);
@@ -1348,9 +1349,11 @@ chkio_drv_control(ErlDrvData drv_data,
else {
cddp->test_data = pip;
}
- }
- res_str = "ok";
- res_len = -1;
+ }
+ if (!res_str) {
+ res_str = "ok";
+ res_len = -1;
+ }
break;
}
case CHKIO_DRV_USE: