{"action":"created","comment":{"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments/72959127","id":72959127,"diff_hunk":"@@ -0,0 +1,83 @@\n+#!/usr/bin/env python\n+\n+# This program is free software; you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+#\n+# See LICENSE for more details.\n+#\n+# Copyright: 2016 IBM\n+# Author: Praveen K Pandey <praveen@linux.vnet.ibm.com>\n+#\n+# Based on code by Nikhil Rao <ncrao@google.com>\n+#   copyright: 2008 Google\n+#   https://github.com/autotest/autotest-client-tests/tree/master/hackbench\n+\n+import os\n+import shutil\n+import json\n+\n+from avocado import Test\n+from avocado import main\n+from avocado.utils import process\n+from avocado.utils.software_manager import SoftwareManager\n+\n+\n+class Hackbench(Test):\n+\n+    \"\"\"\n+    This module will run the hackbench benchmark. Hackbench is a benchmark for\n+    measuring the performance, overhead and scalability of the Linux scheduler.\n+    The C program was pick from Ingo Molnar's page.\n+    \"\"\"\n+\n+    def setUp(self):\n+        '''\n+        Build Hackbench\n+        Source:\n+        http://people.redhat.com/~mingo/cfs-scheduler/tools/hackbench.c\n+        '''\n+        self._threshold_time = self.params.get('time_val', default=None)\n+        self._num_groups = self.params.get('num_groups', default=90)\n+        self.results = None\n+        sm = SoftwareManager()\n+        if not sm.check_installed(\"gcc\") and not sm.install(\"gcc\"):\n+            self.error(\"Gcc is needed for the test to be run\")\n+        hackbench = self.fetch_asset('http://people.redhat.com'\n+                                     '/~mingo/cfs-scheduler/'\n+                                     'tools/hackbench.c')\n+        shutil.copyfile(hackbench, os.path.join(self.srcdir, 'hackbench.c'))\n+\n+        os.chdir(self.srcdir)\n+\n+        if 'CC' in os.environ:\n+            cc = '$CC'\n+        else:\n+            cc = 'cc'\n+        process.system('%s  hackbench.c -o hackbench -lpthread' % cc)\n+\n+    def test(self):\n+\n+        hackbench_bin = os.path.join(self.srcdir, 'hackbench')\n+        cmd = '%s %s' % (hackbench_bin, self._num_groups)\n+        self.results = process.system_output(cmd, shell=True)\n+        perf_json = {}\n+        for line in self.results.split('\\n'):\n+            if line.startswith('Time:'):\n+                time_spent = line.split()[1]\n+                perf_json = {'time': time_spent}\n+        output_path = os.path.join(self.outputdir, \"perf.json\")\n+        json.dump(perf_json, open(output_path, \"w\"))\n+        self.log.info(\"Time Taken:\" + time_spent)\n+        if self._threshold_time:\n+            if self._threshold_time >= time_spent:\n+                self.error(\"Test failed: Time Taken not \"\n+                           \"matched with threshold\")","path":"perf/hackbench.py","position":80,"original_position":80,"commit_id":"afd656bfb3e89643563315e70adeab399c69244e","original_commit_id":"afd656bfb3e89643563315e70adeab399c69244e","user":{"login":"apahim","id":4717757,"avatar_url":"https://avatars.githubusercontent.com/u/4717757?v=3","gravatar_id":"","url":"https://api.github.com/users/apahim","html_url":"https://github.com/apahim","followers_url":"https://api.github.com/users/apahim/followers","following_url":"https://api.github.com/users/apahim/following{/other_user}","gists_url":"https://api.github.com/users/apahim/gists{/gist_id}","starred_url":"https://api.github.com/users/apahim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apahim/subscriptions","organizations_url":"https://api.github.com/users/apahim/orgs","repos_url":"https://api.github.com/users/apahim/repos","events_url":"https://api.github.com/users/apahim/events{/privacy}","received_events_url":"https://api.github.com/users/apahim/received_events","type":"User","site_admin":false},"body":"Message needs update.","created_at":"2016-08-01T10:53:43Z","updated_at":"2016-08-01T10:53:43Z","html_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/117#discussion_r72959127","pull_request_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117","_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments/72959127"},"html":{"href":"https://github.com/avocado-framework/avocado-misc-tests/pull/117#discussion_r72959127"},"pull_request":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117"}}},"pull_request":{"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117","id":79542530,"html_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/117","diff_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/117.diff","patch_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/117.patch","issue_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/117","number":117,"state":"open","locked":false,"title":"Adding hackbench test to avocado[V3]","user":{"login":"PraveenPenguin","id":11898572,"avatar_url":"https://avatars.githubusercontent.com/u/11898572?v=3","gravatar_id":"","url":"https://api.github.com/users/PraveenPenguin","html_url":"https://github.com/PraveenPenguin","followers_url":"https://api.github.com/users/PraveenPenguin/followers","following_url":"https://api.github.com/users/PraveenPenguin/following{/other_user}","gists_url":"https://api.github.com/users/PraveenPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/PraveenPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PraveenPenguin/subscriptions","organizations_url":"https://api.github.com/users/PraveenPenguin/orgs","repos_url":"https://api.github.com/users/PraveenPenguin/repos","events_url":"https://api.github.com/users/PraveenPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/PraveenPenguin/received_events","type":"User","site_admin":false},"body":"Signed-off-by: praveen@linux.vnet.ibm.com\r\nadded hackbench Test case\r\nv1 #76\r\nv2 #116 \r\n\r\n```\r\nv3:rectified variable names \r\nv3:remove redundant variable\r\nv3: change compare condition\r\n```","created_at":"2016-08-01T09:55:21Z","updated_at":"2016-08-01T10:53:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0bd85059e1a7958a76079d738d07251ef5cb7c9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117/commits","review_comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117/comments","review_comment_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/117/comments","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/afd656bfb3e89643563315e70adeab399c69244e","head":{"label":"PraveenPenguin:hackbench_v3","ref":"hackbench_v3","sha":"afd656bfb3e89643563315e70adeab399c69244e","user":{"login":"PraveenPenguin","id":11898572,"avatar_url":"https://avatars.githubusercontent.com/u/11898572?v=3","gravatar_id":"","url":"https://api.github.com/users/PraveenPenguin","html_url":"https://github.com/PraveenPenguin","followers_url":"https://api.github.com/users/PraveenPenguin/followers","following_url":"https://api.github.com/users/PraveenPenguin/following{/other_user}","gists_url":"https://api.github.com/users/PraveenPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/PraveenPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PraveenPenguin/subscriptions","organizations_url":"https://api.github.com/users/PraveenPenguin/orgs","repos_url":"https://api.github.com/users/PraveenPenguin/repos","events_url":"https://api.github.com/users/PraveenPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/PraveenPenguin/received_events","type":"User","site_admin":false},"repo":{"id":60331734,"name":"avocado-misc-tests","full_name":"PraveenPenguin/avocado-misc-tests","owner":{"login":"PraveenPenguin","id":11898572,"avatar_url":"https://avatars.githubusercontent.com/u/11898572?v=3","gravatar_id":"","url":"https://api.github.com/users/PraveenPenguin","html_url":"https://github.com/PraveenPenguin","followers_url":"https://api.github.com/users/PraveenPenguin/followers","following_url":"https://api.github.com/users/PraveenPenguin/following{/other_user}","gists_url":"https://api.github.com/users/PraveenPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/PraveenPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PraveenPenguin/subscriptions","organizations_url":"https://api.github.com/users/PraveenPenguin/orgs","repos_url":"https://api.github.com/users/PraveenPenguin/repos","events_url":"https://api.github.com/users/PraveenPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/PraveenPenguin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PraveenPenguin/avocado-misc-tests","description":"Avocado tests repository","fork":true,"url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests","forks_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/forks","keys_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/teams","hooks_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/hooks","issue_events_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/issues/events{/number}","events_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/events","assignees_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/assignees{/user}","branches_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/branches{/branch}","tags_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/tags","blobs_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/languages","stargazers_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/stargazers","contributors_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/contributors","subscribers_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/subscribers","subscription_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/subscription","commits_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/contents/{+path}","compare_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/merges","archive_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/downloads","issues_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/issues{/number}","pulls_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/labels{/name}","releases_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/releases{/id}","deployments_url":"https://api.github.com/repos/PraveenPenguin/avocado-misc-tests/deployments","created_at":"2016-06-03T08:30:55Z","updated_at":"2016-06-03T08:30:56Z","pushed_at":"2016-08-01T10:37:22Z","git_url":"git://github.com/PraveenPenguin/avocado-misc-tests.git","ssh_url":"git@github.com:PraveenPenguin/avocado-misc-tests.git","clone_url":"https://github.com/PraveenPenguin/avocado-misc-tests.git","svn_url":"https://github.com/PraveenPenguin/avocado-misc-tests","homepage":null,"size":1431,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"avocado-framework:master","ref":"master","sha":"782dd55ca658539446ecd47c84feeab6ddb0ad39","user":{"login":"avocado-framework","id":7245719,"avatar_url":"https://avatars.githubusercontent.com/u/7245719?v=3","gravatar_id":"","url":"https://api.github.com/users/avocado-framework","html_url":"https://github.com/avocado-framework","followers_url":"https://api.github.com/users/avocado-framework/followers","following_url":"https://api.github.com/users/avocado-framework/following{/other_user}","gists_url":"https://api.github.com/users/avocado-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/avocado-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avocado-framework/subscriptions","organizations_url":"https://api.github.com/users/avocado-framework/orgs","repos_url":"https://api.github.com/users/avocado-framework/repos","events_url":"https://api.github.com/users/avocado-framework/events{/privacy}","received_events_url":"https://api.github.com/users/avocado-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":49900980,"name":"avocado-misc-tests","full_name":"avocado-framework/avocado-misc-tests","owner":{"login":"avocado-framework","id":7245719,"avatar_url":"https://avatars.githubusercontent.com/u/7245719?v=3","gravatar_id":"","url":"https://api.github.com/users/avocado-framework","html_url":"https://github.com/avocado-framework","followers_url":"https://api.github.com/users/avocado-framework/followers","following_url":"https://api.github.com/users/avocado-framework/following{/other_user}","gists_url":"https://api.github.com/users/avocado-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/avocado-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avocado-framework/subscriptions","organizations_url":"https://api.github.com/users/avocado-framework/orgs","repos_url":"https://api.github.com/users/avocado-framework/repos","events_url":"https://api.github.com/users/avocado-framework/events{/privacy}","received_events_url":"https://api.github.com/users/avocado-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/avocado-framework/avocado-misc-tests","description":"Avocado tests repository","fork":false,"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests","forks_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/forks","keys_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/teams","hooks_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/hooks","issue_events_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/events{/number}","events_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/events","assignees_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/assignees{/user}","branches_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/branches{/branch}","tags_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/tags","blobs_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/languages","stargazers_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/stargazers","contributors_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/contributors","subscribers_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/subscribers","subscription_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/subscription","commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/contents/{+path}","compare_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/merges","archive_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/downloads","issues_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues{/number}","pulls_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/labels{/name}","releases_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/releases{/id}","deployments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/deployments","created_at":"2016-01-18T19:48:34Z","updated_at":"2016-07-22T14:49:34Z","pushed_at":"2016-08-01T10:39:39Z","git_url":"git://github.com/avocado-framework/avocado-misc-tests.git","ssh_url":"git@github.com:avocado-framework/avocado-misc-tests.git","clone_url":"https://github.com/avocado-framework/avocado-misc-tests.git","svn_url":"https://github.com/avocado-framework/avocado-misc-tests","homepage":null,"size":1564,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":23,"forks":19,"open_issues":23,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117"},"html":{"href":"https://github.com/avocado-framework/avocado-misc-tests/pull/117"},"issue":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/117"},"comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/afd656bfb3e89643563315e70adeab399c69244e"}}}}
{"actor":{"display_login":"apahim"}}