MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / main

Function main

LiveRecomp/live_recompiler_test.cpp:301–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301int main(int argc, const char** argv) {
302 if (argc < 3) {
303 printf("Usage: %s [test directory] [test 1] ...\n", argv[0]);
304 return EXIT_SUCCESS;
305 }
306
307 N64Recomp::live_recompiler_init();
308
309 rdram.resize(0x8000000);
310
311 // Skip the first argument (program name) and second argument (test directory).
312 int count = argc - 1 - 1;
313 int passed_count = 0;
314
315 std::vector<size_t> failed_tests{};
316
317 for (size_t test_index = 0; test_index < count; test_index++) {
318 const char* cur_test_name = argv[2 + test_index];
319 printf("Running test: %s\n", cur_test_name);
320 TestStats stats = run_test(argv[1], cur_test_name);
321
322 switch (stats.error) {
323 case TestError::Success:
324 printf(" Success\n");
325 printf(" Generated %" PRIu64 " bytes in %" PRIu64 " microseconds and ran in %" PRIu64 " microseconds\n",
326 stats.code_size, stats.codegen_microseconds, stats.execution_microseconds);
327 passed_count++;
328 break;
329 case TestError::FailedToOpenInput:
330 printf(" Failed to open input data file\n");
331 break;
332 case TestError::FailedToRecompile:
333 printf(" Failed to recompile\n");
334 break;
335 case TestError::UnknownStructType:
336 printf(" Unknown additional data struct type in test data\n");
337 break;
338 case TestError::DataDifference:
339 printf(" Output data did not match, dumped to file\n");
340 break;
341 }
342
343 if (stats.error != TestError::Success) {
344 failed_tests.emplace_back(test_index);
345 }
346
347 printf("\n");
348 }
349
350 printf("Passed %d/%d tests\n", passed_count, count);
351 if (!failed_tests.empty()) {
352 printf(" Failed: ");
353 for (size_t i = 0; i < failed_tests.size(); i++) {
354 size_t test_index = failed_tests[i];
355
356 printf("%s", argv[2 + test_index]);
357 if (i != failed_tests.size() - 1) {
358 printf(", ");

Callers

nothing calls this directly

Calls 1

run_testFunction · 0.85

Tested by

no test coverage detected