diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-14 16:04:09 -0400 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-14 16:04:09 -0400 | 
| commit | a31a9b7ef81f47d6972a2a74fe9c660c4d250d55 (patch) | |
| tree | bf83edd8e11690892dae92b5109d49f8e265bcf9 /src/deliverable.c | |
| parent | 0c21db396d0ca18db4326c53fe69137a69e3f4cb (diff) | |
| download | stasis-a31a9b7ef81f47d6972a2a74fe9c660c4d250d55.tar.gz | |
Add fix_tox_conf function
* If the user calls tox in a test script like so: tox {{ workaround.tox_posargs }}, then a temporary tox configuration will be generated and the appropriate arguments to use it will be injected into tox's command line arguments
Diffstat (limited to 'src/deliverable.c')
| -rw-r--r-- | src/deliverable.c | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/src/deliverable.c b/src/deliverable.c index 0ddf17a..0b166d9 100644 --- a/src/deliverable.c +++ b/src/deliverable.c @@ -1393,6 +1393,20 @@ void delivery_tests_run(struct Delivery *ctx) {                  msg(OMC_MSG_L3, "Testing %s\n", ctx->tests[i].name);                  memset(&proc, 0, sizeof(proc)); +                // Apply workaround for tox positional arguments +                char *toxconf = NULL; +                if (!access("tox.ini", F_OK)) { +                    msg(OMC_MSG_L3, "Fixing tox positional arguments\n"); + +                    fix_tox_conf("tox.ini", &toxconf); +                    if (!globals.workaround.tox_posargs) { +                        globals.workaround.tox_posargs = calloc(PATH_MAX, sizeof(*globals.workaround.tox_posargs)); +                    } else { +                        memset(globals.workaround.tox_posargs, 0, PATH_MAX); +                    } +                    snprintf(globals.workaround.tox_posargs, PATH_MAX - 1, "-c %s --root .", toxconf); +                } +                  // enable trace mode before executing each test script                  memset(cmd, 0, sizeof(cmd));                  sprintf(cmd, "set -x ; %s", ctx->tests[i].script); @@ -1410,6 +1424,11 @@ void delivery_tests_run(struct Delivery *ctx) {                      msg(OMC_MSG_ERROR, "Script failure: %s\n%s\n\nExit code: %d\n", ctx->tests[i].name, ctx->tests[i].script, status);                      COE_CHECK_ABORT(!globals.continue_on_error, "Test failure")                  } + +                if (toxconf) { +                    remove(toxconf); +                    guard_free(toxconf); +                }                  popd();  #else                  msg(OMC_MSG_WARNING | OMC_MSG_L3, "TESTING DISABLED BY CODE!\n"); | 
