From 1999612a69a7947fb1b6fc45705299fe6db650ba Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 20 Sep 2024 08:36:26 -0400 Subject: Refactor structure * Break delivery.c into smaller components --- src/delivery_test.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 src/delivery_test.c (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c new file mode 100644 index 0000000..beea510 --- /dev/null +++ b/src/delivery_test.c @@ -0,0 +1,244 @@ +#include "delivery.h" + +void delivery_tests_run(struct Delivery *ctx) { + struct MultiProcessingPool *pool_parallel; + struct MultiProcessingPool *pool_serial; + struct MultiProcessingPool *pool_setup; + struct Process proc; + memset(&proc, 0, sizeof(proc)); + + if (!globals.workaround.conda_reactivate) { + globals.workaround.conda_reactivate = calloc(PATH_MAX, sizeof(*globals.workaround.conda_reactivate)); + } else { + memset(globals.workaround.conda_reactivate, 0, PATH_MAX); + } + snprintf(globals.workaround.conda_reactivate, PATH_MAX - 1, "\nmamba activate ${CONDA_DEFAULT_ENV}\n"); + + if (!ctx->tests[0].name) { + msg(STASIS_MSG_WARN | STASIS_MSG_L2, "no tests are defined!\n"); + } else { + pool_parallel = mp_pool_init("parallel", ctx->storage.tmpdir); + if (!pool_parallel) { + perror("mp_pool_init/parallel"); + exit(1); + } + + pool_serial = mp_pool_init("serial", ctx->storage.tmpdir); + if (!pool_serial) { + perror("mp_pool_init/serial"); + exit(1); + } + + pool_setup = mp_pool_init("setup", ctx->storage.tmpdir); + if (!pool_setup) { + perror("mp_pool_init/setup"); + exit(1); + } + + const char *runner_cmd_fmt = "set -e -x\n%s\n"; + for (size_t i = 0; i < sizeof(ctx->tests) / sizeof(ctx->tests[0]); i++) { + struct Test *test = &ctx->tests[i]; + if (!test->name && !test->repository && !test->script) { + // skip unused test records + continue; + } + msg(STASIS_MSG_L2, "Executing tests for %s %s\n", test->name, test->version); + if (!test->script || !strlen(test->script)) { + msg(STASIS_MSG_WARN | STASIS_MSG_L3, "Nothing to do. To fix, declare a 'script' in section: [test:%s]\n", + test->name); + continue; + } + + char destdir[PATH_MAX]; + sprintf(destdir, "%s/%s", ctx->storage.build_sources_dir, path_basename(test->repository)); + + if (!access(destdir, F_OK)) { + msg(STASIS_MSG_L3, "Purging repository %s\n", destdir); + if (rmtree(destdir)) { + COE_CHECK_ABORT(1, "Unable to remove repository\n"); + } + } + msg(STASIS_MSG_L3, "Cloning repository %s\n", test->repository); + if (!git_clone(&proc, test->repository, destdir, test->version)) { + test->repository_info_tag = strdup(git_describe(destdir)); + test->repository_info_ref = strdup(git_rev_parse(destdir, "HEAD")); + } else { + COE_CHECK_ABORT(1, "Unable to clone repository\n"); + } + + if (test->repository_remove_tags && strlist_count(test->repository_remove_tags)) { + filter_repo_tags(destdir, test->repository_remove_tags); + } + + if (pushd(destdir)) { + COE_CHECK_ABORT(1, "Unable to enter repository directory\n"); + } else { + char *cmd = calloc(strlen(test->script) + STASIS_BUFSIZ, sizeof(*cmd)); + if (!cmd) { + SYSERROR("Unable to allocate test script buffer: %s", strerror(errno)); + exit(1); + } + + msg(STASIS_MSG_L3, "Testing %s\n", test->name); + memset(&proc, 0, sizeof(proc)); + + strcpy(cmd, test->script); + char *cmd_rendered = tpl_render(cmd); + if (cmd_rendered) { + if (strcmp(cmd_rendered, cmd) != 0) { + strcpy(cmd, cmd_rendered); + cmd[strlen(cmd_rendered) ? strlen(cmd_rendered) - 1 : 0] = 0; + } + guard_free(cmd_rendered); + } else { + SYSERROR("An error occurred while rendering the following:\n%s", cmd); + exit(1); + } + + if (test->disable) { + msg(STASIS_MSG_L2, "Script execution disabled by configuration\n", test->name); + guard_free(cmd); + continue; + } + + char runner_cmd[0xFFFF] = {0}; + char pool_name[100] = "parallel"; + struct MultiProcessingTask *task = NULL; + struct MultiProcessingPool *pool = pool_parallel; + if (!test->parallel) { + pool = pool_serial; + memset(pool_name, 0, sizeof(pool_name)); + strcpy(pool_name, "serial"); + } + + sprintf(runner_cmd, runner_cmd_fmt, cmd); + task = mp_pool_task(pool, test->name, runner_cmd); + if (!task) { + SYSERROR("Failed to add task to %s pool: %s", pool_name, runner_cmd); + popd(); + if (!globals.continue_on_error) { + tpl_free(); + delivery_free(ctx); + globals_free(); + } + exit(1); + } + guard_free(cmd); + popd(); + + } + } + + // Configure "script_setup" tasks + // Directories should exist now, so no need to go through initializing everything all over again. + for (size_t i = 0; i < sizeof(ctx->tests) / sizeof(ctx->tests[0]); i++) { + struct Test *test = &ctx->tests[i]; + if (test->script_setup) { + char destdir[PATH_MAX]; + sprintf(destdir, "%s/%s", ctx->storage.build_sources_dir, path_basename(test->repository)); + if (access(destdir, F_OK)) { + SYSERROR("%s: %s", destdir, strerror(errno)); + exit(1); + } + if (!pushd(destdir)) { + char *cmd = calloc(strlen(test->script_setup) + STASIS_BUFSIZ, sizeof(*cmd)); + if (!cmd) { + SYSERROR("Unable to allocate test script_setup buffer: %s", strerror(errno)); + exit(1); + } + + strcpy(cmd, test->script_setup); + char *cmd_rendered = tpl_render(cmd); + if (cmd_rendered) { + if (strcmp(cmd_rendered, cmd) != 0) { + strcpy(cmd, cmd_rendered); + cmd[strlen(cmd_rendered) ? strlen(cmd_rendered) - 1 : 0] = 0; + } + guard_free(cmd_rendered); + } else { + SYSERROR("An error occurred while rendering the following:\n%s", cmd); + exit(1); + } + + struct MultiProcessingPool *pool = pool_setup; + struct MultiProcessingTask *task = NULL; + char runner_cmd[0xFFFF] = {0}; + sprintf(runner_cmd, runner_cmd_fmt, cmd); + + task = mp_pool_task(pool, test->name, runner_cmd); + if (!task) { + SYSERROR("Failed to add task %s to setup pool: %s", test->name, runner_cmd); + popd(); + if (!globals.continue_on_error) { + tpl_free(); + delivery_free(ctx); + globals_free(); + } + exit(1); + } + guard_free(cmd); + popd(); + } + } + } + + size_t opt_flags = 0; + if (globals.parallel_fail_fast) { + opt_flags |= MP_POOL_FAIL_FAST; + } + + int pool_status = -1; + if (pool_setup->num_used) { + pool_status = mp_pool_join(pool_setup, 1, opt_flags); + mp_pool_show_summary(pool_setup); + COE_CHECK_ABORT(pool_status != 0, "Failure in setup task pool"); + mp_pool_free(&pool_setup); + } + + if (pool_parallel->num_used) { + pool_status = mp_pool_join(pool_parallel, globals.cpu_limit, opt_flags); + mp_pool_show_summary(pool_parallel); + COE_CHECK_ABORT(pool_status != 0, "Failure in parallel task pool"); + mp_pool_free(&pool_parallel); + } + + if (pool_serial->num_used) { + pool_status = mp_pool_join(pool_serial, 1, opt_flags); + mp_pool_show_summary(pool_serial); + COE_CHECK_ABORT(pool_serial != 0, "Failure in serial task pool"); + mp_pool_free(&pool_serial); + } + } +} + +int delivery_fixup_test_results(struct Delivery *ctx) { + struct dirent *rec; + DIR *dp; + + dp = opendir(ctx->storage.results_dir); + if (!dp) { + perror(ctx->storage.results_dir); + return -1; + } + + while ((rec = readdir(dp)) != NULL) { + char path[PATH_MAX]; + memset(path, 0, sizeof(path)); + + if (!strcmp(rec->d_name, ".") || !strcmp(rec->d_name, "..")) { + continue; + } else if (!endswith(rec->d_name, ".xml")) { + continue; + } + + sprintf(path, "%s/%s", ctx->storage.results_dir, rec->d_name); + msg(STASIS_MSG_L3, "%s\n", rec->d_name); + if (xml_pretty_print_in_place(path, STASIS_XML_PRETTY_PRINT_PROG, STASIS_XML_PRETTY_PRINT_ARGS)) { + msg(STASIS_MSG_L3 | STASIS_MSG_WARN, "Failed to rewrite file '%s'\n", rec->d_name); + } + } + + closedir(dp); + return 0; +} + -- cgit From 42807d1d62b85b00c7898d0434bb278a780237f9 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 26 Sep 2024 09:57:38 -0400 Subject: Code size: Consolidate pools into an array --- src/delivery_test.c | 76 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 31 deletions(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index beea510..177a9e7 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -1,9 +1,10 @@ #include "delivery.h" void delivery_tests_run(struct Delivery *ctx) { - struct MultiProcessingPool *pool_parallel; - struct MultiProcessingPool *pool_serial; - struct MultiProcessingPool *pool_setup; + static const int SETUP = 0; + static const int PARALLEL = 1; + static const int SERIAL = 2; + struct MultiProcessingPool *pool[3]; struct Process proc; memset(&proc, 0, sizeof(proc)); @@ -17,20 +18,20 @@ void delivery_tests_run(struct Delivery *ctx) { if (!ctx->tests[0].name) { msg(STASIS_MSG_WARN | STASIS_MSG_L2, "no tests are defined!\n"); } else { - pool_parallel = mp_pool_init("parallel", ctx->storage.tmpdir); - if (!pool_parallel) { + pool[PARALLEL] = mp_pool_init("parallel", ctx->storage.tmpdir); + if (!pool[PARALLEL]) { perror("mp_pool_init/parallel"); exit(1); } - pool_serial = mp_pool_init("serial", ctx->storage.tmpdir); - if (!pool_serial) { + pool[SERIAL] = mp_pool_init("serial", ctx->storage.tmpdir); + if (!pool[SERIAL]) { perror("mp_pool_init/serial"); exit(1); } - pool_setup = mp_pool_init("setup", ctx->storage.tmpdir); - if (!pool_setup) { + pool[SETUP] = mp_pool_init("setup", ctx->storage.tmpdir); + if (!pool[SETUP]) { perror("mp_pool_init/setup"); exit(1); } @@ -104,15 +105,15 @@ void delivery_tests_run(struct Delivery *ctx) { char runner_cmd[0xFFFF] = {0}; char pool_name[100] = "parallel"; struct MultiProcessingTask *task = NULL; - struct MultiProcessingPool *pool = pool_parallel; + int selected = PARALLEL; if (!test->parallel) { - pool = pool_serial; + selected = SERIAL; memset(pool_name, 0, sizeof(pool_name)); strcpy(pool_name, "serial"); } sprintf(runner_cmd, runner_cmd_fmt, cmd); - task = mp_pool_task(pool, test->name, runner_cmd); + task = mp_pool_task(pool[selected], test->name, destdir, runner_cmd); if (!task) { SYSERROR("Failed to add task to %s pool: %s", pool_name, runner_cmd); popd(); @@ -160,12 +161,11 @@ void delivery_tests_run(struct Delivery *ctx) { exit(1); } - struct MultiProcessingPool *pool = pool_setup; struct MultiProcessingTask *task = NULL; char runner_cmd[0xFFFF] = {0}; sprintf(runner_cmd, runner_cmd_fmt, cmd); - task = mp_pool_task(pool, test->name, runner_cmd); + task = mp_pool_task(pool[SETUP], test->name, destdir, runner_cmd); if (!task) { SYSERROR("Failed to add task %s to setup pool: %s", test->name, runner_cmd); popd(); @@ -178,6 +178,9 @@ void delivery_tests_run(struct Delivery *ctx) { } guard_free(cmd); popd(); + } else { + SYSERROR("Failed to change directory: %s\n", destdir); + exit(1); } } } @@ -187,26 +190,37 @@ void delivery_tests_run(struct Delivery *ctx) { opt_flags |= MP_POOL_FAIL_FAST; } - int pool_status = -1; - if (pool_setup->num_used) { - pool_status = mp_pool_join(pool_setup, 1, opt_flags); - mp_pool_show_summary(pool_setup); - COE_CHECK_ABORT(pool_status != 0, "Failure in setup task pool"); - mp_pool_free(&pool_setup); - } + for (size_t p = 0; p < sizeof(pool) / sizeof(*pool); p++) { + int pool_status; + long jobs = globals.cpu_limit; + + if (!pool[p]->num_used) { + // Skip empty pool + continue; + } + + // Setup tasks run sequentially + if (p == (size_t) SETUP) { + jobs = 1; + } - if (pool_parallel->num_used) { - pool_status = mp_pool_join(pool_parallel, globals.cpu_limit, opt_flags); - mp_pool_show_summary(pool_parallel); - COE_CHECK_ABORT(pool_status != 0, "Failure in parallel task pool"); - mp_pool_free(&pool_parallel); + // Run tasks in the pool + // 1. Setup (builds) + // 2. Parallel (fast jobs) + // 3. Serial (long jobs) + pool_status = mp_pool_join(pool[p], jobs, opt_flags); + + // On error show a summary of the current pool, and die + if (pool_status != 0) { + mp_pool_show_summary(pool[p]); + COE_CHECK_ABORT(true, "Task failure"); + } } - if (pool_serial->num_used) { - pool_status = mp_pool_join(pool_serial, 1, opt_flags); - mp_pool_show_summary(pool_serial); - COE_CHECK_ABORT(pool_serial != 0, "Failure in serial task pool"); - mp_pool_free(&pool_serial); + // All tasks were successful + for (size_t p = 0; p < sizeof(pool) / sizeof(*pool); p++) { + mp_pool_show_summary(pool[p]); + mp_pool_free(&pool[p]); } } } -- cgit From 40d1de9306d6de8a57d4398fef696ad8e1395c08 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 27 Sep 2024 09:58:43 -0400 Subject: Add comments --- src/delivery_test.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index 177a9e7..cb8b434 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -36,14 +36,33 @@ void delivery_tests_run(struct Delivery *ctx) { exit(1); } + // Test block scripts shall exit non-zero on error. + // This will fail a test block immediately if "string" is not found in file.txt: + // grep string file.txt + // + // And this is how to avoid that scenario: + // #1: + // if ! grep string file.txt; then + // # handle error + // fi + // + // #2: + // grep string file.txt || handle error + // + // #3: + // # Use ':' as a NO-OP if/when the result doesn't matter + // grep string file.txt || : const char *runner_cmd_fmt = "set -e -x\n%s\n"; + + // Iterate over our test records, retrieving the source code for each package, and assigning its scripted tasks + // to the appropriate processing pool for (size_t i = 0; i < sizeof(ctx->tests) / sizeof(ctx->tests[0]); i++) { struct Test *test = &ctx->tests[i]; if (!test->name && !test->repository && !test->script) { // skip unused test records continue; } - msg(STASIS_MSG_L2, "Executing tests for %s %s\n", test->name, test->version); + msg(STASIS_MSG_L2, "Loading tests for %s %s\n", test->name, test->version); if (!test->script || !strlen(test->script)) { msg(STASIS_MSG_WARN | STASIS_MSG_L3, "Nothing to do. To fix, declare a 'script' in section: [test:%s]\n", test->name); @@ -80,7 +99,7 @@ void delivery_tests_run(struct Delivery *ctx) { exit(1); } - msg(STASIS_MSG_L3, "Testing %s\n", test->name); + msg(STASIS_MSG_L3, "Queuing task for %s\n", test->name); memset(&proc, 0, sizeof(proc)); strcpy(cmd, test->script); @@ -190,6 +209,7 @@ void delivery_tests_run(struct Delivery *ctx) { opt_flags |= MP_POOL_FAIL_FAST; } + // Execute all queued tasks for (size_t p = 0; p < sizeof(pool) / sizeof(*pool); p++) { int pool_status; long jobs = globals.cpu_limit; -- cgit From 1ce4673c7c0151f69c2c35984633b6c9512ce97f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 27 Sep 2024 09:59:27 -0400 Subject: Only show a summary if a pool ran a job --- src/delivery_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index cb8b434..959a99b 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -239,7 +239,10 @@ void delivery_tests_run(struct Delivery *ctx) { // All tasks were successful for (size_t p = 0; p < sizeof(pool) / sizeof(*pool); p++) { - mp_pool_show_summary(pool[p]); + if (pool[p]->num_used) { + // Only show pools that actually had jobs to run + mp_pool_show_summary(pool[p]); + } mp_pool_free(&pool[p]); } } -- cgit From 73219c6e26a4847b3429318148918b78f6452ac1 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 30 Sep 2024 12:39:09 -0400 Subject: Allocate runner_cmd using asprintf --- src/delivery_test.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index 959a99b..804cbc9 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -121,7 +121,7 @@ void delivery_tests_run(struct Delivery *ctx) { continue; } - char runner_cmd[0xFFFF] = {0}; + char *runner_cmd = NULL; char pool_name[100] = "parallel"; struct MultiProcessingTask *task = NULL; int selected = PARALLEL; @@ -131,18 +131,23 @@ void delivery_tests_run(struct Delivery *ctx) { strcpy(pool_name, "serial"); } - sprintf(runner_cmd, runner_cmd_fmt, cmd); + if (asprintf(&runner_cmd, runner_cmd_fmt, cmd) < 0) { + SYSERROR("Unable to allocate memory for runner command: %s", strerror(errno)); + exit(1); + } task = mp_pool_task(pool[selected], test->name, destdir, runner_cmd); if (!task) { SYSERROR("Failed to add task to %s pool: %s", pool_name, runner_cmd); popd(); if (!globals.continue_on_error) { + guard_free(runner_cmd); tpl_free(); delivery_free(ctx); globals_free(); } exit(1); } + guard_free(runner_cmd); guard_free(cmd); popd(); @@ -161,7 +166,8 @@ void delivery_tests_run(struct Delivery *ctx) { exit(1); } if (!pushd(destdir)) { - char *cmd = calloc(strlen(test->script_setup) + STASIS_BUFSIZ, sizeof(*cmd)); + const size_t cmd_len = strlen(test->script_setup) + STASIS_BUFSIZ; + char *cmd = calloc(cmd_len, sizeof(*cmd)); if (!cmd) { SYSERROR("Unable to allocate test script_setup buffer: %s", strerror(errno)); exit(1); @@ -181,20 +187,25 @@ void delivery_tests_run(struct Delivery *ctx) { } struct MultiProcessingTask *task = NULL; - char runner_cmd[0xFFFF] = {0}; - sprintf(runner_cmd, runner_cmd_fmt, cmd); + char *runner_cmd = NULL; + if (asprintf(&runner_cmd, runner_cmd_fmt, cmd) < 0) { + SYSERROR("Unable to allocate memory for runner command: %s", strerror(errno)); + exit(1); + } task = mp_pool_task(pool[SETUP], test->name, destdir, runner_cmd); if (!task) { SYSERROR("Failed to add task %s to setup pool: %s", test->name, runner_cmd); popd(); if (!globals.continue_on_error) { + guard_free(runner_cmd); tpl_free(); delivery_free(ctx); globals_free(); } exit(1); } + guard_free(runner_cmd); guard_free(cmd); popd(); } else { -- cgit From 8a0b0d1977b54e0ccb2a2e30658d31e10cdd3239 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 30 Sep 2024 12:40:39 -0400 Subject: Replace strcpy with strlcpy --- src/delivery_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index 804cbc9..a9153d3 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -173,11 +173,11 @@ void delivery_tests_run(struct Delivery *ctx) { exit(1); } - strcpy(cmd, test->script_setup); + strlcpy(cmd, test->script_setup, cmd_len); char *cmd_rendered = tpl_render(cmd); if (cmd_rendered) { if (strcmp(cmd_rendered, cmd) != 0) { - strcpy(cmd, cmd_rendered); + strlcpy(cmd, cmd_rendered, cmd_len); cmd[strlen(cmd_rendered) ? strlen(cmd_rendered) - 1 : 0] = 0; } guard_free(cmd_rendered); -- cgit From d5fa0c23542746c642a00d24956f20afa639392c Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Mon, 30 Sep 2024 12:48:49 -0400 Subject: Replace strlcpy with strncpy (maybe later) --- src/delivery_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index a9153d3..e2bfe97 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -173,11 +173,11 @@ void delivery_tests_run(struct Delivery *ctx) { exit(1); } - strlcpy(cmd, test->script_setup, cmd_len); + strncpy(cmd, test->script_setup, cmd_len - 1); char *cmd_rendered = tpl_render(cmd); if (cmd_rendered) { if (strcmp(cmd_rendered, cmd) != 0) { - strlcpy(cmd, cmd_rendered, cmd_len); + strncpy(cmd, cmd_rendered, cmd_len - 1); cmd[strlen(cmd_rendered) ? strlen(cmd_rendered) - 1 : 0] = 0; } guard_free(cmd_rendered); -- cgit From 1ba1fcc61a200c833f4a89849dd9d2577693bfa0 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 1 Oct 2024 15:40:46 -0400 Subject: Add comment about use of xtrace --- src/delivery_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index e2bfe97..3809768 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -13,7 +13,9 @@ void delivery_tests_run(struct Delivery *ctx) { } else { memset(globals.workaround.conda_reactivate, 0, PATH_MAX); } - snprintf(globals.workaround.conda_reactivate, PATH_MAX - 1, "\nmamba activate ${CONDA_DEFAULT_ENV}\n"); + // Test blocks always run with xtrace enabled. Disable, and reenable it. Conda's wrappers produce an incredible + // amount of debug information. + snprintf(globals.workaround.conda_reactivate, PATH_MAX - 1, "\nset +x; mamba activate ${CONDA_DEFAULT_ENV}; set -x\n"); if (!ctx->tests[0].name) { msg(STASIS_MSG_WARN | STASIS_MSG_L2, "no tests are defined!\n"); -- cgit From f6c504630ecfa38c1516123019bdf67b921f1107 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 2 Oct 2024 14:56:59 -0400 Subject: Allow user to define the time interval for "task is running" message --- src/delivery_test.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index 3809768..d79e088 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -25,18 +25,21 @@ void delivery_tests_run(struct Delivery *ctx) { perror("mp_pool_init/parallel"); exit(1); } + pool[PARALLEL]->status_interval = globals.pool_status_interval; pool[SERIAL] = mp_pool_init("serial", ctx->storage.tmpdir); if (!pool[SERIAL]) { perror("mp_pool_init/serial"); exit(1); } + pool[SERIAL]->status_interval = globals.pool_status_interval; pool[SETUP] = mp_pool_init("setup", ctx->storage.tmpdir); if (!pool[SETUP]) { perror("mp_pool_init/setup"); exit(1); } + pool[SETUP]->status_interval = globals.pool_status_interval; // Test block scripts shall exit non-zero on error. // This will fail a test block immediately if "string" is not found in file.txt: -- cgit From 6fe8c2572fbf73cee3936ab241fcbfbdd54fe633 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 2 Oct 2024 15:00:12 -0400 Subject: Allow user to disable parallel mode (shortcut for --cpu-limit=1) --- src/delivery_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/delivery_test.c') diff --git a/src/delivery_test.c b/src/delivery_test.c index d79e088..8ff08cc 100644 --- a/src/delivery_test.c +++ b/src/delivery_test.c @@ -130,7 +130,7 @@ void delivery_tests_run(struct Delivery *ctx) { char pool_name[100] = "parallel"; struct MultiProcessingTask *task = NULL; int selected = PARALLEL; - if (!test->parallel) { + if (!globals.enable_parallel || !test->parallel) { selected = SERIAL; memset(pool_name, 0, sizeof(pool_name)); strcpy(pool_name, "serial"); -- cgit