void MostRecentTests::setLastTestRun( CPPUNIT_NS::Test *test ) { for ( TestRuns::iterator it = m_runs.begin(); it != m_runs.end(); ++it ) { if ( it->second == test ) { m_runs.erase( it ); break; } } if ( test != NULL ) m_runs.push_front( TestRun( test->getName(), test ) ); }
int main(int argc, char** argv) { try { if (argc != 8) { std::cout << "Usage: NvidiaNvencTest.exe <input filename> <width> <height> <threads> <fps> <bitrate per stream> <save output to file>" << std::endl; return EXIT_FAILURE; } cuInit(0); unsigned int nWidth = std::stoi(argv[2]), nHeight = std::stoi(argv[3]), nThreads = std::stoi(argv[4]), nFps = std::stoi(argv[5]), nBitrate = std::stoi(argv[6]); bool bSaveOutputToFile = strcmp("true", argv[7]) == 0; std::cout << "Input " << argv[1] << " - " << nWidth << "x" << nHeight << ", threads: " << nThreads << ", fps: " << nFps << ", bitrate: " << nBitrate << " bit/s per stream, save output to file: " << bSaveOutputToFile << std::endl; CCpuUsageMonitor CpuUsageMonitor(L"NvidiaNvencTest"); CTestRun<CNvidiaNvencCodec> TestRun(argv[1], nThreads, CNvidiaNvencCodecContext(nWidth, nHeight, nFps, bSaveOutputToFile, nBitrate, true, false), CpuUsageMonitor); } catch (std::exception& Exception) { std::cout << "Error: " << Exception.what() << std::endl; } return EXIT_SUCCESS; }
int main (int argc, const char** argv) { if (argc < 2) { printf ("USAGE: hlsl2glsltest testfolder\n"); return 1; } bool hasOpenGL = InitializeOpenGL (); if (!hasOpenGL) printf("NOTE: will not check GLSL with actual driver (no GL/GLSL)\n"); clock_t time0 = clock(); Hlsl2Glsl_Initialize (); std::string baseFolder = argv[1]; size_t tests = 0; size_t errors = 0; for (int type = 0; type < NUM_RUN_TYPES; ++type) { printf ("TESTING %s...\n", kTypeName[type]); const ETargetVersion version1 = kTargets1[type]; const ETargetVersion version2 = kTargets2[type]; const ETargetVersion version3 = kTargets3[type]; std::string testFolder = baseFolder + "/" + kTypeName[type]; StringVector inputFiles = GetFiles (testFolder, "-in.txt"); size_t n = inputFiles.size(); tests += n; for (size_t i = 0; i < n; ++i) { std::string inname = inputFiles[i]; //if (inname != "_zzz-in.txt") // continue; const bool preprocessorTest = (inname.find("pp-") == 0); bool ok = true; printf ("test %s\n", inname.c_str()); if (type == BOTH) { ok = TestCombinedFile(testFolder + "/" + inname, version1, hasOpenGL); if (ok && version2 != ETargetVersionCount) ok = TestCombinedFile(testFolder + "/" + inname, version2, hasOpenGL); } else { ok = TestFile(TestRun(type), testFolder + "/" + inname, version1, 0, hasOpenGL); if (!preprocessorTest) { if (ok && version2 != ETargetVersionCount) ok = TestFile(TestRun(type), testFolder + "/" + inname, version2, ETranslateOpEmitGLSL120ArrayInitWorkaround, hasOpenGL); if (ok && version3 != ETargetVersionCount) ok = TestFile(TestRun(type), testFolder + "/" + inname, version3, 0, hasOpenGL); } } if (!ok) ++errors; } } clock_t time1 = clock(); float t = float(time1-time0) / float(CLOCKS_PER_SEC); if (errors != 0) printf ("%i tests, %i FAILED, %.2fs\n", (int)tests, (int)errors, t); else printf ("%i tests succeeded, %.2fs\n", (int)tests, t); Hlsl2Glsl_Shutdown(); CleanupOpenGL(); return errors ? 1 : 0; }