diff options
Diffstat (limited to 'lib/erl_interface/test/all_SUITE_data')
-rw-r--r-- | lib/erl_interface/test/all_SUITE_data/ei_runner.c | 19 | ||||
-rw-r--r-- | lib/erl_interface/test/all_SUITE_data/ei_runner.h | 3 | ||||
-rw-r--r-- | lib/erl_interface/test/all_SUITE_data/runner.c | 8 |
3 files changed, 18 insertions, 12 deletions
diff --git a/lib/erl_interface/test/all_SUITE_data/ei_runner.c b/lib/erl_interface/test/all_SUITE_data/ei_runner.c index 92d01f1753..cd7a67c57c 100644 --- a/lib/erl_interface/test/all_SUITE_data/ei_runner.c +++ b/lib/erl_interface/test/all_SUITE_data/ei_runner.c @@ -198,8 +198,8 @@ void free_packet(char* packet) * ----- ---------------------------- * [$b|Bytes] {bytes, Bytes} * [$e] eot - * [$f] test_server:fail() - * [$f|Reason] test_server:fail(Reason) + * [$f] ct:fail() + * [$f|Reason] ct:fail(Reason) * [$t|EncodedTerm] {term, Term} * [$N] 'NULL' * [$m|Message] io:format("~s", [Message]) (otherwise ignored) @@ -211,7 +211,7 @@ void free_packet(char* packet) * you implement a test case entirely in C code. * * If the ok argument is zero, a [$f] reply will be sent to the - * Erlang side (causing test_server:fail() to be called); otherwise, + * Erlang side (causing ct:fail() to be called); otherwise, * the atom 'eot' will be sent to Erlang. * * If you need to provide more details on a failure, use the fail() function. @@ -251,16 +251,21 @@ do_report(file, line, ok) /* - * This function causes a call to test_server:fail(Reason) on the + * This function causes a call to ct:fail(Reason) on the * Erlang side. */ -void do_fail(char* file, int line, char* reason) +void do_fail(const char* file, int line, const char* reason, ...) { + va_list ap; char sbuf[2048]; + char* sp = sbuf; - sbuf[0] = 'f'; - sprintf(sbuf+1, "%s, line %d: %s", file, line, reason); + *sp++ = 'f'; + sp += sprintf(sp, "%s, line %d: ", file, line); + va_start(ap, reason); + sp += vsprintf(sp, reason, ap); + va_end(ap); reply(sbuf, 1+strlen(sbuf+1)); } diff --git a/lib/erl_interface/test/all_SUITE_data/ei_runner.h b/lib/erl_interface/test/all_SUITE_data/ei_runner.h index 875b8255b9..2608661303 100644 --- a/lib/erl_interface/test/all_SUITE_data/ei_runner.h +++ b/lib/erl_interface/test/all_SUITE_data/ei_runner.h @@ -52,10 +52,11 @@ void free_packet(char*); */ #define fail(reason) do_fail(__FILE__, __LINE__, reason) +#define fail1(reason, a1) do_fail(__FILE__, __LINE__, reason, a1) #define report(ok) do_report(__FILE__, __LINE__, ok) void do_report(char* file, int line, int ok); -void do_fail(char* file, int line, char* reason); +void do_fail(const char* file, int line, const char* reason, ...); void send_buffer(char* buf, int size); void message(char* format, ...); diff --git a/lib/erl_interface/test/all_SUITE_data/runner.c b/lib/erl_interface/test/all_SUITE_data/runner.c index 0c199953d1..42e8bb03e5 100644 --- a/lib/erl_interface/test/all_SUITE_data/runner.c +++ b/lib/erl_interface/test/all_SUITE_data/runner.c @@ -200,8 +200,8 @@ char *read_packet(int *len) * ----- ---------------------------- * [$b|Bytes] {bytes, Bytes} * [$e] eot - * [$f] test_server:fail() - * [$f|Reason] test_server:fail(Reason) + * [$f] ct:fail() + * [$f|Reason] ct:fail(Reason) * [$t|EncodedTerm] {term, Term} * [$N] 'NULL' * [$m|Message] io:format("~s", [Message]) (otherwise ignored) @@ -213,7 +213,7 @@ char *read_packet(int *len) * you implement a test case entirely in C code. * * If the ok argument is zero, a [$f] reply will be sent to the - * Erlang side (causing test_server:fail() to be called); otherwise, + * Erlang side (causing ct:fail() to be called); otherwise, * the atom 'eot' will be sent to Erlang. * * If you need to provide more details on a failure, use the fail() function. @@ -253,7 +253,7 @@ do_report(file, line, ok) /* - * This function causes a call to test_server:fail(Reason) on the + * This function causes a call to ct:fail(Reason) on the * Erlang side. */ |