{"action":"created","comment":{"url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments/68463228","id":68463228,"diff_hunk":"@@ -0,0 +1,201 @@\n+#!/bin/python\n+import re\n+import commands\n+import logging\n+import time\n+import os\n+from autotest.client import test, utils\n+from distutils.spawn import find_executable\n+from autotest.client.shared import error\n+\n+\n+class test_time(test.test):\n+    \"\"\"\n+    Autotest module for time utility.\n+    time - time is a simple command,it gives resource usage.\n+    The time utility runs the specified program/command with the given\n+    arguments.When program/command finishes,time writes a message\n+    to standard error giving timing statistics about the command run.\n+    These statistics consist of\n+        (i)   The elapsed real time between invocation and termination,\n+        (ii)  The user CPU time , and\n+        (iii) The system CPU time .\n+\n+    @author:Basheer Khadarsabgari <basheer@linux.vnet.ibm.com>\n+    \"\"\"\n+    version = 1\n+    nfail = 0\n+    seconds = 2\n+    time_exe = ''\n+    output_file = ''\n+\n+    def install_check(self):\n+        \"\"\"\n+        Install check for time\n+        \"\"\"\n+        self.time_exe = find_executable('time')\n+        if self.time_exe is None:\n+            raise error.TestError('\\n time utility not found')\n+\n+    def test_portability_option(self):\n+        \"\"\"\n+        This method will verify the time utility output Format\n+        Ex: \"/usr/bin/time -p sleep 2\"\n+        \"\"\"\n+        cmd = \"%s -p sleep %s\" % (self.time_exe, self.seconds)\n+        time_output = commands.getoutput(cmd)\n+        if re.search(\n+                \"(real\\s+%s.\\d+)\\nuser\\s+\\d+.\\d+\\nsys\\s+\\d.\\d+\" %\n+                self.seconds,\n+                time_output):\n+            logging.info(\n+                \"\\n Verified '--portability' option successfuly.\")\n+        else:\n+            self.nfail += 1\n+            raise error.TestError(\n+                \"\\n Failed to verify --portability option of time utility\")\n+\n+    def test_exit_status_of_cmd(self, cmd, expected_status):\n+        \"\"\"\n+        This method will verify the exit status of the command invoked\n+        using time utility.\n+        Ex:/usr/bin/time -f \"%x is Exit status of the cmd %C\" <cmd>\n+        \"\"\"\n+        cmd_to_execute = \"%s \" % self.time_exe + \\\n+            \" -f '%x is the Exit status of the cmd %C' \" + cmd\n+        search_pattren = \"%s is the Exit status of the cmd %s\" % (","path":"linux-tools/test_time/test_time.py","position":66,"original_position":66,"commit_id":"8132eac6dd119f3c42b9856b6c0bdcb148b5e35d","original_commit_id":"8132eac6dd119f3c42b9856b6c0bdcb148b5e35d","user":{"login":"lmr","id":296807,"avatar_url":"https://avatars.githubusercontent.com/u/296807?v=3","gravatar_id":"","url":"https://api.github.com/users/lmr","html_url":"https://github.com/lmr","followers_url":"https://api.github.com/users/lmr/followers","following_url":"https://api.github.com/users/lmr/following{/other_user}","gists_url":"https://api.github.com/users/lmr/gists{/gist_id}","starred_url":"https://api.github.com/users/lmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmr/subscriptions","organizations_url":"https://api.github.com/users/lmr/orgs","repos_url":"https://api.github.com/users/lmr/repos","events_url":"https://api.github.com/users/lmr/events{/privacy}","received_events_url":"https://api.github.com/users/lmr/received_events","type":"User","site_admin":false},"body":"Oh, `search_pattren`, another typo I didn't catch on my first read...","created_at":"2016-06-24T21:09:33Z","updated_at":"2016-06-24T21:09:33Z","html_url":"https://github.com/autotest/autotest-client-tests/pull/70#discussion_r68463228","pull_request_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments/68463228"},"html":{"href":"https://github.com/autotest/autotest-client-tests/pull/70#discussion_r68463228"},"pull_request":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70","id":75171043,"html_url":"https://github.com/autotest/autotest-client-tests/pull/70","diff_url":"https://github.com/autotest/autotest-client-tests/pull/70.diff","patch_url":"https://github.com/autotest/autotest-client-tests/pull/70.patch","issue_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/70","number":70,"state":"open","locked":false,"title":"Basheerk testcase time","user":{"login":"lmr","id":296807,"avatar_url":"https://avatars.githubusercontent.com/u/296807?v=3","gravatar_id":"","url":"https://api.github.com/users/lmr","html_url":"https://github.com/lmr","followers_url":"https://api.github.com/users/lmr/followers","following_url":"https://api.github.com/users/lmr/following{/other_user}","gists_url":"https://api.github.com/users/lmr/gists{/gist_id}","starred_url":"https://api.github.com/users/lmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmr/subscriptions","organizations_url":"https://api.github.com/users/lmr/orgs","repos_url":"https://api.github.com/users/lmr/repos","events_url":"https://api.github.com/users/lmr/events{/privacy}","received_events_url":"https://api.github.com/users/lmr/received_events","type":"User","site_admin":false},"body":"The  time utility runs the specified program/command with the given arguments.\r\nWhen program/command finishes, time writes a message to standard error giving timing statistics about the program/command run\r\n\r\nIt provides /usr/bin/time binary\r\n\r\nsignedoff-By:Basheer K<basheer@linux.vnet.ibm.com>","created_at":"2016-06-24T20:43:52Z","updated_at":"2016-06-24T21:09:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c48c4b8b0f0b108e80e6a09f03d9d948fbd7a10f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70/commits","review_comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70/comments","review_comment_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/70/comments","statuses_url":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/8132eac6dd119f3c42b9856b6c0bdcb148b5e35d","head":{"label":"autotest:basheerk-testcase_time","ref":"basheerk-testcase_time","sha":"8132eac6dd119f3c42b9856b6c0bdcb148b5e35d","user":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"repo":{"id":5952007,"name":"autotest-client-tests","full_name":"autotest/autotest-client-tests","owner":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autotest/autotest-client-tests","description":"Autotest client tests","fork":false,"url":"https://api.github.com/repos/autotest/autotest-client-tests","forks_url":"https://api.github.com/repos/autotest/autotest-client-tests/forks","keys_url":"https://api.github.com/repos/autotest/autotest-client-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autotest/autotest-client-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autotest/autotest-client-tests/teams","hooks_url":"https://api.github.com/repos/autotest/autotest-client-tests/hooks","issue_events_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/events{/number}","events_url":"https://api.github.com/repos/autotest/autotest-client-tests/events","assignees_url":"https://api.github.com/repos/autotest/autotest-client-tests/assignees{/user}","branches_url":"https://api.github.com/repos/autotest/autotest-client-tests/branches{/branch}","tags_url":"https://api.github.com/repos/autotest/autotest-client-tests/tags","blobs_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/autotest/autotest-client-tests/languages","stargazers_url":"https://api.github.com/repos/autotest/autotest-client-tests/stargazers","contributors_url":"https://api.github.com/repos/autotest/autotest-client-tests/contributors","subscribers_url":"https://api.github.com/repos/autotest/autotest-client-tests/subscribers","subscription_url":"https://api.github.com/repos/autotest/autotest-client-tests/subscription","commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/autotest/autotest-client-tests/contents/{+path}","compare_url":"https://api.github.com/repos/autotest/autotest-client-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autotest/autotest-client-tests/merges","archive_url":"https://api.github.com/repos/autotest/autotest-client-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autotest/autotest-client-tests/downloads","issues_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues{/number}","pulls_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/autotest/autotest-client-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/autotest/autotest-client-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autotest/autotest-client-tests/labels{/name}","releases_url":"https://api.github.com/repos/autotest/autotest-client-tests/releases{/id}","deployments_url":"https://api.github.com/repos/autotest/autotest-client-tests/deployments","created_at":"2012-09-25T15:21:39Z","updated_at":"2016-05-08T17:35:50Z","pushed_at":"2016-06-24T20:58:27Z","git_url":"git://github.com/autotest/autotest-client-tests.git","ssh_url":"git@github.com:autotest/autotest-client-tests.git","clone_url":"https://github.com/autotest/autotest-client-tests.git","svn_url":"https://github.com/autotest/autotest-client-tests","homepage":null,"size":101833,"stargazers_count":19,"watchers_count":19,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":6,"forks":53,"open_issues":6,"watchers":19,"default_branch":"master"}},"base":{"label":"autotest:master","ref":"master","sha":"df3cb696c1d784885210080b7d7ce437714cc69e","user":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"repo":{"id":5952007,"name":"autotest-client-tests","full_name":"autotest/autotest-client-tests","owner":{"login":"autotest","id":472856,"avatar_url":"https://avatars.githubusercontent.com/u/472856?v=3","gravatar_id":"","url":"https://api.github.com/users/autotest","html_url":"https://github.com/autotest","followers_url":"https://api.github.com/users/autotest/followers","following_url":"https://api.github.com/users/autotest/following{/other_user}","gists_url":"https://api.github.com/users/autotest/gists{/gist_id}","starred_url":"https://api.github.com/users/autotest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autotest/subscriptions","organizations_url":"https://api.github.com/users/autotest/orgs","repos_url":"https://api.github.com/users/autotest/repos","events_url":"https://api.github.com/users/autotest/events{/privacy}","received_events_url":"https://api.github.com/users/autotest/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/autotest/autotest-client-tests","description":"Autotest client tests","fork":false,"url":"https://api.github.com/repos/autotest/autotest-client-tests","forks_url":"https://api.github.com/repos/autotest/autotest-client-tests/forks","keys_url":"https://api.github.com/repos/autotest/autotest-client-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/autotest/autotest-client-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/autotest/autotest-client-tests/teams","hooks_url":"https://api.github.com/repos/autotest/autotest-client-tests/hooks","issue_events_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/events{/number}","events_url":"https://api.github.com/repos/autotest/autotest-client-tests/events","assignees_url":"https://api.github.com/repos/autotest/autotest-client-tests/assignees{/user}","branches_url":"https://api.github.com/repos/autotest/autotest-client-tests/branches{/branch}","tags_url":"https://api.github.com/repos/autotest/autotest-client-tests/tags","blobs_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/autotest/autotest-client-tests/languages","stargazers_url":"https://api.github.com/repos/autotest/autotest-client-tests/stargazers","contributors_url":"https://api.github.com/repos/autotest/autotest-client-tests/contributors","subscribers_url":"https://api.github.com/repos/autotest/autotest-client-tests/subscribers","subscription_url":"https://api.github.com/repos/autotest/autotest-client-tests/subscription","commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/autotest/autotest-client-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/autotest/autotest-client-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/autotest/autotest-client-tests/contents/{+path}","compare_url":"https://api.github.com/repos/autotest/autotest-client-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/autotest/autotest-client-tests/merges","archive_url":"https://api.github.com/repos/autotest/autotest-client-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/autotest/autotest-client-tests/downloads","issues_url":"https://api.github.com/repos/autotest/autotest-client-tests/issues{/number}","pulls_url":"https://api.github.com/repos/autotest/autotest-client-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/autotest/autotest-client-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/autotest/autotest-client-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/autotest/autotest-client-tests/labels{/name}","releases_url":"https://api.github.com/repos/autotest/autotest-client-tests/releases{/id}","deployments_url":"https://api.github.com/repos/autotest/autotest-client-tests/deployments","created_at":"2012-09-25T15:21:39Z","updated_at":"2016-05-08T17:35:50Z","pushed_at":"2016-06-24T20:58:27Z","git_url":"git://github.com/autotest/autotest-client-tests.git","ssh_url":"git@github.com:autotest/autotest-client-tests.git","clone_url":"https://github.com/autotest/autotest-client-tests.git","svn_url":"https://github.com/autotest/autotest-client-tests","homepage":null,"size":101833,"stargazers_count":19,"watchers_count":19,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":6,"forks":53,"open_issues":6,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70"},"html":{"href":"https://github.com/autotest/autotest-client-tests/pull/70"},"issue":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/issues/70"},"comments":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/autotest/autotest-client-tests/statuses/8132eac6dd119f3c42b9856b6c0bdcb148b5e35d"}}}}
{"actor":{"display_login":"lmr"}}