Skip to content

Commit

Permalink
tests: print test run time
Browse files Browse the repository at this point in the history
  • Loading branch information
aras-p committed Aug 4, 2010
1 parent a5bf957 commit 46a1b87
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/glsl/glsl_optimizer_main.cpp
@@ -1,5 +1,6 @@
#include <string>
#include <vector>
#include <time.h>
#include "glsl_optimizer.h"

#ifdef _MSC_VER
Expand Down Expand Up @@ -270,12 +271,14 @@ int main (int argc, const char** argv)

std::string baseFolder = argv[1];

clock_t time0 = clock();

static const char* kTypeName[2] = { "vertex", "fragment" };
size_t tests = 0;
size_t errors = 0;
for (int type = 0; type < 2; ++type)
{
printf ("testing %s...\n", kTypeName[type]);
printf ("** running %s...\n", kTypeName[type]);
std::string testFolder = baseFolder + "/" + kTypeName[type];
StringVector inputFiles = GetFiles (testFolder, "-in.txt");

Expand All @@ -294,10 +297,13 @@ int main (int argc, const char** argv)
}
}
}
clock_t time1 = clock();
float timeDelta = float(time1-time0)/CLOCKS_PER_SEC;

if (errors != 0)
printf ("%i tests, %i FAILED\n", tests, errors);
printf ("**** %i tests (%.2fsec), %i !!!FAILED!!!\n", tests, timeDelta, errors);
else
printf ("%i tests succeeded\n", tests);
printf ("**** %i tests (%.2fsec) succeeded\n", tests, timeDelta);

glslopt_cleanup (ctx);

Expand Down

0 comments on commit 46a1b87

Please sign in to comment.