diff --git a/README.md b/README.md index ead418c..71d1405 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ JSON object with `status` key. Depending on the status aditional keys might be p * **memoryLimit**: memory limit as set by cgroup's `memory.max` exceeded * **pidsLimit**: pids limit as set by cgroup's `pids.max` exceeded * **timeLimit**: run time limit exceeded, see `timeLimit` in [Request](#Request) section - * **fileLimit**: task output is written to a file; file size limit exceeded, see `pipes` in [Request](#Request) section + * **outputLimit**: task output size limit exceeded, see `pipes`, `copyFiles` and `stdStreams` in [Request](#Request) section * **requestInvalid**: request JSON invalid * **description**: error description * **internalError**: internal error @@ -185,7 +185,7 @@ Optional keys: Chroot prefix (if any) is automatically prepended to the path in `src` key. Optional `limit` numeric key caps the maximum amount of collected data (no limit by default). - If the limit is exeeded, the task terminates with `status:fileLimit`. + If the limit is exeeded, the task terminates with `status:outputLimit`. * **copyFiles**: object [] diff --git a/src/fail.c b/src/fail.c index 4aef5aa..67eec93 100644 --- a/src/fail.c +++ b/src/fail.c @@ -10,7 +10,7 @@ const char kStatusKilled[] = "killed"; const char kStatusMemoryLimit[] = "memoryLimit"; const char kStatusPidsLimit[] = "pidsLimit"; const char kStatusTimeLimit[] = "timeLimit"; -const char kStatusFileLimit[] = "fileLimit"; +const char kStatusOutputLimit[] = "outputLimit"; const char kStatusInternalError[] = "internalError"; const char kStatusRequestInvalid[] = "requestInvalid"; const char kStatusResponseTooBig[] = "responseTooBig"; diff --git a/src/sandals.h b/src/sandals.h index a31489b..1d25a43 100644 --- a/src/sandals.h +++ b/src/sandals.h @@ -18,7 +18,7 @@ extern const char kStatusKilled[]; // = "killed" extern const char kStatusMemoryLimit[]; // = "memoryLimit" extern const char kStatusPidsLimit[]; // = "pidsLimit" extern const char kStatusTimeLimit[]; // = "timeLimit" -extern const char kStatusFileLimit[]; // = "fileLimit" +extern const char kStatusOutputLimit[]; // = "outputLimit" extern const char kStatusInternalError[]; // = "internalError" extern const char kStatusRequestInvalid[]; // = "requestInvalid" extern const char kStatusResponseTooBig[]; // = "responseTooBig" diff --git a/src/supervisor.c b/src/supervisor.c index cc46ab1..efa568f 100644 --- a/src/supervisor.c +++ b/src/supervisor.c @@ -218,7 +218,7 @@ static int do_pipes(struct sandals_supervisor *s) { if (rc) { s->response.size = 0; response_append_raw(&s->response, "{\"status\":\""); - response_append_esc(&s->response, kStatusFileLimit); + response_append_esc(&s->response, kStatusOutputLimit); response_append_raw(&s->response, "\"}\n"); status = -1; } diff --git a/tests/harness.js b/tests/harness.js index 00cb4b7..8a3c8d9 100644 --- a/tests/harness.js +++ b/tests/harness.js @@ -66,9 +66,9 @@ function pidsLimit(request) { return r; } -function fileLimit(request) { +function outputLimit(request) { const r = sandals(request); - if (r.status != 'fileLimit') assert.fail(r); + if (r.status != 'outputLimit') assert.fail(r); return r; } @@ -138,7 +138,7 @@ module.exports = { timeLimit, memoryLimit, pidsLimit, - fileLimit, + outputLimit, test, testAtExit: fn=>cleanupHandlers.push(fn), getInfo, diff --git a/tests/pipes.js b/tests/pipes.js index 5ce189a..5488655 100644 --- a/tests/pipes.js +++ b/tests/pipes.js @@ -1,6 +1,6 @@ const assert = require('assert'); const { - test, requestInvalid, exited, internalError, fileLimit, TmpFile + test, requestInvalid, exited, internalError, outputLimit, TmpFile } = require('./harness'); test('pipesInvalid', ()=>{ @@ -50,7 +50,7 @@ test('pipes3', ()=>{ test('pipeslimit', ()=>{ const output = new TmpFile(); - fileLimit({ + outputLimit({ cmd: ['yes'], pipes: [{dest: output, stdout: true, limit: 10}] }); @@ -66,7 +66,7 @@ test('copyFilesEarlyFailure', ()=>{ test('copyFilesLimit', ()=>{ const output = new TmpFile(); - fileLimit({ + outputLimit({ cmd: ['echo', '0123456789abcdef'], mounts: [{type: 'tmpfs', dest: '/tmp'}], copyFiles: [{src: '/tmp/output', dest: output, stdout: true, limit: 4}]