diff options
28 files changed, 402 insertions, 409 deletions
diff --git a/erts/configure.in b/erts/configure.in index dae886b855..77a4d32787 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -1546,7 +1546,7 @@ AC_CHECK_HEADERS(fcntl.h limits.h unistd.h syslog.h dlfcn.h ieeefp.h \ sys/ioctl.h sys/time.h sys/uio.h \ sys/socket.h sys/sockio.h sys/socketio.h \ net/errno.h malloc.h arpa/nameser.h libdlpi.h \ - pty.h util.h utmp.h langinfo.h poll.h sdkddkver.h) + pty.h util.h libutil.h utmp.h langinfo.h poll.h sdkddkver.h) AC_CHECK_MEMBERS([struct ifreq.ifr_hwaddr], [], [], [#ifdef __WIN32__ diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c index 8c039ef132..446598362c 100644 --- a/erts/emulator/beam/break.c +++ b/erts/emulator/beam/break.c @@ -684,7 +684,7 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args) crash dump. */ erts_thr_progress_fatal_error_block(&tpd_buf); -#ifdef ERTS_THR_HAVE_SIG_FUNCS +#ifdef ERTS_SYS_SUSPEND_SIGNAL /* * We suspend all scheduler threads so that we can dump some * data about the currently running processes and scheduler data. @@ -818,7 +818,7 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args) #ifdef ERTS_SMP -#if defined(ERTS_THR_HAVE_SIG_FUNCS) +#ifdef ERTS_SYS_SUSPEND_SIGNAL /* We resume all schedulers so that we are in a known safe state when we write the rest of the crash dump */ diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c index 86c4eeb484..0c81a95705 100644 --- a/erts/emulator/beam/erl_init.c +++ b/erts/emulator/beam/erl_init.c @@ -2188,6 +2188,7 @@ erl_start(int argc, char **argv) init_break_handler(); if (replace_intr) erts_replace_intr(); + sys_init_suspend_handler(); #endif boot_argc = argc - i; /* Number of arguments to init */ diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c index abfc52d3bc..4f15ce0980 100644 --- a/erts/emulator/drivers/unix/ttsl_drv.c +++ b/erts/emulator/drivers/unix/ttsl_drv.c @@ -264,14 +264,12 @@ static int ttysl_init(void) DEBUGLOG(("ttysl_init: Debuglog = %s(0x%ld)\n",dl,(long) debuglog)); } #endif - DEBUGLOG(("ttysl_init: ttysl_port = %d\n", ttysl_port)); return 0; } static ErlDrvData ttysl_start(ErlDrvPort port, char* buf) { #ifndef HAVE_TERMCAP - DEBUGLOG(("ttysl_start: failure - no TERMCAP configured!\n")); return ERL_DRV_ERROR_GENERAL; #else char *s, *t, *l; diff --git a/erts/emulator/sys/unix/erl_unix_sys.h b/erts/emulator/sys/unix/erl_unix_sys.h index 8b1822ca9f..e217c38ca9 100644 --- a/erts/emulator/sys/unix/erl_unix_sys.h +++ b/erts/emulator/sys/unix/erl_unix_sys.h @@ -321,6 +321,7 @@ typedef void (*SIGFUNC)(int); extern SIGFUNC sys_signal(int, SIGFUNC); extern void sys_sigrelease(int); extern void sys_sigblock(int); +extern void sys_init_suspend_handler(void); /* * Handling of floating point exceptions. diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c index 0a18e54389..4f992d3caf 100644 --- a/erts/emulator/sys/unix/sys.c +++ b/erts/emulator/sys/unix/sys.c @@ -121,8 +121,10 @@ erts_smp_atomic_t sys_misc_mem_sz; static void smp_sig_notify(char c); static int sig_notify_fds[2] = {-1, -1}; +#if !defined(ETHR_UNUSABLE_SIGUSRX) && defined(ERTS_THR_HAVE_SIG_FUNCS) static int sig_suspend_fds[2] = {-1, -1}; #define ERTS_SYS_SUSPEND_SIGNAL SIGUSR2 +#endif #endif @@ -678,7 +680,7 @@ sigusr1_exit(void) #else -#ifdef ERTS_SMP +#ifdef ERTS_SYS_SUSPEND_SIGNAL void sys_thr_suspend(erts_tid_t tid) { erts_thr_kill(tid, ERTS_SYS_SUSPEND_SIGNAL); @@ -706,7 +708,7 @@ static RETSIGTYPE user_signal1(int signum) #endif } -#ifdef ERTS_SMP +#ifdef ERTS_SYS_SUSPEND_SIGNAL #if (defined(SIG_SIGSET) || defined(SIG_SIGNAL)) static RETSIGTYPE suspend_signal(void) #else @@ -719,7 +721,7 @@ static RETSIGTYPE suspend_signal(int signum) res = read(sig_suspend_fds[0], buf, sizeof(int)); } while (res < 0 && errno == EINTR); } -#endif /* #ifdef ERTS_SMP */ +#endif /* #ifdef ERTS_SYS_SUSPEND_SIGNAL */ #endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */ @@ -772,13 +774,17 @@ void init_break_handler(void) sys_signal(SIGINT, request_break); #ifndef ETHR_UNUSABLE_SIGUSRX sys_signal(SIGUSR1, user_signal1); -#ifdef ERTS_SMP - sys_signal(ERTS_SYS_SUSPEND_SIGNAL, suspend_signal); -#endif /* #ifdef ERTS_SMP */ #endif /* #ifndef ETHR_UNUSABLE_SIGUSRX */ sys_signal(SIGQUIT, do_quit); } +void sys_init_suspend_handler(void) +{ +#ifdef ERTS_SYS_SUSPEND_SIGNAL + sys_signal(ERTS_SYS_SUSPEND_SIGNAL, suspend_signal); +#endif +} + int sys_max_files(void) { return(max_files); @@ -1323,12 +1329,14 @@ init_smp_sig_notify(void) static void init_smp_sig_suspend(void) { +#ifdef ERTS_SYS_SUSPEND_SIGNAL if (pipe(sig_suspend_fds) < 0) { erts_exit(ERTS_ABORT_EXIT, "Failed to create sig_suspend pipe: %s (%d)\n", erl_errno_id(errno), errno); } +#endif } #ifdef __DARWIN__ diff --git a/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c b/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c index 022858c114..ab4863337f 100644 --- a/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c +++ b/erts/emulator/test/scheduler_SUITE_data/scheduler_SUITE.c @@ -1,4 +1,6 @@ +#ifndef __WIN32__ #include <unistd.h> +#endif #include "erl_nif.h" static int @@ -15,8 +17,12 @@ static ERL_NIF_TERM dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) { #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT +#ifdef __WIN32__ + Sleep(3000); +#else sleep(3); #endif +#endif return enif_make_atom(env, "ok"); } diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c index 22302d539a..30210ac172 100644 --- a/erts/etc/unix/run_erl.c +++ b/erts/etc/unix/run_erl.c @@ -43,10 +43,10 @@ #endif #ifdef HAVE_WORKING_POSIX_OPENPT # ifndef _XOPEN_SOURCE - /* On OS X, we must leave _XOPEN_SOURCE undefined in order for + /* On OS X and BSD, we must leave _XOPEN_SOURCE undefined in order for * the prototype of vsyslog() to be included. */ -# ifndef __APPLE__ +# if !(defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)) # define _XOPEN_SOURCE 600 # endif # endif @@ -69,10 +69,6 @@ #include <termios.h> #include <time.h> -#ifdef __ANDROID__ -# include <termios.h> -#endif - #ifdef HAVE_SYSLOG_H # include <syslog.h> #endif @@ -82,6 +78,9 @@ #ifdef HAVE_UTMP_H # include <utmp.h> #endif +#ifdef HAVE_LIBUTIL_H +# include <libutil.h> +#endif #ifdef HAVE_UTIL_H # include <util.h> #endif diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile index cd3c102f55..d63b2fe8f5 100644 --- a/lib/eldap/src/Makefile +++ b/lib/eldap/src/Makefile @@ -98,7 +98,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: opt $(INSTALL_DIR) "$(RELSYSDIR)/ebin" - $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" + $(INSTALL_DATA) $(ASN1_HRL) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin" $(INSTALL_DIR) "$(RELSYSDIR)/src" $(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src" $(INSTALL_DIR) "$(RELSYSDIR)/asn1" diff --git a/lib/kernel/test/error_logger_warn_SUITE.erl b/lib/kernel/test/error_logger_warn_SUITE.erl index d8bbd42517..4fad781520 100644 --- a/lib/kernel/test/error_logger_warn_SUITE.erl +++ b/lib/kernel/test/error_logger_warn_SUITE.erl @@ -366,7 +366,7 @@ rb_basic() -> 0 = one_rb_findstr([info_msg],pid_to_list(Self)), 0 = one_rb_findstr([info_report],pid_to_list(Self)), 2 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), + true = (one_rb_findstr([progress],"===") > 3), rb:stop(), application:stop(sasl), stop_node(Node), @@ -396,7 +396,7 @@ rb_warnings_info() -> 1 = one_rb_findstr([info_msg],pid_to_list(Self)), 1 = one_rb_findstr([info_report],pid_to_list(Self)), 2 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), + true = (one_rb_findstr([progress],"===") > 3), rb:stop(), application:stop(sasl), stop_node(Node), @@ -426,7 +426,7 @@ rb_warnings_errors() -> 0 = one_rb_findstr([info_msg],pid_to_list(Self)), 0 = one_rb_findstr([info_report],pid_to_list(Self)), 2 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), + true = (one_rb_findstr([progress],"===") > 3), rb:stop(), application:stop(sasl), stop_node(Node), @@ -459,7 +459,7 @@ rb_trunc() -> 0 = one_rb_findstr([info_msg],pid_to_list(Self)), 0 = one_rb_findstr([info_report],pid_to_list(Self)), 1 = one_rb_findstr([],pid_to_list(Self)), - true = (one_rb_findstr([progress],"===") > 4), + true = (one_rb_findstr([progress],"===") > 3), rb:stop(), application:stop(sasl), stop_node(Node), diff --git a/lib/percept/src/percept.erl b/lib/percept/src/percept.erl index badb3f3d66..f1a2002c9d 100644 --- a/lib/percept/src/percept.erl +++ b/lib/percept/src/percept.erl @@ -226,7 +226,7 @@ stop_webserver(Port) -> parse_and_insert(Filename, DB) -> io:format("Parsing: ~p ~n", [Filename]), - T0 = erlang:now(), + T0 = erlang:monotonic_time(milli_seconds), Pid = dbg:trace_client(file, Filename, mk_trace_parser(self())), Ref = erlang:monitor(process, Pid), parse_and_insert_loop(Filename, Pid, Ref, DB, T0). @@ -239,8 +239,8 @@ parse_and_insert_loop(Filename, Pid, Ref, DB, T0) -> {parse_complete, {Pid, Count}} -> receive {'DOWN', Ref, process, Pid, normal} -> ok after 0 -> ok end, DB ! {action, consolidate}, - T1 = erlang:now(), - io:format("Parsed ~p entries in ~p s.~n", [Count, ?seconds(T1, T0)]), + T1 = erlang:monotonic_time(milli_seconds), + io:format("Parsed ~w entries in ~w ms.~n", [Count, T1 - T0]), io:format(" ~p created processes.~n", [length(percept_db:select({information, procs}))]), io:format(" ~p opened ports.~n", [length(percept_db:select({information, ports}))]), ok; diff --git a/lib/percept/test/egd_SUITE.erl b/lib/percept/test/egd_SUITE.erl index 0b1149e1f1..6df7ed74c0 100644 --- a/lib/percept/test/egd_SUITE.erl +++ b/lib/percept/test/egd_SUITE.erl @@ -22,195 +22,160 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). +-export([all/0, suite/0]). -export([init_per_suite/1, end_per_suite/1]). -export([init_per_testcase/2, end_per_testcase/2]). %% Test cases --export([ - image_create_and_destroy/1, - image_shape/1, - image_primitives/1, - image_colors/1, - image_font/1, - image_png_compliant/1 - ]). - -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(1)). +-export([image_create_and_destroy/1, + image_shape/1, + image_primitives/1, + image_colors/1, + image_font/1, + image_png_compliant/1]). -init_per_suite(Config) when is_list(Config) -> - rand:seed(exsplus), - Config. - -end_per_suite(Config) when is_list(Config) -> - Config. - -init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{max_size, 800}, {watchdog,Dog} | Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 1}}]. all() -> [image_create_and_destroy, image_shape, image_primitives, image_colors, image_font, image_png_compliant]. -groups() -> - []. -init_per_group(_GroupName, Config) -> +init_per_suite(Config) when is_list(Config) -> + rand:seed(exsplus), Config. -end_per_group(_GroupName, Config) -> +end_per_suite(Config) when is_list(Config) -> Config. +init_per_testcase(_Case, Config) -> + [{max_size, 800}|Config]. + +end_per_testcase(_Case, _Config) -> + ok. %%---------------------------------------------------------------------- %% Tests %%---------------------------------------------------------------------- -image_create_and_destroy(suite) -> - []; -image_create_and_destroy(doc) -> - ["Image creation and destroy test."]; +%% Image creation and destroy test. image_create_and_destroy(Config) when is_list(Config) -> - {W,H} = get_size(?config(max_size, Config)), - ?line Image = egd:create(W, H), - ?line ok = egd:destroy(Image), + {W,H} = get_size(proplists:get_value(max_size, Config)), + Image = egd:create(W, H), + ok = egd:destroy(Image), ok. -image_colors(suite) -> - []; -image_colors(doc) -> - ["Image color test."]; +%% Image color test. image_colors(Config) when is_list(Config) -> - {W,H} = get_size(?config(max_size, Config)), - ?line Image = egd:create(W, H), + {W,H} = get_size(proplists:get_value(max_size, Config)), + Image = egd:create(W, H), put(image_size, {W,H}), RGB = get_rgb(), - ?line Black = egd:color({0,0,0}), - ?line Red = egd:color({255,0,0}), - ?line Green = egd:color({0,255,0}), - ?line Blue = egd:color({0,0,255}), - ?line Random = egd:color(Image, RGB), - - ?line ok = egd:line(Image, get_point(), get_point(), Random), - ?line ok = egd:line(Image, get_point(), get_point(), Red), - ?line ok = egd:line(Image, get_point(), get_point(), Green), - ?line ok = egd:line(Image, get_point(), get_point(), Black), - ?line ok = egd:line(Image, get_point(), get_point(), Blue), + Black = egd:color({0,0,0}), + Red = egd:color({255,0,0}), + Green = egd:color({0,255,0}), + Blue = egd:color({0,0,255}), + Random = egd:color(Image, RGB), + + ok = egd:line(Image, get_point(), get_point(), Random), + ok = egd:line(Image, get_point(), get_point(), Red), + ok = egd:line(Image, get_point(), get_point(), Green), + ok = egd:line(Image, get_point(), get_point(), Black), + ok = egd:line(Image, get_point(), get_point(), Blue), HtmlDefaultNames = [black,silver,gray,white,maroon,red, - purple,fuchia,green,lime,olive,yellow,navy,blue,teal, - aqua], - - lists:foreach(fun - (ColorName) -> - ?line Color = egd:color(ColorName), - ?line ok = egd:line(Image, get_point(), get_point(), Color) - end, HtmlDefaultNames), - - ?line <<_/binary>> = egd:render(Image), - ?line ok = egd:destroy(Image), + purple,fuchia,green,lime,olive,yellow,navy,blue,teal, + aqua], + + lists:foreach(fun (ColorName) -> + Color = egd:color(ColorName), + ok = egd:line(Image, get_point(), get_point(), Color) + end, HtmlDefaultNames), + + <<_/binary>> = egd:render(Image), + ok = egd:destroy(Image), erase(image_size), ok. -image_shape(suite) -> - []; -image_shape(doc) -> - ["Image shape api test."]; +%% Image shape API test. image_shape(Config) when is_list(Config) -> - {W,H} = get_size(?config(max_size, Config)), + {W,H} = get_size(proplists:get_value(max_size, Config)), put(image_size, {W,H}), - ?line Im = egd:create(W, H), - - ?line Fgc = egd:color({255,0,0}), - - ?line ok = egd:line(Im, get_point(), get_point(), Fgc), - ?line ok = egd:rectangle(Im, get_point(), get_point(), Fgc), - ?line ok = egd:filledEllipse(Im, get_point(), get_point(), Fgc), - ?line ok = egd:arc(Im, get_point(), get_point(), Fgc), - ?line ok = egd:arc(Im, get_point(), get_point(), 100, Fgc), - + Im = egd:create(W, H), + + Fgc = egd:color({255,0,0}), + + ok = egd:line(Im, get_point(), get_point(), Fgc), + ok = egd:rectangle(Im, get_point(), get_point(), Fgc), + ok = egd:filledEllipse(Im, get_point(), get_point(), Fgc), + ok = egd:arc(Im, get_point(), get_point(), Fgc), + ok = egd:arc(Im, get_point(), get_point(), 100, Fgc), + Pt1 = get_point(), Pt2 = get_point(), - ?line ok = egd:filledRectangle(Im, Pt1, Pt2, Fgc), + ok = egd:filledRectangle(Im, Pt1, Pt2, Fgc), - ?line Bitmap = egd:render(Im, raw_bitmap), + Bitmap = egd:render(Im, raw_bitmap), - ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc), - ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc), + ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc), + ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc), - ?line <<_/binary>> = egd:render(Im, raw_bitmap, [{render_engine, alpha}]), + <<_/binary>> = egd:render(Im, raw_bitmap, [{render_engine, alpha}]), - ?line ok = egd:destroy(Im), + ok = egd:destroy(Im), erase(image_size), ok. -image_primitives(suite) -> - []; -image_primitives(doc) -> - ["Image shape api test."]; +%% Image shape API test. image_primitives(Config) when is_list(Config) -> - {W,H} = get_size(?config(max_size, Config)), + {W,H} = get_size(proplists:get_value(max_size, Config)), put(image_size, {W,H}), - ?line Im0 = egd_primitives:create(W, H), - ?line Fgc = egd:color({25,25,255}), - ?line Bgc = egd:color({0,250,25}), + Im0 = egd_primitives:create(W, H), + Fgc = egd:color({25,25,255}), + Bgc = egd:color({0,250,25}), - ?line Im1 = lists:foldl(fun - ({Function, Arguments}, Im) -> - ?line erlang:apply(egd_primitives, Function, [Im|Arguments]) - end, Im0, - [{Fs, [get_point(), get_point(), Bgc]} || Fs <- [line, rectangle, filledEllipse, arc]] ++ - [{pixel, [get_point(), Bgc]}, - {filledTriangle, [get_point(), get_point(), get_point(), Bgc]}]), + Im1 = lists:foldl(fun ({Function, Arguments}, Im) -> + erlang:apply(egd_primitives, Function, [Im|Arguments]) + end, Im0, + [{Fs, [get_point(), get_point(), Bgc]} || Fs <- [line, rectangle, filledEllipse, arc]] ++ + [{pixel, [get_point(), Bgc]}, + {filledTriangle, [get_point(), get_point(), get_point(), Bgc]}]), Pt1 = get_point(), Pt2 = get_point(), - ?line Im2 = egd_primitives:filledRectangle(Im1, Pt1, Pt2, Fgc), + Im2 = egd_primitives:filledRectangle(Im1, Pt1, Pt2, Fgc), - ?line Bitmap = egd_render:binary(Im2, opaque), + Bitmap = egd_render:binary(Im2, opaque), - ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc), - ?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc), + ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc), + ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc), - ?line <<_/binary>> = egd_render:binary(Im2, alpha), + <<_/binary>> = egd_render:binary(Im2, alpha), erase(image_size), ok. - - - -image_font(suite) -> - []; -image_font(doc) -> - ["Image font test."]; +%% Image font test. image_font(Config) when is_list(Config) -> - {W,H} = get_size(?config(max_size, Config)), + {W,H} = get_size(proplists:get_value(max_size, Config)), put(image_size, {W,H}), - ?line Im = egd:create(W, H), - ?line Fgc = egd:color({0,130,0}), - - ?line Filename = filename:join([code:priv_dir(percept),"fonts","6x11_latin1.wingsfont"]), - ?line Font = egd_font:load(Filename), - + Im = egd:create(W, H), + Fgc = egd:color({0,130,0}), + + Filename = filename:join([code:priv_dir(percept),"fonts","6x11_latin1.wingsfont"]), + Font = egd_font:load(Filename), + % simple text - ?line ok = egd:text(Im, get_point(), Font, "Hello World", Fgc), - ?line <<_/binary>> = egd:render(Im, png), - + ok = egd:text(Im, get_point(), Font, "Hello World", Fgc), + <<_/binary>> = egd:render(Im, png), + GlyphStr1 = " !\"#$%&'()*+,-./", % Codes 32 -> 47 NumericStr = "0123456789", % Codes 48 -> 57 GlyphStr2 = ":;<=>?@", % Codes 58 -> 64 @@ -219,62 +184,59 @@ image_font(Config) when is_list(Config) -> AlphaSmStr = "abcdefghijklmnopqrstuvwxyz", % Codes 97 -> 122 GlyphStr4 = "{|}~", % Codes 123 -> 126 - ?line ok = egd:text(Im, get_point(), Font, GlyphStr1, Fgc), - ?line <<_/binary>> = egd:render(Im, png), + ok = egd:text(Im, get_point(), Font, GlyphStr1, Fgc), + <<_/binary>> = egd:render(Im, png), + + ok = egd:text(Im, get_point(), Font, NumericStr, Fgc), + <<_/binary>> = egd:render(Im, png), + + ok = egd:text(Im, get_point(), Font, GlyphStr2, Fgc), + <<_/binary>> = egd:render(Im, png), + + ok = egd:text(Im, get_point(), Font, AlphaBigStr, Fgc), + <<_/binary>> = egd:render(Im, png), - ?line ok = egd:text(Im, get_point(), Font, NumericStr, Fgc), - ?line <<_/binary>> = egd:render(Im, png), - - ?line ok = egd:text(Im, get_point(), Font, GlyphStr2, Fgc), - ?line <<_/binary>> = egd:render(Im, png), + ok = egd:text(Im, get_point(), Font, GlyphStr3, Fgc), + <<_/binary>> = egd:render(Im, png), - ?line ok = egd:text(Im, get_point(), Font, AlphaBigStr, Fgc), - ?line <<_/binary>> = egd:render(Im, png), - - ?line ok = egd:text(Im, get_point(), Font, GlyphStr3, Fgc), - ?line <<_/binary>> = egd:render(Im, png), + ok = egd:text(Im, get_point(), Font, AlphaSmStr, Fgc), + <<_/binary>> = egd:render(Im, png), - ?line ok = egd:text(Im, get_point(), Font, AlphaSmStr, Fgc), - ?line <<_/binary>> = egd:render(Im, png), - - ?line ok = egd:text(Im, get_point(), Font, GlyphStr4, Fgc), - ?line <<_/binary>> = egd:render(Im, png), + ok = egd:text(Im, get_point(), Font, GlyphStr4, Fgc), + <<_/binary>> = egd:render(Im, png), - ?line ok = egd:destroy(Im), + ok = egd:destroy(Im), erase(image_size), ok. -image_png_compliant(suite) -> - []; -image_png_compliant(doc) -> - ["Image png compliant test."]; +%% Image png compliant test. image_png_compliant(Config) when is_list(Config) -> - {W,H} = get_size(?config(max_size, Config)), + {W,H} = get_size(proplists:get_value(max_size, Config)), put(image_size, {W,H}), - ?line Im = egd:create(W, H), - ?line Fgc = egd:color({0,0,0}), - ?line ok = egd:filledRectangle(Im, get_point(), get_point(), Fgc), - - ?line Bin = egd:render(Im, png), - ?line true = binary_is_png_compliant(Bin), - - ?line ok = egd:destroy(Im), + Im = egd:create(W, H), + Fgc = egd:color({0,0,0}), + ok = egd:filledRectangle(Im, get_point(), get_point(), Fgc), + + Bin = egd:render(Im, png), + true = binary_is_png_compliant(Bin), + + ok = egd:destroy(Im), erase(image_size), ok. %%---------------------------------------------------------------------- %% Auxiliary tests %%---------------------------------------------------------------------- - + bitmap_point_has_color(Bitmap, {W,_}, {X,Y}, C) -> {CR,CG,CB,_} = egd_primitives:rgb_float2byte(C), N = W*Y*3 + X*3, << _:N/binary, R,G,B, _/binary>> = Bitmap, case {R,G,B} of - {CR,CG,CB} -> ok; - Other -> - io:format("bitmap_point_has_color: error color was ~p, should be ~p~n", [Other, {CR,CG,CB}]), - {error, {Other,{CR,CG,CB}}} + {CR,CG,CB} -> ok; + Other -> + io:format("bitmap_point_has_color: error color was ~p, should be ~p~n", [Other, {CR,CG,CB}]), + {error, {Other,{CR,CG,CB}}} end. %% jfif header by specification @@ -283,35 +245,35 @@ bitmap_point_has_color(Bitmap, {W,_}, {X,Y}, C) -> %% 2 bytes, version, (major, minor) %% 1 byte , units %% However, JFIF seems to start at 6 (7 with 1-index)? - + binary_is_jfif_compliant(JpegBin) -> - ?line {Bin, _} = split_binary(JpegBin, 11), + {Bin, _} = split_binary(JpegBin, 11), List = binary_to_list(Bin), case lists:sublist(List, 7, 4) of - "JFIF" -> true; - Other -> - io:format("img -> ~p~n", [Other]), - false + "JFIF" -> true; + Other -> + io:format("img -> ~p~n", [Other]), + false end. binary_is_gif_compliant(GifBin) -> - ?line {Bin, _} = split_binary(GifBin, 10), + {Bin, _} = split_binary(GifBin, 10), List = binary_to_list(Bin), case lists:sublist(List, 1,5) of - "GIF87" -> true; - Other -> - io:format("img -> ~p~n", [Other]), - false + "GIF87" -> true; + Other -> + io:format("img -> ~p~n", [Other]), + false end. binary_is_png_compliant(PngBin) -> - ?line {Bin, _} = split_binary(PngBin, 10), + {Bin, _} = split_binary(PngBin, 10), List = binary_to_list(Bin), case lists:sublist(List, 2,3) of - "PNG" -> true; - Other -> - io:format("img -> ~p~n", [Other]), - false + "PNG" -> true; + Other -> + io:format("img -> ~p~n", [Other]), + false end. %%---------------------------------------------------------------------- @@ -320,20 +282,20 @@ binary_is_png_compliant(PngBin) -> get_rgb() -> - R = random(255), - G = random(255), - B = random(255), - {R,G,B}. + R = random(255), + G = random(255), + B = random(255), + {R,G,B}. get_angle() -> - random(359). + random(359). get_point() -> get_point(get(image_size)). get_point({W,H}) -> - X = random(W - 1), - Y = random(H - 1), - {X,Y}. + X = random(W - 1), + Y = random(H - 1), + {X,Y}. get_size(Max) -> W = trunc(random(Max/2) + Max/2 + 1), @@ -344,7 +306,7 @@ get_size(Max) -> get_points(N) -> get_points(N, []). get_points(0, Out) -> - Out; + Out; get_points(N, Out) -> get_points(N - 1, [get_point() | Out]). diff --git a/lib/percept/test/ipc_tree.erl b/lib/percept/test/ipc_tree.erl index ff1c8d49c1..29da20e83f 100644 --- a/lib/percept/test/ipc_tree.erl +++ b/lib/percept/test/ipc_tree.erl @@ -46,4 +46,4 @@ gather([]) -> ok; gather([_|Pids]) -> receive _ -> gather(Pids) end. workload(0) -> ok; -workload(N) -> math:sin(2), workload(N - 1). +workload(N) -> _ = math:sin(2), workload(N - 1). diff --git a/lib/percept/test/percept_SUITE.erl b/lib/percept/test/percept_SUITE.erl index 06d62630ba..141035c631 100644 --- a/lib/percept/test/percept_SUITE.erl +++ b/lib/percept/test/percept_SUITE.erl @@ -22,51 +22,23 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/0, suite/0,groups/0,init_per_group/2,end_per_group/2]). --export([init_per_suite/1, end_per_suite/1]). --export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0]). %% Test cases --export([ - app/1, - appup/1, - profile/1, - analyze/1, - analyze_dist/1, - webserver/1 - ]). - -%% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(2)). - -init_per_suite(Config) when is_list(Config) -> - Config. - -end_per_suite(Config) when is_list(Config) -> - Config. - -init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{max_size, 300}, {watchdog,Dog} | Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. +-export([app/1, + appup/1, + profile/1, + analyze/1, + analyze_dist/1, + webserver/1]). -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap, {minutes, 2}}]. all() -> - [app, appup, webserver, profile, analyze, analyze_dist]. - -groups() -> - []. - -init_per_group(_GroupName, Config) -> - Config. - -end_per_group(_GroupName, Config) -> - Config. + [app, appup, webserver, profile, + analyze, analyze_dist]. %%---------------------------------------------------------------------- @@ -75,70 +47,56 @@ end_per_group(_GroupName, Config) -> %% Test that the percept app file is ok app(Config) when is_list(Config) -> - ok = ?t:app_test(percept). + ok = test_server:app_test(percept). %% Test that the percept appup file is ok appup(Config) when is_list(Config) -> - ok = ?t:appup_test(percept). + ok = test_server:appup_test(percept). -webserver(suite) -> - []; -webserver(doc) -> - ["Percept webserver test."]; +%% Percept webserver test. webserver(Config) when is_list(Config) -> % Explicit start inets? - ?line {started, _, Port} = percept:start_webserver(), - ?line ok = percept:stop_webserver(Port), - ?line {started, _, _} = percept:start_webserver(), - ?line ok = percept:stop_webserver(), - ?line {started, _, NewPort} = percept:start_webserver(), - ?line ok = percept:stop_webserver(NewPort), - ?line application:stop(inets), + {started, _, Port} = percept:start_webserver(), + ok = percept:stop_webserver(Port), + {started, _, _} = percept:start_webserver(), + ok = percept:stop_webserver(), + {started, _, NewPort} = percept:start_webserver(), + ok = percept:stop_webserver(NewPort), + application:stop(inets), ok. -profile(suite) -> - []; -profile(doc) -> - ["Percept profile test."]; +%% Percept profile test. profile(Config) when is_list(Config) -> - Path = ?config(data_dir, Config), + Path = proplists:get_value(data_dir, Config), File = filename:join([Path,"profile_test.dat"]), - ?line {ok, _} = percept:profile(File, [procs]), + {ok, _} = percept:profile(File, [procs]), ipc_tree:go(7), - ?line ok = percept:stop_profile(), + ok = percept:stop_profile(), ok. -analyze(suite) -> - []; -analyze(doc) -> - ["Percept analyze test."]; +%% Percept analyze test. analyze(Config) when is_list(Config) -> Begin = processes(), - Path = ?config(data_dir, Config), + Path = proplists:get_value(data_dir, Config), File = filename:join([Path,"profile_test.dat"]), - T0 = erlang:now(), - ?line ok = percept:analyze(File), - T1 = erlang:now(), - Secs = timer:now_diff(T1,T0)/1000000, - io:format("percept:analyze/1 took ~.2f s.~n", [Secs]), - ?line {stopped, _} = percept_db:stop(), + T0 = erlang:monotonic_time(milli_seconds), + ok = percept:analyze(File), + T1 = erlang:monotonic_time(milli_seconds), + io:format("percept:analyze/1 took ~w ms.~n", [T1 - T0]), + {stopped, _} = percept_db:stop(), print_remainers(remainers(Begin, processes())), ok. -analyze_dist(suite) -> - []; -analyze_dist(doc) -> - ["Percept analyze distribution test."]; +%% Percept analyze distribution test. analyze_dist(Config) when is_list(Config) -> Begin = processes(), - Path = ?config(data_dir, Config), + Path = proplists:get_value(data_dir, Config), File = filename:join([Path,"ipc-dist.dat"]), - T0 = erlang:now(), - ?line ok = percept:analyze(File), - T1 = erlang:now(), - Secs = timer:now_diff(T1,T0)/1000000, - io:format("percept:analyze/1 took ~.2f s.~n", [Secs]), - ?line {stopped, _} = percept_db:stop(), + T0 = erlang:monotonic_time(milli_seconds), + ok = percept:analyze(File), + T1 = erlang:monotonic_time(milli_seconds), + io:format("percept:analyze/1 took ~w ms.~n", [T1 - T0]), + {stopped, _} = percept_db:stop(), print_remainers(remainers(Begin, processes())), ok. @@ -166,9 +124,3 @@ remainers(Begin, [Pid|End], Out) -> true -> remainers(Begin, End, Out); false -> remainers(Begin, End, [Pid|Out]) end. - - - - - - diff --git a/lib/percept/test/percept_db_SUITE.erl b/lib/percept/test/percept_db_SUITE.erl index 5b878e8462..c1d711060c 100644 --- a/lib/percept/test/percept_db_SUITE.erl +++ b/lib/percept/test/percept_db_SUITE.erl @@ -22,54 +22,32 @@ -include_lib("common_test/include/ct.hrl"). %% Test server specific exports --export([all/1]). --export([init_per_suite/1, end_per_suite/1]). --export([init_per_testcase/2, end_per_testcase/2]). +-export([all/0, suite/0]). %% Test cases --export([ - start/1 - ]). +-export([start/1]). %% Default timetrap timeout (set in init_per_testcase) --define(default_timeout, ?t:minutes(2)). -define(restarts, 10). -define(alive_timeout, 500). -init_per_suite(Config) when is_list(Config) -> - Config. +suite() -> + [{timetrap, {minutes, 2}}]. -end_per_suite(Config) when is_list(Config) -> - Config. - -init_per_testcase(_Case, Config) -> - Dog = ?t:timetrap(?default_timeout), - [{max_size, 300}, {watchdog,Dog} | Config]. - -end_per_testcase(_Case, Config) -> - Dog = ?config(watchdog, Config), - ?t:timetrap_cancel(Dog), - ok. - -all(suite) -> - % Test cases +all() -> [start]. %%---------------------------------------------------------------------- %% Tests %%---------------------------------------------------------------------- -start(suite) -> - []; -start(doc) -> - ["Percept_db start and restart test."]; +%% Percept_db start and restart test. start(Config) when is_list(Config) -> ok = restart(?restarts), {stopped, _DB} = percept_db:stop(), ok. -restart(0)-> - ok; +restart(0)-> ok; restart(N)-> {_, DB} = percept_db:start(), timer:sleep(?alive_timeout), diff --git a/lib/ssh/src/ssh_info.erl b/lib/ssh/src/ssh_info.erl index 4e6e25bc70..2dfc55cd92 100644 --- a/lib/ssh/src/ssh_info.erl +++ b/lib/ssh/src/ssh_info.erl @@ -25,7 +25,11 @@ -module(ssh_info). --compile(export_all). +-export([print/0, + print/1, + string/0, + collect_pids/0 + ]). print() -> print(user). @@ -34,55 +38,54 @@ print(D) -> try supervisor:which_children(ssh_sup) of _ -> - io:nl(D), + io__nl(D), print_general(D), - io:nl(D), + io__nl(D), underline(D, "Client part", $=), print_clients(D), - io:nl(D), + io__nl(D), underline(D, "Server part", $=), print_servers(D), - io:nl(D), - %% case os:type() of - %% {unix,_} -> - %% io:nl(), - %% underline("Linux part", $=), - %% underline("Listening"), - %% catch io:format(os:cmd("netstat -tpln")), - %% io:nl(), - %% underline("Other"), - %% catch io:format(os:cmd("netstat -tpn")); - %% _ -> ok - %% end, + io__nl(D), underline(D, "Supervisors", $=), walk_sups(D, ssh_sup), - io:nl(D) + io__nl(D) catch _:_ -> - io:format(D,"Ssh not found~n",[]) + io__format(D,"Ssh not found~n",[]) + end. + +string() -> + Pid = spawn(fun init/0), + print(Pid), + Pid ! {get,self()}, + receive + {result,R} -> R end. %%%================================================================ print_general(D) -> {_Name, Slogan, Ver} = lists:keyfind(ssh,1,application:which_applications()), underline(D, io_lib:format("~s ~s", [Slogan, Ver]), $=), - io:format(D, 'This printout is generated ~s. ~n',[datetime()]). + io__format(D, 'This printout is generated ~s. ~n',[datetime()]). %%%================================================================ +-define(INDENT, " "). + print_clients(D) -> PrintClient = fun(X) -> print_client(D,X) end, try lists:foreach(PrintClient, supervisor:which_children(sshc_sup)) catch C:E -> - io:format(D, '***FAILED: ~p:~p~n',[C,E]) + io__format(D, '***FAILED: ~p:~p~n',[C,E]) end. print_client(D, {undefined,Pid,supervisor,[ssh_connection_handler]}) -> {{Local,Remote},_Str} = ssh_connection_handler:get_print_info(Pid), - io:format(D, " Local=~s Remote=~s ConnectionRef=~p~n",[fmt_host_port(Local),fmt_host_port(Remote),Pid]); + io__format(D, ?INDENT"Local: ~s Remote: ~s ConnectionRef = ~p~n",[fmt_host_port(Local),fmt_host_port(Remote),Pid]); print_client(D, Other) -> - io:format(D, " [[Other 1: ~p]]~n",[Other]). + io__format(D, " [[Other 1: ~p]]~n",[Other]). %%%================================================================ @@ -92,51 +95,56 @@ print_servers(D) -> lists:foreach(PrintServer, supervisor:which_children(sshd_sup)) catch C:E -> - io:format(D, '***FAILED: ~p:~p~n',[C,E]) + io__format(D, '***FAILED: ~p:~p~n',[C,E]) end. -print_server(D, {{server,ssh_system_sup,LocalHost,LocalPort},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) -> - io:format(D, 'Local=~s (~p children)~n',[fmt_host_port({LocalHost,LocalPort}), - ssh_acceptor:number_of_connections(Pid)]), + +print_server(D, {{server,ssh_system_sup,LocalHost,LocalPort,Profile},Pid,supervisor,[ssh_system_sup]}) when is_pid(Pid) -> + io__format(D, ?INDENT"Listen: ~s (~p children) Profile ~p~n",[fmt_host_port({LocalHost,LocalPort}), + ssh_acceptor:number_of_connections(Pid), + Profile]), PrintSystemSup = fun(X) -> print_system_sup(D,X) end, - lists:foreach(PrintSystemSup, supervisor:which_children(Pid)); -print_server(D, Other) -> - io:format(D, " [[Other 2: ~p]]~n",[Other]). - + lists:foreach(PrintSystemSup, supervisor:which_children(Pid)). + + print_system_sup(D, {Ref,Pid,supervisor,[ssh_subsystem_sup]}) when is_reference(Ref), - is_pid(Pid) -> + is_pid(Pid) -> PrintChannels = fun(X) -> print_channels(D,X) end, lists:foreach(PrintChannels, supervisor:which_children(Pid)); -print_system_sup(D, {{ssh_acceptor_sup,LocalHost,LocalPort}, Pid,supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) -> - io:format(D, " [Acceptor for ~s]~n",[fmt_host_port({LocalHost,LocalPort})]); -print_system_sup(D, Other) -> - io:format(D, " [[Other 3: ~p]]~n",[Other]). +print_system_sup(D, {{ssh_acceptor_sup,_LocalHost,_LocalPort,_Profile}, Pid, supervisor, [ssh_acceptor_sup]}) when is_pid(Pid) -> + io__format(D, ?INDENT?INDENT"[Acceptor Pid ~p]~n",[Pid]). -print_channels(D, {{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) -> - PrintChannel = fun(X) -> print_channel(D,X) end, - lists:foreach(PrintChannel, supervisor:which_children(Pid)); -print_channels(D, Other) -> - io:format(D, " [[Other 4: ~p]]~n",[Other]). +print_channels(D, {{server,ssh_channel_sup,_,_},Pid,supervisor,[ssh_channel_sup]}) when is_pid(Pid) -> + Children = supervisor:which_children(Pid), + ChannelPids = [P || {R,P,worker,[ssh_channel]} <- Children, + is_pid(P), + is_reference(R)], + case ChannelPids of + [] -> io__format(D, ?INDENT?INDENT"No channels~n",[]); + [Ch1Pid|_] -> + {{ConnManager,_}, _Str} = ssh_channel:get_print_info(Ch1Pid), + {{_,Remote},_} = ssh_connection_handler:get_print_info(ConnManager), + io__format(D, ?INDENT?INDENT"Remote: ~s ConnectionRef = ~p~n",[fmt_host_port(Remote),ConnManager]), + lists:foreach(fun(P) -> print_ch(D,P) end, ChannelPids) + end; +print_channels(_D, {{server,ssh_connection_sup,_,_},Pid,supervisor,[ssh_connection_sup]}) when is_pid(Pid) -> + ok. % The supervisor of the connections socket owning process -print_channel(D, {Ref,Pid,worker,[ssh_channel]}) when is_reference(Ref), - is_pid(Pid) -> +print_ch(D, Pid) -> {{ConnManager,ChannelID}, Str} = ssh_channel:get_print_info(Pid), - {{Local,Remote},StrM} = ssh_connection_handler:get_print_info(ConnManager), - io:format(D, ' ch ~p: ~s ~s',[ChannelID, StrM, Str]), - io:format(D, " Local=~s Remote=~s~n",[fmt_host_port(Local),fmt_host_port(Remote)]); -print_channel(D, Other) -> - io:format(D, " [[Other 5: ~p]]~n",[Other]). - + {_LocalRemote,StrM} = ssh_connection_handler:get_print_info(ConnManager), + io__format(D, ?INDENT?INDENT?INDENT"ch ~p: ~s ~s~n",[ChannelID, StrM, Str]). + %%%================================================================ -define(inc(N), (N+4)). walk_sups(D, StartPid) -> - io:format(D, "Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]), + io__format(D, "Start at ~p, ~s.~n",[StartPid,dead_or_alive(StartPid)]), walk_sups(D, children(StartPid), _Indent=?inc(0)). walk_sups(D, [H={_,Pid,_,_}|T], Indent) -> - indent(D, Indent), io:format(D, '~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]), + indent(D, Indent), io__format(D, '~200p ~p is ~s~n',[H,Pid,dead_or_alive(Pid)]), case H of {_,_,supervisor,[ssh_connection_handler]} -> ok; {_,Pid,supervisor,_} -> walk_sups(D, children(Pid), ?inc(Indent)); @@ -159,7 +167,7 @@ dead_or_alive(Pid) when is_pid(Pid) -> _ -> "alive" end. -indent(D, I) -> io:format(D,'~*c',[I,$ ]). +indent(D, I) -> io__format(D,'~*c',[I,$ ]). children(Pid) -> Parent = self(), @@ -176,16 +184,13 @@ children(Pid) -> end. %%%================================================================ -underline(D, Str) -> - underline(D, Str, $-). - underline(D, Str, LineChar) -> Len = lists:flatlength(Str), - io:format(D, '~s~n',[Str]), + io__format(D, '~s~n',[Str]), line(D,Len,LineChar). line(D, Len, Char) -> - io:format(D, '~*c~n', [Len,Char]). + io__format(D, '~*c~n', [Len,Char]). datetime() -> @@ -196,8 +201,78 @@ datetime() -> fmt_host_port({{A,B,C,D},Port}) -> io_lib:format('~p.~p.~p.~p:~p',[A,B,C,D,Port]); fmt_host_port({Host,Port}) -> io_lib:format('~s:~p',[Host,Port]). +%%%################################################################ + +io__nl(D) when is_atom(D) -> io:nl(D); +io__nl(P) when is_pid(P) -> P ! {string,io_lib:nl()}. + +io__format(D, Fmt, Args) when is_atom(D) -> io:format(D, Fmt, Args); +io__format(P, Fmt, Args) when is_pid(P) -> P ! {string,io_lib:format(Fmt, Args)}. + + +init() -> loop([]). +loop(Acc) -> + receive + {string,Str} -> + loop([Str|Acc]); + {get,Who} -> + Who ! {result,lists:flatten(lists:reverse(Acc))} + end. + +%%%################################################################ +collect_pids() -> collect_pids(ssh_sup). + +collect_pids(P) -> + Collector = pcollect_pids(P, spawn(fun init_collector/0)), + Collector ! {get_values,self()}, + receive + {values,Values} -> + Values + end. + +%%%---------------- +pcollect_pids(undefined, Collector) -> + Collector; + +pcollect_pids(A, Collector) when is_atom(A) -> + pcollect_pids(whereis(A), Collector); + +pcollect_pids(Pid, Collector) when is_pid(Pid) -> + Collector ! {expect,Pid}, + spawn(fun() -> + lists:foreach( + fun(P2) -> + pcollect_pids(P2,Collector) + end, children(Pid)), + Collector ! {value,Pid,Pid} + end), + Collector; + +pcollect_pids({_,Pid,supervisor,_}, Collector) when is_pid(Pid) -> + pcollect_pids(Pid, Collector); + +pcollect_pids({_,Pid,worker,_}, Collector) when is_pid(Pid) -> + Collector ! {value,Pid,Pid}, + Collector; + +pcollect_pids(_, Collector) -> + Collector. + +%%%---------------- +init_collector() -> + loop_collector([],[]). + +loop_collector(Expects, Values) -> + receive + {expect, Ref} -> + loop_collector([Ref|Expects], Values); + {value, Ref, Val} -> + loop_collector(Expects--[Ref], [Val|Values]); + {get_values, From} when Expects==[] -> +%% Values=/=[] -> + From ! {values,Values} + end. + + -nyi(D) -> - io:format(D,'Not yet implemented~n',[]), - nyi. diff --git a/lib/ssh/test/ssh_algorithms_SUITE.erl b/lib/ssh/test/ssh_algorithms_SUITE.erl index 49ed15698c..256c8c8da3 100644 --- a/lib/ssh/test/ssh_algorithms_SUITE.erl +++ b/lib/ssh/test/ssh_algorithms_SUITE.erl @@ -36,7 +36,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,10}}]. + {timetrap,{seconds,40}}]. all() -> %% [{group,kex},{group,cipher}... etc @@ -191,6 +191,9 @@ simple_exec_groups_no_match_too_large(Config) -> %%-------------------------------------------------------------------- %% Testing all default groups + +simple_exec_groups() -> [{timetrap,{seconds,90}}]. + simple_exec_groups(Config) -> Sizes = interpolate( public_key:dh_gex_group_sizes() ), lists:foreach( @@ -217,6 +220,9 @@ interpolate(Is) -> %%-------------------------------------------------------------------- %% Use the ssh client of the OS to connect + +sshc_simple_exec() -> [{timetrap,{seconds,90}}]. + sshc_simple_exec(Config) -> PrivDir = ?config(priv_dir, Config), KnownHosts = filename:join(PrivDir, "known_hosts"), diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl index 094d28e879..18a05c0fb8 100644 --- a/lib/ssh/test/ssh_basic_SUITE.erl +++ b/lib/ssh/test/ssh_basic_SUITE.erl @@ -79,7 +79,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,10}}]. + {timetrap,{seconds,40}}]. all() -> [app_test, diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl index 6e90faf0e8..a1fbe28a83 100644 --- a/lib/ssh/test/ssh_connection_SUITE.erl +++ b/lib/ssh/test/ssh_connection_SUITE.erl @@ -37,7 +37,7 @@ %% [{ct_hooks,[ts_install_cth]}]. suite() -> - [{timetrap,{minutes,2}}]. + [{timetrap,{seconds,40}}]. all() -> [ @@ -314,11 +314,7 @@ ptty_alloc_pixel(Config) when is_list(Config) -> ssh:close(ConnectionRef). %%-------------------------------------------------------------------- - -interrupted_send() -> - [{doc, "Use a subsystem that echos n char and then sends eof to cause a channel exit partway through a large send."}]. - -interrupted_send(Config) when is_list(Config) -> +interrupted_send(Config) -> PrivDir = ?config(priv_dir, Config), UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth file:make_dir(UserDir), diff --git a/lib/ssh/test/ssh_options_SUITE.erl b/lib/ssh/test/ssh_options_SUITE.erl index ba0107efd6..22a311df3c 100644 --- a/lib/ssh/test/ssh_options_SUITE.erl +++ b/lib/ssh/test/ssh_options_SUITE.erl @@ -51,8 +51,10 @@ ssh_connect_arg4_timeout/1, ssh_connect_negtimeout_parallel/1, ssh_connect_negtimeout_sequential/1, - ssh_connect_nonegtimeout_connected_parallel/1, - ssh_connect_nonegtimeout_connected_sequential/1, + ssh_connect_nonegtimeout_connected_parallel/0, + ssh_connect_nonegtimeout_connected_parallel/1, + ssh_connect_nonegtimeout_connected_sequential/0, + ssh_connect_nonegtimeout_connected_sequential/1, ssh_connect_timeout/1, connect/4, ssh_daemon_minimal_remote_max_packet_size_option/1, ssh_msg_debug_fun_option_client/1, @@ -80,7 +82,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,6}}]. + {timetrap,{seconds,40}}]. all() -> [connectfun_disconnectfun_server, @@ -980,10 +982,16 @@ ssh_connect_negtimeout(Config, Parallel) -> %%-------------------------------------------------------------------- %%% Test that ssh connection does not timeout if the connection is established (parallel) + +ssh_connect_nonegtimeout_connected_parallel() -> [{timetrap,{seconds,90}}]. + ssh_connect_nonegtimeout_connected_parallel(Config) -> ssh_connect_nonegtimeout_connected(Config, true). %%% Test that ssh connection does not timeout if the connection is established (non-parallel) + +ssh_connect_nonegtimeout_connected_sequential() -> [{timetrap,{seconds,90}}]. + ssh_connect_nonegtimeout_connected_sequential(Config) -> ssh_connect_nonegtimeout_connected(Config, false). diff --git a/lib/ssh/test/ssh_protocol_SUITE.erl b/lib/ssh/test/ssh_protocol_SUITE.erl index dbba48c726..eea71038aa 100644 --- a/lib/ssh/test/ssh_protocol_SUITE.erl +++ b/lib/ssh/test/ssh_protocol_SUITE.erl @@ -43,7 +43,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,2}}]. + {timetrap,{seconds,40}}]. all() -> [{group,tool_tests}, diff --git a/lib/ssh/test/ssh_renegotiate_SUITE.erl b/lib/ssh/test/ssh_renegotiate_SUITE.erl index 6d2c97aa68..abbe57796f 100644 --- a/lib/ssh/test/ssh_renegotiate_SUITE.erl +++ b/lib/ssh/test/ssh_renegotiate_SUITE.erl @@ -31,7 +31,7 @@ %%-------------------------------------------------------------------- suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,12}}]. + {timetrap,{seconds,40}}]. all() -> [{group,default_algs}, @@ -83,7 +83,8 @@ end_per_testcase(_TestCase, _Config) -> %%-------------------------------------------------------------------- %%% Idle timeout test - +rekey() -> [{timetrap,{seconds,90}}]. + rekey(Config) -> {Pid, Host, Port} = ssh_test_lib:std_daemon(Config, @@ -105,6 +106,8 @@ rekey(Config) -> %%% Test rekeying by data volume +rekey_limit() -> [{timetrap,{seconds,400}}]. + rekey_limit(Config) -> UserDir = ?config(priv_dir, Config), DataFile = filename:join(UserDir, "rekey.data"), diff --git a/lib/ssh/test/ssh_sftp_SUITE.erl b/lib/ssh/test/ssh_sftp_SUITE.erl index c2b04d7a05..76ba78b728 100644 --- a/lib/ssh/test/ssh_sftp_SUITE.erl +++ b/lib/ssh/test/ssh_sftp_SUITE.erl @@ -36,7 +36,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,2}}]. + {timetrap,{seconds,40}}]. all() -> diff --git a/lib/ssh/test/ssh_sftpd_SUITE.erl b/lib/ssh/test/ssh_sftpd_SUITE.erl index 45439ce0fa..57b93a5f36 100644 --- a/lib/ssh/test/ssh_sftpd_SUITE.erl +++ b/lib/ssh/test/ssh_sftpd_SUITE.erl @@ -45,7 +45,7 @@ %%-------------------------------------------------------------------- suite() -> - [{timetrap,{minutes,3}}]. + [{timetrap,{seconds,40}}]. all() -> [open_close_file, diff --git a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl index 02a2ac4cf9..4c3c2dcd5a 100644 --- a/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl +++ b/lib/ssh/test/ssh_sftpd_erlclient_SUITE.erl @@ -37,7 +37,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,2}}]. + {timetrap,{seconds,40}}]. all() -> diff --git a/lib/ssh/test/ssh_sup_SUITE.erl b/lib/ssh/test/ssh_sup_SUITE.erl index 18e91a9af3..cbbd7d4d76 100644 --- a/lib/ssh/test/ssh_sup_SUITE.erl +++ b/lib/ssh/test/ssh_sup_SUITE.erl @@ -36,7 +36,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}, - {timetrap,{minutes,1}}]. + {timetrap,{seconds,40}}]. all() -> [default_tree, sshc_subtree, sshd_subtree, sshd_subtree_profile]. diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl index 2788bc6b58..80f8607f65 100644 --- a/lib/ssh/test/ssh_to_openssh_SUITE.erl +++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl @@ -34,7 +34,7 @@ %%-------------------------------------------------------------------- suite() -> - [{timetrap,{minutes,1}}]. + [{timetrap,{seconds,40}}]. all() -> case os:find_executable("ssh") of diff --git a/lib/ssh/test/ssh_upgrade_SUITE.erl b/lib/ssh/test/ssh_upgrade_SUITE.erl index bf8874b118..20df865b55 100644 --- a/lib/ssh/test/ssh_upgrade_SUITE.erl +++ b/lib/ssh/test/ssh_upgrade_SUITE.erl @@ -39,7 +39,7 @@ %%% CommonTest callbacks %%% suite() -> - [{timetrap,{minutes,2}}]. + [{timetrap,{seconds,180}}]. all() -> [ |