aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/scheduler_SUITE_data
diff options
context:
space:
mode:
authorSteve Vinoski <[email protected]>2016-01-28 16:37:33 -0500
committerRickard Green <[email protected]>2016-02-15 09:55:42 +0100
commit57cff1f4286a9511926ee37c015b3f6f081d64d0 (patch)
tree437d8a0d33d99dded188f977d942d5e2563464bd /erts/emulator/test/scheduler_SUITE_data
parenta7f48d4972be0c7984d5cb0e08e73260c0fdbe1b (diff)
downloadotp-57cff1f4286a9511926ee37c015b3f6f081d64d0.tar.gz
otp-57cff1f4286a9511926ee37c015b3f6f081d64d0.tar.bz2
otp-57cff1f4286a9511926ee37c015b3f6f081d64d0.zip
Add dirty scheduler process termination test
In scheduler_SUITE add a new test that runs a single dirty I/O scheduler and launches a number of dirty I/O NIF calls that each sleep for 3 seconds. Given the single scheduler, the first of these will run while the rest queue up. Then start killing these processes, and verify they call exit correctly.
Diffstat (limited to 'erts/emulator/test/scheduler_SUITE_data')
-rw-r--r--erts/emulator/test/scheduler_SUITE_data/Makefile.src8
-rw-r--r--erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c31
2 files changed, 39 insertions, 0 deletions
diff --git a/erts/emulator/test/scheduler_SUITE_data/Makefile.src b/erts/emulator/test/scheduler_SUITE_data/Makefile.src
new file mode 100644
index 0000000000..859112cf19
--- /dev/null
+++ b/erts/emulator/test/scheduler_SUITE_data/Makefile.src
@@ -0,0 +1,8 @@
+
+SCHEDULER_LIBS = scheduler_SUITE@dll@
+
+all: $(SCHEDULER_LIBS)
+
+@SHLIB_RULES@
+
+$(SCHEDULER_LIBS): scheduler_SUITE.c
diff --git a/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c b/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c
new file mode 100644
index 0000000000..022858c114
--- /dev/null
+++ b/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c
@@ -0,0 +1,31 @@
+#include <unistd.h>
+#include "erl_nif.h"
+
+static int
+load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
+{
+ ErlNifSysInfo sys_info;
+ enif_system_info(&sys_info, sizeof(ErlNifSysInfo));
+ if (!sys_info.smp_support || !sys_info.dirty_scheduler_support)
+ return 1;
+ return 0;
+}
+
+static ERL_NIF_TERM
+dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
+{
+#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
+ sleep(3);
+#endif
+ return enif_make_atom(env, "ok");
+}
+
+static ErlNifFunc funcs[] = {
+#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
+ {"dirty_sleeper", 0, dirty_sleeper, ERL_NIF_DIRTY_JOB_IO_BOUND}
+#else
+ {"dirty_sleeper", 0, dirty_sleeper, 0}
+#endif
+};
+
+ERL_NIF_INIT(scheduler_SUITE, funcs, &load, NULL, NULL, NULL);