Writes app.js + tool.py + `pad` JS filler files (the fillers only select the * parallel path: more than MIN_FILES_FOR_PARALLEL files). 0 on success. */
| 2401 | /* Writes app.js + tool.py + `pad` JS filler files (the fillers only select the |
| 2402 | * parallel path: more than MIN_FILES_FOR_PARALLEL files). 0 on success. */ |
| 2403 | static int write_xlang_route_fixture(const char *dir, int pad) { |
| 2404 | char path[512]; |
| 2405 | snprintf(path, sizeof(path), "%s/app.js", dir); |
| 2406 | if (th_write_file(path, XLANG_APP_JS) != 0) { |
| 2407 | return -1; |
| 2408 | } |
| 2409 | snprintf(path, sizeof(path), "%s/tool.py", dir); |
| 2410 | if (th_write_file(path, XLANG_TOOL_PY) != 0) { |
| 2411 | return -1; |
| 2412 | } |
| 2413 | for (int i = 0; i < pad; i++) { |
| 2414 | char source[128]; |
| 2415 | snprintf(path, sizeof(path), "%s/xlang_pad_%02d.js", dir, i); |
| 2416 | snprintf(source, sizeof(source), "function xlangPad%02d() { return %d; }\n", i, i); |
| 2417 | if (th_write_file(path, source) != 0) { |
| 2418 | return -1; |
| 2419 | } |
| 2420 | } |
| 2421 | return 0; |
| 2422 | } |
| 2423 | |
| 2424 | /* Saves and overrides the two worker-selection variables. */ |
| 2425 | typedef struct { |
no test coverage detected