forked from cory/tildefriends
Make the tests not do the imports all the time.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4844 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
8d82e80639
commit
c8812b1add
15
src/main.c
15
src/main.c
@ -308,13 +308,16 @@ static int _tf_run_task(const tf_run_args_t* args, int index)
|
||||
tf_task_activate(task);
|
||||
tf_ssb_set_verbose(tf_task_get_ssb(task), args->verbose);
|
||||
tf_ssb_start_periodic(tf_task_get_ssb(task));
|
||||
if (args->zip)
|
||||
if (args->http_port || args->https_port)
|
||||
{
|
||||
tf_ssb_import_from_zip(tf_task_get_ssb(task), args->zip, "core", "apps");
|
||||
}
|
||||
else
|
||||
{
|
||||
tf_ssb_import(tf_task_get_ssb(task), "core", "apps");
|
||||
if (args->zip)
|
||||
{
|
||||
tf_ssb_import_from_zip(tf_task_get_ssb(task), args->zip, "core", "apps");
|
||||
}
|
||||
else
|
||||
{
|
||||
tf_ssb_import(tf_task_get_ssb(task), "core", "apps");
|
||||
}
|
||||
}
|
||||
if (tf_task_execute(task, args->script))
|
||||
{
|
||||
|
38
src/tests.c
38
src/tests.c
@ -29,6 +29,8 @@
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
#define TEST_ARGS " --ssb-port=0 --http-port=0 --https-port=0"
|
||||
|
||||
#if !TARGET_OS_IPHONE
|
||||
static void _write_file(const char* path, const char* contents)
|
||||
{
|
||||
@ -48,7 +50,7 @@ static void _test_nop(const tf_test_options_t* options)
|
||||
_write_file("out/test.js", "print('hi');");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
@ -77,7 +79,7 @@ static void _test_child(const tf_test_options_t* options)
|
||||
"exit(0);\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
@ -116,7 +118,7 @@ static void _test_promise(const tf_test_options_t* options)
|
||||
"}\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
@ -160,7 +162,7 @@ static void _test_promise_remote_throw(const tf_test_options_t* options)
|
||||
"}\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
@ -206,7 +208,7 @@ static void _test_promise_remote_reject(const tf_test_options_t* options)
|
||||
"}\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
@ -250,7 +252,7 @@ static void _test_database(const tf_test_options_t* options)
|
||||
|
||||
char command[256];
|
||||
unlink("out/test_db0.sqlite");
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=out/test_db0.sqlite -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=out/test_db0.sqlite -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -270,7 +272,7 @@ static void _test_this(const tf_test_options_t* options)
|
||||
"exit(0);\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -301,7 +303,7 @@ static void _test_await(const tf_test_options_t* options)
|
||||
"\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -334,14 +336,14 @@ static void _test_import(const tf_test_options_t* options)
|
||||
"}\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
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);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/bad.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -359,7 +361,7 @@ static void _test_exit(const tf_test_options_t* options)
|
||||
_write_file("out/blah.js", "\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -378,7 +380,7 @@ static void _test_icu(const tf_test_options_t* options)
|
||||
"print(parseInt('3').toLocaleString());\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -428,7 +430,7 @@ static void _test_uint8array(const tf_test_options_t* options)
|
||||
"}\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -472,7 +474,7 @@ static void _test_float(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);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
(void)result;
|
||||
@ -560,7 +562,7 @@ static void _test_socket(const tf_test_options_t* options)
|
||||
"});\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -588,7 +590,7 @@ static void _test_file(const tf_test_options_t* options)
|
||||
"});\n");
|
||||
|
||||
char command[256];
|
||||
snprintf(command, sizeof(command), "%s run --ssb-port=0 --db-path=:memory: -s out/test.js", options->exe_path);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -619,7 +621,7 @@ 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);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
@ -643,7 +645,7 @@ 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);
|
||||
snprintf(command, sizeof(command), "%s run --db-path=:memory: -s out/test.js" TEST_ARGS, options->exe_path);
|
||||
tf_printf("%s\n", command);
|
||||
int result = system(command);
|
||||
tf_printf("returned %d\n", WEXITSTATUS(result));
|
||||
|
Loading…
Reference in New Issue
Block a user