diff options
| author | suyambulingamrm <suyambu.rm@samsung.com> | 2014-06-05 19:49:20 +0530 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2014-06-05 12:21:08 -0700 |
| commit | 79c8e88722f523363abeef95d2a4ce1511fc80d8 (patch) | |
| tree | 0a11b64f4a20fbd33a7f2b47e6c91ffaec208c24 /src/caskbench.cpp | |
| parent | 0c013440c72efbe6c493812e06b1bd5382dd3722 (diff) | |
Issue #71. Add command line option to list and choose drawing libraries.
Diffstat (limited to 'src/caskbench.cpp')
| -rw-r--r-- | src/caskbench.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 2243fe9..3260ed1 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -58,6 +58,8 @@ typedef struct _caskbench_options { int list_tests; int list_gles_versions; int gles_version; + char *drawing_lib; + int list_drawing_libs; const char **tests; } caskbench_options_t; @@ -134,6 +136,15 @@ print_gles_versions_available () #endif } +static void +print_drawing_libs_available() +{ + printf("cairo\n"); +#if USE_SKIA + printf("skia\n"); +#endif +} + void process_options(caskbench_options_t *opt, int argc, char *argv[]) { @@ -238,6 +249,12 @@ process_options(caskbench_options_t *opt, int argc, char *argv[]) "Specify the GLES version to use", NULL}, #endif + {"list-drawing-libs", '\0', POPT_ARG_NONE, &opt->list_drawing_libs, 0, + "List the drawing libraries available for execution", + NULL}, + {"drawing-lib", 'D', POPT_ARG_STRING, &opt->drawing_lib, 0, + "Specify the library to be used for drawing", + NULL}, POPT_AUTOHELP {NULL} }; @@ -367,6 +384,49 @@ convertToTestId(const char* test_name) return -1; } +void +process_drawing_libs (const char *libs, int &num_tests, int *test_ids) +{ + int test_index = 0, j = 0; + int index = 0, i = -1; + char filter[MAX_BUFFER]; + bool skia_cairo = false; + memset(filter, 0, sizeof(filter)); + +#ifndef USE_SKIA + if (strstr(libs, "skia")) + errx (0, "skia is unavailable in this build\n"); +#endif + /* Caskbench runs as usual */ + if (strcmp(libs, "cairo,skia") == 0) + return; + + if (strncmp(libs,"cairo", strlen(libs)) == 0) + strncpy(filter, "cairo", 5); + else if (strncmp(libs, "skia", strlen(libs)) == 0) + strncpy(filter, "skia", 4); + else if (strncmp(libs, "skia,cairo", strlen(libs)) == 0) + skia_cairo = true; + else + errx (0, "Invalid library is specified\n"); + + /* Handle the case if user has already provided list of tests to run */ + index = num_tests ? num_tests:num_perf_tests; + for (j = 0; j < index; j++) { + i = (test_ids[j]!=-1) ? test_ids[j]:j; + if (strstr (perf_tests[i].name, filter) && !skia_cairo) { + test_ids[test_index++] = i; + } + if (skia_cairo) { + /* Add skia test followed by cairo */ + test_ids[test_index++] = i+1; + test_ids[test_index++] = i; + j++; + } + } + num_tests = test_index; +} + void populate_user_tests (const char** tests, int& num_tests, int* test_ids) { int i = 0, id = -1, test_index = 0; @@ -449,6 +509,11 @@ main (int argc, char *argv[]) config.egl_gles_version = opt.gles_version; } + if (opt.list_drawing_libs) { + print_drawing_libs_available(); + exit(0); + } + if (opt.output_file) { // start writing json to output file fp = fopen(opt.output_file, "w"); @@ -460,6 +525,9 @@ main (int argc, char *argv[]) } memset (user_test_ids, -1, sizeof(user_test_ids)); populate_user_tests (opt.tests, num_user_tests, user_test_ids); + if(opt.drawing_lib) + process_drawing_libs (opt.drawing_lib, num_user_tests, user_test_ids); + num_tests = num_user_tests ? num_user_tests : num_perf_tests; for(int s = 0; s < num_tests; s++) { c = num_user_tests ? user_test_ids[s] : s; |