aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/lua
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-21 21:45:20 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-21 21:45:20 +0000
commitaaeb87d32ce781fb9b6dd6790152d5f46662bb17 (patch)
tree5c3bcdafa452c559354e5ab878fabfe03f19c121 /tools/lua
parent1be794fad6bef2b1ab98158bd3ad68dc4a52dbf6 (diff)
Add modulo flag to lua_pictures.
The intended use is spawning processes to save time. R=caryclark@google.com, reed@google.com Author: sglez@google.com Review URL: https://chromiumcodereview.appspot.com/16950025 git-svn-id: http://skia.googlecode.com/svn/trunk@9736 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/lua')
-rw-r--r--tools/lua/lua_pictures.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/tools/lua/lua_pictures.cpp b/tools/lua/lua_pictures.cpp
index 106948a8d3..02b9a57fb4 100644
--- a/tools/lua/lua_pictures.cpp
+++ b/tools/lua/lua_pictures.cpp
@@ -33,6 +33,10 @@ static const char gSummarizeFunc[] = "sk_scrape_summarize";
// PictureRenderingFlags.cpp
extern bool lazy_decode_bitmap(const void* buffer, size_t size, SkBitmap*);
+// Example usage for the modulo flag:
+// for i in {0..5}; do lua_pictures --skpPath SKP_PATH -l YOUR_SCRIPT --modulo $i 6 &; done
+DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for which "
+ "testIndex %% divisor == remainder.");
DEFINE_string2(skpPath, r, "", "Read this .skp file or .skp files from this dir");
DEFINE_string2(luaFile, l, "", "File containing lua script to run");
DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning");
@@ -115,6 +119,19 @@ int tool_main(int argc, char** argv) {
L.runCode(FLAGS_headCode[0]);
}
+ int moduloRemainder = -1;
+ int moduloDivisor = -1;
+ SkString moduloStr;
+
+ if (FLAGS_modulo.count() == 2) {
+ moduloRemainder = atoi(FLAGS_modulo[0]);
+ moduloDivisor = atoi(FLAGS_modulo[1]);
+ if (moduloRemainder < 0 || moduloDivisor <= 0 || moduloRemainder >= moduloDivisor) {
+ SkDebugf("invalid modulo values.\n");
+ return -1;
+ }
+ }
+
for (int i = 0; i < FLAGS_skpPath.count(); i ++) {
SkTArray<SkString> paths;
if (sk_isdir(FLAGS_skpPath[i])) {
@@ -131,8 +148,14 @@ int tool_main(int argc, char** argv) {
}
for (int i = 0; i < paths.count(); i++) {
+ if (moduloRemainder >= 0) {
+ if ((i % moduloDivisor) != moduloRemainder) {
+ continue;
+ }
+ moduloStr.printf("[%d.%d] ", i, moduloDivisor);
+ }
const char* path = paths[i].c_str();
- SkDebugf("scraping %s\n", path);
+ SkDebugf("scraping %s %s\n", path, moduloStr.c_str());
SkAutoTUnref<SkPicture> pic(load_picture(path));
if (pic.get()) {