{"action":"created","comment":{"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments/74723722","id":74723722,"diff_hunk":"@@ -0,0 +1,114 @@\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: Narasimhan V <sim@linux.vnet.ibm.com>\n+\n+\"\"\"\n+NVM-Express user space tooling for Linux, which handles NVMe devices.\n+This Suite creates and formats a namespace, reads and writes on it\n+using nvme cli.\n+\"\"\"\n+\n+import os\n+from avocado import Test\n+from avocado import main\n+from avocado.utils import build\n+from avocado.utils import process\n+import avocado.utils.git as git\n+\n+\n+class NVMeTest(Test):\n+\n+    \"\"\"\n+    NVM-Express user space tooling for Linux, which handles NVMe devices.\n+\n+    :param device: Name of the nvme device\n+    \"\"\"\n+\n+    def setUp(self):\n+        \"\"\"\n+        Build 'nvme-cli' and setup the device.\n+        \"\"\"\n+        nvme_path = os.path.join(self.srcdir, 'nvme')\n+        nvme_link = 'https://github.com/linux-nvme/nvme-cli.git'\n+        git.get_repo(nvme_link, destination_dir=nvme_path)\n+        build.make(nvme_path)\n+        build.make(nvme_path, extra_args='install')\n+        self.device = self.params.get('device', default='/dev/nvme0')\n+        # cmd = \"ls -l %sn* | sort | awk '{print $NF}'\" % self.device\n+        # self.id_ns = process.system_output(cmd, shell=True).strip('\\n'):\n+        # if 'No such file or directory' in self.id_ns:\n+        #     self.id_ns = self.device + 'n1'\n+        self.id_ns = self.create_namespace()\n+        self.format_namespace()\n+        cmd = \"nvme id-ns %s | grep 'in use' | awk '{print $5}' | \\\n+            awk -F':' '{print $NF}'\" % self.id_ns\n+        self.format_size = process.system_output(cmd, shell=True).strip('\\n')\n+        self.format_size = pow(2, int(self.format_size))\n+        cmd = \"nvme id-ns %s | grep 'in use' | awk '{print $2}'\" % self.id_ns\n+        self.lba = process.system_output(cmd, shell=True).strip('\\n')\n+        print self.device, self.id_ns, self.lba, self.format_size\n+\n+    def create_namespace(self):\n+        \"\"\"\n+        Creates namespace on the device.\n+        \"\"\"\n+        cmd = \"nvme show-regs %s | grep version | awk '{print $NF}'\" \\\n+            % self.device\n+        if int(process.system_output(cmd, shell=True).strip('\\n')) < 10200:\n+            return self.device + 'n1'","path":"io/disk/ssd/nvmetest.py","position":70,"original_position":70,"commit_id":"9970a034e05db285c5bf449b64819391f4da4dae","original_commit_id":"9970a034e05db285c5bf449b64819391f4da4dae","user":{"login":"narasimhan-v","id":16101053,"avatar_url":"https://avatars.githubusercontent.com/u/16101053?v=3","gravatar_id":"","url":"https://api.github.com/users/narasimhan-v","html_url":"https://github.com/narasimhan-v","followers_url":"https://api.github.com/users/narasimhan-v/followers","following_url":"https://api.github.com/users/narasimhan-v/following{/other_user}","gists_url":"https://api.github.com/users/narasimhan-v/gists{/gist_id}","starred_url":"https://api.github.com/users/narasimhan-v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narasimhan-v/subscriptions","organizations_url":"https://api.github.com/users/narasimhan-v/orgs","repos_url":"https://api.github.com/users/narasimhan-v/repos","events_url":"https://api.github.com/users/narasimhan-v/events{/privacy}","received_events_url":"https://api.github.com/users/narasimhan-v/received_events","type":"User","site_admin":false},"body":"That is because I am yet to implement the determination of actual self.id_ns value, for which I need a latest adapter.\r\nSince I do not have that yet, this is a placeholder.\r\nI have mentioned this in TODO","created_at":"2016-08-15T06:18:48Z","updated_at":"2016-08-15T06:18:48Z","html_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/136#discussion_r74723722","pull_request_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/comments/74723722"},"html":{"href":"https://github.com/avocado-framework/avocado-misc-tests/pull/136#discussion_r74723722"},"pull_request":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136","id":81215987,"html_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/136","diff_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/136.diff","patch_url":"https://github.com/avocado-framework/avocado-misc-tests/pull/136.patch","issue_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/136","number":136,"state":"open","locked":false,"title":"Adding NVMe cli tests","user":{"login":"narasimhan-v","id":16101053,"avatar_url":"https://avatars.githubusercontent.com/u/16101053?v=3","gravatar_id":"","url":"https://api.github.com/users/narasimhan-v","html_url":"https://github.com/narasimhan-v","followers_url":"https://api.github.com/users/narasimhan-v/followers","following_url":"https://api.github.com/users/narasimhan-v/following{/other_user}","gists_url":"https://api.github.com/users/narasimhan-v/gists{/gist_id}","starred_url":"https://api.github.com/users/narasimhan-v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narasimhan-v/subscriptions","organizations_url":"https://api.github.com/users/narasimhan-v/orgs","repos_url":"https://api.github.com/users/narasimhan-v/repos","events_url":"https://api.github.com/users/narasimhan-v/events{/privacy}","received_events_url":"https://api.github.com/users/narasimhan-v/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Narasimhan V <sim@linux.vnet.ibm.com>","created_at":"2016-08-13T13:38:14Z","updated_at":"2016-08-15T06:18:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a3f0c30efd4d568d4a347462efdb135c757edc3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136/commits","review_comments_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136/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/136/comments","statuses_url":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/9970a034e05db285c5bf449b64819391f4da4dae","head":{"label":"narasimhan-v:nvme_test","ref":"nvme_test","sha":"9970a034e05db285c5bf449b64819391f4da4dae","user":{"login":"narasimhan-v","id":16101053,"avatar_url":"https://avatars.githubusercontent.com/u/16101053?v=3","gravatar_id":"","url":"https://api.github.com/users/narasimhan-v","html_url":"https://github.com/narasimhan-v","followers_url":"https://api.github.com/users/narasimhan-v/followers","following_url":"https://api.github.com/users/narasimhan-v/following{/other_user}","gists_url":"https://api.github.com/users/narasimhan-v/gists{/gist_id}","starred_url":"https://api.github.com/users/narasimhan-v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narasimhan-v/subscriptions","organizations_url":"https://api.github.com/users/narasimhan-v/orgs","repos_url":"https://api.github.com/users/narasimhan-v/repos","events_url":"https://api.github.com/users/narasimhan-v/events{/privacy}","received_events_url":"https://api.github.com/users/narasimhan-v/received_events","type":"User","site_admin":false},"repo":{"id":57947554,"name":"avocado-misc-tests","full_name":"narasimhan-v/avocado-misc-tests","owner":{"login":"narasimhan-v","id":16101053,"avatar_url":"https://avatars.githubusercontent.com/u/16101053?v=3","gravatar_id":"","url":"https://api.github.com/users/narasimhan-v","html_url":"https://github.com/narasimhan-v","followers_url":"https://api.github.com/users/narasimhan-v/followers","following_url":"https://api.github.com/users/narasimhan-v/following{/other_user}","gists_url":"https://api.github.com/users/narasimhan-v/gists{/gist_id}","starred_url":"https://api.github.com/users/narasimhan-v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narasimhan-v/subscriptions","organizations_url":"https://api.github.com/users/narasimhan-v/orgs","repos_url":"https://api.github.com/users/narasimhan-v/repos","events_url":"https://api.github.com/users/narasimhan-v/events{/privacy}","received_events_url":"https://api.github.com/users/narasimhan-v/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/narasimhan-v/avocado-misc-tests","description":"Avocado tests repository","fork":true,"url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests","forks_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/forks","keys_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/teams","hooks_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/hooks","issue_events_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/issues/events{/number}","events_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/events","assignees_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/assignees{/user}","branches_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/branches{/branch}","tags_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/tags","blobs_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/statuses/{sha}","languages_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/languages","stargazers_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/stargazers","contributors_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/contributors","subscribers_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/subscribers","subscription_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/subscription","commits_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/contents/{+path}","compare_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/merges","archive_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/downloads","issues_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/issues{/number}","pulls_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/pulls{/number}","milestones_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/milestones{/number}","notifications_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/labels{/name}","releases_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/releases{/id}","deployments_url":"https://api.github.com/repos/narasimhan-v/avocado-misc-tests/deployments","created_at":"2016-05-03T06:45:22Z","updated_at":"2016-05-03T06:45:23Z","pushed_at":"2016-08-13T13:38:06Z","git_url":"git://github.com/narasimhan-v/avocado-misc-tests.git","ssh_url":"git@github.com:narasimhan-v/avocado-misc-tests.git","clone_url":"https://github.com/narasimhan-v/avocado-misc-tests.git","svn_url":"https://github.com/narasimhan-v/avocado-misc-tests","homepage":null,"size":1468,"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":"6c90bd974929e832e1928bab1b8feee340e80efb","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-14T15:38:19Z","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":1598,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":20,"forks":20,"open_issues":20,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136"},"html":{"href":"https://github.com/avocado-framework/avocado-misc-tests/pull/136"},"issue":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/136"},"comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/pulls/136/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/136/commits"},"statuses":{"href":"https://api.github.com/repos/avocado-framework/avocado-misc-tests/statuses/9970a034e05db285c5bf449b64819391f4da4dae"}}}}
{"actor":{"display_login":"narasimhan-v"}}