| 302 | } |
| 303 | |
| 304 | int fxRunBundle(const char* path) |
| 305 | { |
| 306 | int error = 0; |
| 307 | FILE* file = C_NULL; |
| 308 | char* buffer = C_NULL; |
| 309 | size_t size = 0; |
| 310 | char resolved[C_PATH_MAX]; |
| 311 | |
| 312 | if (!c_realpath(path, resolved)) { |
| 313 | fprintf(stderr, "file not found: %s\n", path); |
| 314 | return 1; |
| 315 | } |
| 316 | file = fopen(resolved, "r"); |
| 317 | if (!file) { |
| 318 | fprintf(stderr, "can't open file: %s\n", resolved); |
| 319 | return 1; |
| 320 | } |
| 321 | fseek(file, 0, SEEK_END); |
| 322 | size = ftell(file); |
| 323 | fseek(file, 0, SEEK_SET); |
| 324 | buffer = c_malloc(size + 1); |
| 325 | if (!buffer) { |
| 326 | fclose(file); |
| 327 | fprintf(stderr, "not enough memory\n"); |
| 328 | return 1; |
| 329 | } |
| 330 | if (size != fread(buffer, 1, size, file)) { |
| 331 | fclose(file); |
| 332 | c_free(buffer); |
| 333 | fprintf(stderr, "can't read file: %s\n", resolved); |
| 334 | return 1; |
| 335 | } |
| 336 | buffer[size] = 0; |
| 337 | fclose(file); |
| 338 | |
| 339 | xsCreation _creation = { |
| 340 | 16 * 1024 * 1024, /* initialChunkSize */ |
| 341 | 16 * 1024 * 1024, /* incrementalChunkSize */ |
| 342 | 1 * 1024 * 1024, /* initialHeapCount */ |
| 343 | 1 * 1024 * 1024, /* incrementalHeapCount */ |
| 344 | 256 * 1024, /* stackCount */ |
| 345 | 1024, /* initialKeyCount */ |
| 346 | 1024, /* incrementalKeyCount */ |
| 347 | 1993, /* nameModulo */ |
| 348 | 127, /* symbolModulo */ |
| 349 | 64 * 1024, /* parserBufferSize */ |
| 350 | 1993, /* parserTableModulo */ |
| 351 | }; |
| 352 | xsMachine* machine = xsCreateMachine(&_creation, "xst", NULL); |
| 353 | xsBeginMetering(machine, NULL, 0); |
| 354 | { |
| 355 | xsBeginHost(machine); |
| 356 | { |
| 357 | xsVars(1); |
| 358 | xsTry { |
| 359 | fxBuildAgent(machine); |
| 360 | fxBuildFuzz(machine); |
| 361 | xsVar(0) = xsUndefined; |
no test coverage detected