{"action":"created","comment":{"url":"https://api.github.com/repos/google/gtest-parallel/pulls/comments/108471577","pull_request_review_id":29504632,"id":108471577,"diff_hunk":"@@ -127,75 +128,72 @@ class FilterFormat:\n \n   tests = {}\n   outputs = {}\n-  started = []\n-  finished = []\n-  failures = []\n+  failed = []\n+  started = set()\n+\n+  def move_to(self, destination_dir, log_file):\n+    destination_dir = os.path.join(self.output_dir, destination_dir)\n+    test_name = os.path.basename(log_file)\n+    shutil.move(log_file, os.path.join(destination_dir, test_name))\n \n   def print_tests(self, message, test_ids):\n-    if test_ids:\n-      self.out.permanent_line(\"%s (%s/%s):\" %\n-                              (message, len(test_ids), self.total_tests))\n-      test_ids = sorted(test_ids, key=lambda test_id: self.tests[test_id])\n-      for test_id in test_ids:\n-        self.out.permanent_line(\" %s: %s\" % self.tests[test_id])\n+    self.out.permanent_line(\"%s (%s/%s):\" %\n+                            (message, len(test_ids), self.total_tests))\n+    test_ids = sorted(test_ids, key=lambda test_id: self.tests[test_id])\n+    for test_id in test_ids:\n+      self.out.permanent_line(\" %s: %s\" % self.tests[test_id])\n \n   def print_test_status(self, last_finished_test, time_ms):\n     self.out.transient_line(\"[%d/%d] %s (%d ms)\"\n                             % (self.finished_tests, self.total_tests,\n                                last_finished_test, time_ms))\n \n-  def handle_meta(self, job_id, args):\n-    (command, arg) = args.split(' ', 1)\n+  def log(self, job_id, command, args=tuple(), file_name=None):\n+    stdout_lock.acquire()\n     if command == \"TEST\":\n-      (binary, test) = arg.split(' ', 1)\n-      self.tests[job_id] = (binary, test.strip())\n+      self.tests[job_id] = args\n     elif command == \"START\":\n-      self.started.append(job_id)\n+      self.started.add(job_id)\n     elif command == \"EXIT\":\n-      (exit_code, time_ms) = [int(x) for x in arg.split(' ', 1)]\n+      self.started.remove(job_id)\n       self.finished_tests += 1\n-      self.finished.append(job_id)\n+      (exit_code, time_ms) = args\n       (binary, test) = self.tests[job_id]\n       self.print_test_status(test, time_ms)\n-      if exit_code != 0:\n-        self.failures.append(job_id)\n-        with open(self.outputs[job_id]) as f:\n+      if exit_code == 0:\n+        self.move_to('passed', file_name)\n+      else:\n+        with open(file_name) as f:\n           for line in f.readlines():\n             self.out.permanent_line(line.rstrip())\n+        self.failed.append(job_id)\n+        self.move_to('failed', file_name)\n         self.out.permanent_line(\n           \"[%d/%d] %s returned/aborted with exit code %d (%d ms)\"\n           % (self.finished_tests, self.total_tests, test, exit_code, time_ms))\n     elif command == \"TESTCNT\":\n-      self.total_tests = int(arg.split(' ', 1)[1])\n+      self.total_tests = args[0]\n       self.out.transient_line(\"[0/%d] Running tests...\" % self.total_tests)\n-\n-  def logfile(self, job_id, name):\n-    self.outputs[job_id] = name\n-\n-  def log(self, line):\n-    stdout_lock.acquire()\n-    (prefix, output) = line.split(' ', 1)\n-\n-    assert prefix[-1] == ':'\n-    self.handle_meta(int(prefix[:-1]), output)\n     stdout_lock.release()\n \n   def end(self):\n-    self.print_tests(\"FAILED TESTS\", self.failures)\n-    interruptions = set(self.started) - set(self.finished)\n-    self.print_tests(\"INTERRUPTED TESTS\", interruptions)\n+    if self.failed:\n+      self.print_tests(\"FAILED TESTS\", self.failed)\n+    if self.started:\n+      self.print_tests(\"INTERRUPTED TESTS\", self.started)","path":"gtest-parallel","position":97,"original_position":97,"commit_id":"7bd67ab2874bdca6a0702b6a113cdbaf8f21350d","original_commit_id":"7bd67ab2874bdca6a0702b6a113cdbaf8f21350d","user":{"login":"pbos","id":95335,"avatar_url":"https://avatars1.githubusercontent.com/u/95335?v=3","gravatar_id":"","url":"https://api.github.com/users/pbos","html_url":"https://github.com/pbos","followers_url":"https://api.github.com/users/pbos/followers","following_url":"https://api.github.com/users/pbos/following{/other_user}","gists_url":"https://api.github.com/users/pbos/gists{/gist_id}","starred_url":"https://api.github.com/users/pbos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pbos/subscriptions","organizations_url":"https://api.github.com/users/pbos/orgs","repos_url":"https://api.github.com/users/pbos/repos","events_url":"https://api.github.com/users/pbos/events{/privacy}","received_events_url":"https://api.github.com/users/pbos/received_events","type":"User","site_admin":false},"body":"Can we remove the interrupted dir if it's empty here?","created_at":"2017-03-28T16:35:48Z","updated_at":"2017-03-28T16:35:48Z","html_url":"https://github.com/google/gtest-parallel/pull/19#discussion_r108471577","pull_request_url":"https://api.github.com/repos/google/gtest-parallel/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/google/gtest-parallel/pulls/comments/108471577"},"html":{"href":"https://github.com/google/gtest-parallel/pull/19#discussion_r108471577"},"pull_request":{"href":"https://api.github.com/repos/google/gtest-parallel/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/google/gtest-parallel/pulls/19","id":112202884,"html_url":"https://github.com/google/gtest-parallel/pull/19","diff_url":"https://github.com/google/gtest-parallel/pull/19.diff","patch_url":"https://github.com/google/gtest-parallel/pull/19.patch","issue_url":"https://api.github.com/repos/google/gtest-parallel/issues/19","number":19,"state":"open","locked":false,"title":"Save logs into passed, failed and interrupted directories.","user":{"login":"ehlemur","id":1455745,"avatar_url":"https://avatars1.githubusercontent.com/u/1455745?v=3","gravatar_id":"","url":"https://api.github.com/users/ehlemur","html_url":"https://github.com/ehlemur","followers_url":"https://api.github.com/users/ehlemur/followers","following_url":"https://api.github.com/users/ehlemur/following{/other_user}","gists_url":"https://api.github.com/users/ehlemur/gists{/gist_id}","starred_url":"https://api.github.com/users/ehlemur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehlemur/subscriptions","organizations_url":"https://api.github.com/users/ehlemur/orgs","repos_url":"https://api.github.com/users/ehlemur/repos","events_url":"https://api.github.com/users/ehlemur/events{/privacy}","received_events_url":"https://api.github.com/users/ehlemur/received_events","type":"User","site_admin":false},"body":"This will make it easier to find the failures and crashes, while still saving the passing tests' logs.","created_at":"2017-03-23T10:17:10Z","updated_at":"2017-03-28T16:35:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90c4dcad5f2294eba5bb9f3bcd236eb926fa0da5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/gtest-parallel/pulls/19/commits","review_comments_url":"https://api.github.com/repos/google/gtest-parallel/pulls/19/comments","review_comment_url":"https://api.github.com/repos/google/gtest-parallel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/gtest-parallel/issues/19/comments","statuses_url":"https://api.github.com/repos/google/gtest-parallel/statuses/7bd67ab2874bdca6a0702b6a113cdbaf8f21350d","head":{"label":"ehlemur:master","ref":"master","sha":"7bd67ab2874bdca6a0702b6a113cdbaf8f21350d","user":{"login":"ehlemur","id":1455745,"avatar_url":"https://avatars1.githubusercontent.com/u/1455745?v=3","gravatar_id":"","url":"https://api.github.com/users/ehlemur","html_url":"https://github.com/ehlemur","followers_url":"https://api.github.com/users/ehlemur/followers","following_url":"https://api.github.com/users/ehlemur/following{/other_user}","gists_url":"https://api.github.com/users/ehlemur/gists{/gist_id}","starred_url":"https://api.github.com/users/ehlemur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehlemur/subscriptions","organizations_url":"https://api.github.com/users/ehlemur/orgs","repos_url":"https://api.github.com/users/ehlemur/repos","events_url":"https://api.github.com/users/ehlemur/events{/privacy}","received_events_url":"https://api.github.com/users/ehlemur/received_events","type":"User","site_admin":false},"repo":{"id":85932227,"name":"gtest-parallel","full_name":"ehlemur/gtest-parallel","owner":{"login":"ehlemur","id":1455745,"avatar_url":"https://avatars1.githubusercontent.com/u/1455745?v=3","gravatar_id":"","url":"https://api.github.com/users/ehlemur","html_url":"https://github.com/ehlemur","followers_url":"https://api.github.com/users/ehlemur/followers","following_url":"https://api.github.com/users/ehlemur/following{/other_user}","gists_url":"https://api.github.com/users/ehlemur/gists{/gist_id}","starred_url":"https://api.github.com/users/ehlemur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ehlemur/subscriptions","organizations_url":"https://api.github.com/users/ehlemur/orgs","repos_url":"https://api.github.com/users/ehlemur/repos","events_url":"https://api.github.com/users/ehlemur/events{/privacy}","received_events_url":"https://api.github.com/users/ehlemur/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ehlemur/gtest-parallel","description":"Run GoogleTest test suites in parallel.","fork":true,"url":"https://api.github.com/repos/ehlemur/gtest-parallel","forks_url":"https://api.github.com/repos/ehlemur/gtest-parallel/forks","keys_url":"https://api.github.com/repos/ehlemur/gtest-parallel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ehlemur/gtest-parallel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ehlemur/gtest-parallel/teams","hooks_url":"https://api.github.com/repos/ehlemur/gtest-parallel/hooks","issue_events_url":"https://api.github.com/repos/ehlemur/gtest-parallel/issues/events{/number}","events_url":"https://api.github.com/repos/ehlemur/gtest-parallel/events","assignees_url":"https://api.github.com/repos/ehlemur/gtest-parallel/assignees{/user}","branches_url":"https://api.github.com/repos/ehlemur/gtest-parallel/branches{/branch}","tags_url":"https://api.github.com/repos/ehlemur/gtest-parallel/tags","blobs_url":"https://api.github.com/repos/ehlemur/gtest-parallel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ehlemur/gtest-parallel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ehlemur/gtest-parallel/git/refs{/sha}","trees_url":"https://api.github.com/repos/ehlemur/gtest-parallel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ehlemur/gtest-parallel/statuses/{sha}","languages_url":"https://api.github.com/repos/ehlemur/gtest-parallel/languages","stargazers_url":"https://api.github.com/repos/ehlemur/gtest-parallel/stargazers","contributors_url":"https://api.github.com/repos/ehlemur/gtest-parallel/contributors","subscribers_url":"https://api.github.com/repos/ehlemur/gtest-parallel/subscribers","subscription_url":"https://api.github.com/repos/ehlemur/gtest-parallel/subscription","commits_url":"https://api.github.com/repos/ehlemur/gtest-parallel/commits{/sha}","git_commits_url":"https://api.github.com/repos/ehlemur/gtest-parallel/git/commits{/sha}","comments_url":"https://api.github.com/repos/ehlemur/gtest-parallel/comments{/number}","issue_comment_url":"https://api.github.com/repos/ehlemur/gtest-parallel/issues/comments{/number}","contents_url":"https://api.github.com/repos/ehlemur/gtest-parallel/contents/{+path}","compare_url":"https://api.github.com/repos/ehlemur/gtest-parallel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ehlemur/gtest-parallel/merges","archive_url":"https://api.github.com/repos/ehlemur/gtest-parallel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ehlemur/gtest-parallel/downloads","issues_url":"https://api.github.com/repos/ehlemur/gtest-parallel/issues{/number}","pulls_url":"https://api.github.com/repos/ehlemur/gtest-parallel/pulls{/number}","milestones_url":"https://api.github.com/repos/ehlemur/gtest-parallel/milestones{/number}","notifications_url":"https://api.github.com/repos/ehlemur/gtest-parallel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ehlemur/gtest-parallel/labels{/name}","releases_url":"https://api.github.com/repos/ehlemur/gtest-parallel/releases{/id}","deployments_url":"https://api.github.com/repos/ehlemur/gtest-parallel/deployments","created_at":"2017-03-23T09:39:51Z","updated_at":"2017-03-23T09:39:52Z","pushed_at":"2017-03-28T08:19:59Z","git_url":"git://github.com/ehlemur/gtest-parallel.git","ssh_url":"git@github.com:ehlemur/gtest-parallel.git","clone_url":"https://github.com/ehlemur/gtest-parallel.git","svn_url":"https://github.com/ehlemur/gtest-parallel","homepage":"","size":83,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"a5a21a740fe6fffcef9750ef5f70515c6d9600be","user":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19826356,"name":"gtest-parallel","full_name":"google/gtest-parallel","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars2.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/gtest-parallel","description":"Run GoogleTest test suites in parallel.","fork":false,"url":"https://api.github.com/repos/google/gtest-parallel","forks_url":"https://api.github.com/repos/google/gtest-parallel/forks","keys_url":"https://api.github.com/repos/google/gtest-parallel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/gtest-parallel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/gtest-parallel/teams","hooks_url":"https://api.github.com/repos/google/gtest-parallel/hooks","issue_events_url":"https://api.github.com/repos/google/gtest-parallel/issues/events{/number}","events_url":"https://api.github.com/repos/google/gtest-parallel/events","assignees_url":"https://api.github.com/repos/google/gtest-parallel/assignees{/user}","branches_url":"https://api.github.com/repos/google/gtest-parallel/branches{/branch}","tags_url":"https://api.github.com/repos/google/gtest-parallel/tags","blobs_url":"https://api.github.com/repos/google/gtest-parallel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/gtest-parallel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/gtest-parallel/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/gtest-parallel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/gtest-parallel/statuses/{sha}","languages_url":"https://api.github.com/repos/google/gtest-parallel/languages","stargazers_url":"https://api.github.com/repos/google/gtest-parallel/stargazers","contributors_url":"https://api.github.com/repos/google/gtest-parallel/contributors","subscribers_url":"https://api.github.com/repos/google/gtest-parallel/subscribers","subscription_url":"https://api.github.com/repos/google/gtest-parallel/subscription","commits_url":"https://api.github.com/repos/google/gtest-parallel/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/gtest-parallel/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/gtest-parallel/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/gtest-parallel/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/gtest-parallel/contents/{+path}","compare_url":"https://api.github.com/repos/google/gtest-parallel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/gtest-parallel/merges","archive_url":"https://api.github.com/repos/google/gtest-parallel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/gtest-parallel/downloads","issues_url":"https://api.github.com/repos/google/gtest-parallel/issues{/number}","pulls_url":"https://api.github.com/repos/google/gtest-parallel/pulls{/number}","milestones_url":"https://api.github.com/repos/google/gtest-parallel/milestones{/number}","notifications_url":"https://api.github.com/repos/google/gtest-parallel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/gtest-parallel/labels{/name}","releases_url":"https://api.github.com/repos/google/gtest-parallel/releases{/id}","deployments_url":"https://api.github.com/repos/google/gtest-parallel/deployments","created_at":"2014-05-15T16:13:51Z","updated_at":"2017-03-18T06:33:24Z","pushed_at":"2017-03-28T08:20:00Z","git_url":"git://github.com/google/gtest-parallel.git","ssh_url":"git@github.com:google/gtest-parallel.git","clone_url":"https://github.com/google/gtest-parallel.git","svn_url":"https://github.com/google/gtest-parallel","homepage":"","size":73,"stargazers_count":39,"watchers_count":39,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":1,"forks":23,"open_issues":1,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/gtest-parallel/pulls/19"},"html":{"href":"https://github.com/google/gtest-parallel/pull/19"},"issue":{"href":"https://api.github.com/repos/google/gtest-parallel/issues/19"},"comments":{"href":"https://api.github.com/repos/google/gtest-parallel/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/google/gtest-parallel/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/google/gtest-parallel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/gtest-parallel/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/google/gtest-parallel/statuses/7bd67ab2874bdca6a0702b6a113cdbaf8f21350d"}}}}
{"actor":{"display_login":"pbos"}}