forked from cory/tildefriends
Replace all printfs with tf_printf, which redirects to android logging. Change into the files directory so that sqlite can do its thing. Getting closer.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4203 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
65
src/tests.c
65
src/tests.c
@ -1,5 +1,6 @@
|
||||
#include "tests.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "mem.h"
|
||||
#include "ssb.tests.h"
|
||||
|
||||
@ -23,7 +24,7 @@ static void _test_nop(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
assert(WIFEXITED(result));
|
||||
@ -54,7 +55,7 @@ static void _test_child(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
assert(WIFEXITED(result));
|
||||
@ -96,7 +97,7 @@ static void _test_promise(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
assert(WIFEXITED(result));
|
||||
@ -142,7 +143,7 @@ static void _test_promise_remote_throw(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
assert(WIFEXITED(result));
|
||||
@ -190,7 +191,7 @@ static void _test_promise_remote_reject(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
assert(WIFEXITED(result));
|
||||
@ -236,9 +237,9 @@ static void _test_database(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: --db-path=out/testdb.sqlite -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -257,9 +258,9 @@ static void _test_this(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -290,9 +291,9 @@ static void _test_await(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -326,16 +327,16 @@ static void _test_import(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/bad.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -356,9 +357,9 @@ static void _test_exit(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -376,9 +377,9 @@ static void _test_icu(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -428,9 +429,9 @@ static void _test_uint8array(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -517,9 +518,9 @@ static void _test_socket(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -576,9 +577,9 @@ static void _test_file(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -608,9 +609,9 @@ static void _test_sign(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -633,9 +634,9 @@ static void _test_b64(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
printf("%s\n", command);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
printf("returned %d\n", WEXITSTATUS(result));
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
assert(WIFEXITED(result));
|
||||
assert(WEXITSTATUS(result) == 0);
|
||||
|
||||
@ -667,9 +668,9 @@ static void _tf_test_run(const tf_test_options_t* options, const char* name, voi
|
||||
#define MAGENTA "\e[1;35m"
|
||||
#define CYAN "\e[1;36m"
|
||||
#define RESET "\e[0m"
|
||||
printf(CYAN "== running test " MAGENTA "%s" CYAN " ==\n" RESET, name);
|
||||
tf_printf(CYAN "== running test " MAGENTA "%s" CYAN " ==\n" RESET, name);
|
||||
test(options);
|
||||
printf("[" GREEN "pass" RESET "] %s\n", name);
|
||||
tf_printf("[" GREEN "pass" RESET "] %s\n", name);
|
||||
#undef GREEN
|
||||
#undef MAGENTA
|
||||
#undef CYAN
|
||||
@ -700,5 +701,5 @@ void tf_tests(const tf_test_options_t* options)
|
||||
_tf_test_run(options, "b64", _test_b64);
|
||||
_tf_test_run(options, "rooms", tf_ssb_test_rooms);
|
||||
_tf_test_run(options, "bench", tf_ssb_test_bench);
|
||||
printf("Tests completed.\n");
|
||||
tf_printf("Tests completed.\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user