MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxRunTestCase

Function fxRunTestCase

xs/tools/xst262.c:1219–1310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1217}
1218
1219int fxRunTestCase(txPool* pool, txContext* context, char* path, txUnsigned flags, int async, char* message)
1220{
1221 xsCreation _creation = {
1222 256 * 1024, /* initialChunkSize */
1223 1 * 1024 * 1024, /* incrementalChunkSize */
1224 1 * 1024 * 32, /* initialHeapCount */
1225 1 * 1024 * 32, /* incrementalHeapCount */
1226 64 * 1024, /* stackCount */
1227 1024, /* initialKeyCount */
1228 1024, /* incrementalKeyCount */
1229 1993, /* nameModulo */
1230 127, /* symbolModulo */
1231 64 * 1024, /* parserBufferSize */
1232 1993, /* parserTableModulo */
1233 };
1234 xsCreation* creation = &_creation;
1235 xsMachine* machine;
1236 char buffer[C_PATH_MAX];
1237 int success = 0;
1238 machine = xsCreateMachine(creation, "xst262", NULL);
1239 xsBeginHost(machine);
1240 {
1241 xsVars(5);
1242 xsTry {
1243 fxBuildAgent(the);
1244 c_strcpy(buffer, pool->harnessPath);
1245 c_strcat(buffer, "sta.js");
1246 fxRunProgramFile(the, buffer, mxProgramFlag | mxDebugFlag);
1247 c_strcpy(buffer, pool->harnessPath);
1248 c_strcat(buffer, "assert.js");
1249 fxRunProgramFile(the, buffer, mxProgramFlag | mxDebugFlag);
1250 if (async) {
1251 xsResult = xsNewHostFunction(fx_done, 1);
1252 xsSet(xsGlobal, xsID("$DONE"), xsResult);
1253 xsVar(0) = xsString("Test did not run to completion");
1254 }
1255 else
1256 xsVar(0) = xsUndefined;
1257 if (context->includes) {
1258 yaml_node_item_t* item = context->includes->data.sequence.items.start;
1259 while (item < context->includes->data.sequence.items.top) {
1260 yaml_node_t* node = yaml_document_get_node(context->document, *item);
1261 c_strcpy(buffer, pool->harnessPath);
1262 c_strcat(buffer, (char*)node->data.scalar.value);
1263 fxRunProgramFile(the, buffer, mxProgramFlag | mxDebugFlag);
1264 item++;
1265 }
1266 }
1267 mxPop();
1268 if (pool->flags & XST_LOCKDOWN_FLAG)
1269 xsCall0(xsGlobal, xsID("lockdown"));
1270 the->rejection = &xsVar(0);
1271 if (flags) {
1272 if (pool->flags & XST_COMPARTMENT_FLAG)
1273 fxRunProgramFileInCompartment(the, path, flags);
1274 else
1275 fxRunProgramFile(the, path, flags);
1276 }

Callers 1

fxRunContextFunction · 0.85

Calls 6

fxRunProgramFileFunction · 0.85
yaml_document_get_nodeFunction · 0.85
fxRunModuleFileFunction · 0.85
fxRunLoopFunction · 0.85

Tested by

no test coverage detected