{"action":"created","comment":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/comments/119873587","pull_request_review_id":41794259,"id":119873587,"diff_hunk":"@@ -0,0 +1,97 @@\n+summary: Ensure that the alsa interface works.\n+\n+details: |\n+    The alsa interface allows connected plugs to access raw ALSA devices.\n+\n+    A snap which defines a alsa plug must be shown in the interfaces list.\n+    The plug must not be autoconnected on install and, as usual, must be able to\n+    be reconnected.\n+\n+    A snap declaring a plug on this interface must be able to access to raw ALSA\n+    devices, for this test we check the low level security rules by creating\n+    specific devices under /dev/snd, a cgroup if needed and the ALSA state dir,\n+    exercising in each caase the read or read-write permissions that must be in\n+    place.\n+\n+prepare: |\n+    echo \"Given a snap declaring a plug on the alsa interface is installed\"\n+    . $TESTSLIB/snaps.sh\n+    install_generic_consumer alsa\n+\n+restore: |\n+    rm -f *.error /dev/snd/mysnd-dev\n+\n+execute: |\n+    CONNECTED_PATTERN=\":alsa +generic-consumer\"\n+    DISCONNECTED_PATTERN=\"\\- +generic-consumer:alsa\"\n+\n+    echo \"The plug is not connected by default\"\n+    snap interfaces | MATCH \"$DISCONNECTED_PATTERN\"\n+\n+    echo \"===================================\"\n+\n+    echo \"When the plug is connected\"\n+    snap connect generic-consumer:alsa\n+    snap interfaces | MATCH \"$CONNECTED_PATTERN\"\n+\n+    echo \"Then the snap is able to access snd devices\"\n+    generic-consumer.cmd touch /dev/snd/mysnd-dev\n+    echo \"mysnd-dev-content\" | tee /dev/snd/mysnd-dev\n+    generic-consumer.cmd cat /dev/snd/mysnd-dev | MATCH mysnd-dev-content\n+    generic-consumer.cmd rm /dev/snd/mysnd-dev\n+\n+    echo \"And the snap is able to access the related udev data\"\n+    if [ ! -f /run/udev/data/c116:0 ]; then\n+        touch /run/udev/data/c116:0\n+        echo \"myudevdata-content\" | tee /run/udev/data/c116:0\n+        generic-consumer.cmd cat /run/udev/data/c116:0 | MATCH myudevdata-content\n+        rm /run/udev/data/c116:0\n+    fi\n+\n+    # TODO: extend test to check /var/lib/alsa with plug connected when\n+    # https://bugs.launchpad.net/snapd/+bug/1694281 is fixed\n+\n+    if [ \"$(snap debug confinement)\" = none ] ; then\n+        echo \"Do not execute checks with disconnected plug on systems where confinement doesn't work\"\n+        exit 0\n+    fi\n+\n+    echo \"===================================\"\n+\n+    echo \"When the plug is disconnected\"\n+    snap disconnect generic-consumer:alsa\n+    snap interfaces | MATCH \"$DISCONNECTED_PATTERN\"\n+\n+    echo \"The snap is not able to access snd devices\"\n+    if generic-consumer.cmd touch /dev/snd/mysnd-dev 2>snd-create.error; then\n+        echo \"Create snd device with disconnected plug should fail\"\n+        exit 1\n+    fi\n+    MATCH \"Permission denied\" ./snd-create.error","path":"tests/main/interfaces-alsa/task.yaml","position":70,"original_position":70,"commit_id":"cb79e69c4a1fca1a795f487e1c11fbf4e35b3c05","original_commit_id":"cb79e69c4a1fca1a795f487e1c11fbf4e35b3c05","user":{"login":"niemeyer","id":378683,"avatar_url":"https://avatars0.githubusercontent.com/u/378683?v=3","gravatar_id":"","url":"https://api.github.com/users/niemeyer","html_url":"https://github.com/niemeyer","followers_url":"https://api.github.com/users/niemeyer/followers","following_url":"https://api.github.com/users/niemeyer/following{/other_user}","gists_url":"https://api.github.com/users/niemeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/niemeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niemeyer/subscriptions","organizations_url":"https://api.github.com/users/niemeyer/orgs","repos_url":"https://api.github.com/users/niemeyer/repos","events_url":"https://api.github.com/users/niemeyer/events{/privacy}","received_events_url":"https://api.github.com/users/niemeyer/received_events","type":"User","site_admin":false},"body":"That won't work at the moment. If the matching fails, it won't print the file content.\r\n\r\nThat said, let's leave it as is and fix MATCH in spread instead.","created_at":"2017-06-02T14:40:29Z","updated_at":"2017-06-02T14:40:30Z","html_url":"https://github.com/snapcore/snapd/pull/3408#discussion_r119873587","pull_request_url":"https://api.github.com/repos/snapcore/snapd/pulls/3408","_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments/119873587"},"html":{"href":"https://github.com/snapcore/snapd/pull/3408#discussion_r119873587"},"pull_request":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/3408"}}},"pull_request":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/3408","id":122910289,"html_url":"https://github.com/snapcore/snapd/pull/3408","diff_url":"https://github.com/snapcore/snapd/pull/3408.diff","patch_url":"https://github.com/snapcore/snapd/pull/3408.patch","issue_url":"https://api.github.com/repos/snapcore/snapd/issues/3408","number":3408,"state":"open","locked":false,"title":"tests: add alsa interface spread test","user":{"login":"fgimenez","id":70376,"avatar_url":"https://avatars1.githubusercontent.com/u/70376?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimenez","html_url":"https://github.com/fgimenez","followers_url":"https://api.github.com/users/fgimenez/followers","following_url":"https://api.github.com/users/fgimenez/following{/other_user}","gists_url":"https://api.github.com/users/fgimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimenez/subscriptions","organizations_url":"https://api.github.com/users/fgimenez/orgs","repos_url":"https://api.github.com/users/fgimenez/repos","events_url":"https://api.github.com/users/fgimenez/events{/privacy}","received_events_url":"https://api.github.com/users/fgimenez/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-05-29T14:59:42Z","updated_at":"2017-06-02T14:40:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f783693a6dfe5d56eb80cba9efe85b179e1b008f","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/snapcore/snapd/pulls/3408/commits","review_comments_url":"https://api.github.com/repos/snapcore/snapd/pulls/3408/comments","review_comment_url":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snapcore/snapd/issues/3408/comments","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/cb79e69c4a1fca1a795f487e1c11fbf4e35b3c05","head":{"label":"fgimenez:spread-alsa-interface","ref":"spread-alsa-interface","sha":"cb79e69c4a1fca1a795f487e1c11fbf4e35b3c05","user":{"login":"fgimenez","id":70376,"avatar_url":"https://avatars1.githubusercontent.com/u/70376?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimenez","html_url":"https://github.com/fgimenez","followers_url":"https://api.github.com/users/fgimenez/followers","following_url":"https://api.github.com/users/fgimenez/following{/other_user}","gists_url":"https://api.github.com/users/fgimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimenez/subscriptions","organizations_url":"https://api.github.com/users/fgimenez/orgs","repos_url":"https://api.github.com/users/fgimenez/repos","events_url":"https://api.github.com/users/fgimenez/events{/privacy}","received_events_url":"https://api.github.com/users/fgimenez/received_events","type":"User","site_admin":false},"repo":{"id":45098487,"name":"snappy","full_name":"fgimenez/snappy","owner":{"login":"fgimenez","id":70376,"avatar_url":"https://avatars1.githubusercontent.com/u/70376?v=3","gravatar_id":"","url":"https://api.github.com/users/fgimenez","html_url":"https://github.com/fgimenez","followers_url":"https://api.github.com/users/fgimenez/followers","following_url":"https://api.github.com/users/fgimenez/following{/other_user}","gists_url":"https://api.github.com/users/fgimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/fgimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgimenez/subscriptions","organizations_url":"https://api.github.com/users/fgimenez/orgs","repos_url":"https://api.github.com/users/fgimenez/repos","events_url":"https://api.github.com/users/fgimenez/events{/privacy}","received_events_url":"https://api.github.com/users/fgimenez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fgimenez/snappy","description":"Snappy is the software at the heart of Ubuntu Core.","fork":true,"url":"https://api.github.com/repos/fgimenez/snappy","forks_url":"https://api.github.com/repos/fgimenez/snappy/forks","keys_url":"https://api.github.com/repos/fgimenez/snappy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fgimenez/snappy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fgimenez/snappy/teams","hooks_url":"https://api.github.com/repos/fgimenez/snappy/hooks","issue_events_url":"https://api.github.com/repos/fgimenez/snappy/issues/events{/number}","events_url":"https://api.github.com/repos/fgimenez/snappy/events","assignees_url":"https://api.github.com/repos/fgimenez/snappy/assignees{/user}","branches_url":"https://api.github.com/repos/fgimenez/snappy/branches{/branch}","tags_url":"https://api.github.com/repos/fgimenez/snappy/tags","blobs_url":"https://api.github.com/repos/fgimenez/snappy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fgimenez/snappy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fgimenez/snappy/git/refs{/sha}","trees_url":"https://api.github.com/repos/fgimenez/snappy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fgimenez/snappy/statuses/{sha}","languages_url":"https://api.github.com/repos/fgimenez/snappy/languages","stargazers_url":"https://api.github.com/repos/fgimenez/snappy/stargazers","contributors_url":"https://api.github.com/repos/fgimenez/snappy/contributors","subscribers_url":"https://api.github.com/repos/fgimenez/snappy/subscribers","subscription_url":"https://api.github.com/repos/fgimenez/snappy/subscription","commits_url":"https://api.github.com/repos/fgimenez/snappy/commits{/sha}","git_commits_url":"https://api.github.com/repos/fgimenez/snappy/git/commits{/sha}","comments_url":"https://api.github.com/repos/fgimenez/snappy/comments{/number}","issue_comment_url":"https://api.github.com/repos/fgimenez/snappy/issues/comments{/number}","contents_url":"https://api.github.com/repos/fgimenez/snappy/contents/{+path}","compare_url":"https://api.github.com/repos/fgimenez/snappy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fgimenez/snappy/merges","archive_url":"https://api.github.com/repos/fgimenez/snappy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fgimenez/snappy/downloads","issues_url":"https://api.github.com/repos/fgimenez/snappy/issues{/number}","pulls_url":"https://api.github.com/repos/fgimenez/snappy/pulls{/number}","milestones_url":"https://api.github.com/repos/fgimenez/snappy/milestones{/number}","notifications_url":"https://api.github.com/repos/fgimenez/snappy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fgimenez/snappy/labels{/name}","releases_url":"https://api.github.com/repos/fgimenez/snappy/releases{/id}","deployments_url":"https://api.github.com/repos/fgimenez/snappy/deployments","created_at":"2015-10-28T08:23:58Z","updated_at":"2016-01-14T08:49:44Z","pushed_at":"2017-06-02T13:49:48Z","git_url":"git://github.com/fgimenez/snappy.git","ssh_url":"git@github.com:fgimenez/snappy.git","clone_url":"https://github.com/fgimenez/snappy.git","svn_url":"https://github.com/fgimenez/snappy","homepage":null,"size":48279,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"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":"snapcore:master","ref":"master","sha":"77d61daee0c95aa3689f6548f3c3f9614f89187a","user":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars2.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"name":"snapd","full_name":"snapcore/snapd","owner":{"login":"snapcore","id":19532717,"avatar_url":"https://avatars2.githubusercontent.com/u/19532717?v=3","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snapcore/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":false,"url":"https://api.github.com/repos/snapcore/snapd","forks_url":"https://api.github.com/repos/snapcore/snapd/forks","keys_url":"https://api.github.com/repos/snapcore/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snapcore/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snapcore/snapd/teams","hooks_url":"https://api.github.com/repos/snapcore/snapd/hooks","issue_events_url":"https://api.github.com/repos/snapcore/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/snapcore/snapd/events","assignees_url":"https://api.github.com/repos/snapcore/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/snapcore/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/snapcore/snapd/tags","blobs_url":"https://api.github.com/repos/snapcore/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snapcore/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snapcore/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/snapcore/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/snapcore/snapd/languages","stargazers_url":"https://api.github.com/repos/snapcore/snapd/stargazers","contributors_url":"https://api.github.com/repos/snapcore/snapd/contributors","subscribers_url":"https://api.github.com/repos/snapcore/snapd/subscribers","subscription_url":"https://api.github.com/repos/snapcore/snapd/subscription","commits_url":"https://api.github.com/repos/snapcore/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/snapcore/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/snapcore/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/snapcore/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/snapcore/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/snapcore/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snapcore/snapd/merges","archive_url":"https://api.github.com/repos/snapcore/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snapcore/snapd/downloads","issues_url":"https://api.github.com/repos/snapcore/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/snapcore/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/snapcore/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/snapcore/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snapcore/snapd/labels{/name}","releases_url":"https://api.github.com/repos/snapcore/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/snapcore/snapd/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2017-06-01T14:41:29Z","pushed_at":"2017-06-02T14:29:35Z","git_url":"git://github.com/snapcore/snapd.git","ssh_url":"git@github.com:snapcore/snapd.git","clone_url":"https://github.com/snapcore/snapd.git","svn_url":"https://github.com/snapcore/snapd","homepage":"","size":48255,"stargazers_count":727,"watchers_count":727,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":178,"mirror_url":null,"open_issues_count":33,"forks":178,"open_issues":33,"watchers":727,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/3408"},"html":{"href":"https://github.com/snapcore/snapd/pull/3408"},"issue":{"href":"https://api.github.com/repos/snapcore/snapd/issues/3408"},"comments":{"href":"https://api.github.com/repos/snapcore/snapd/issues/3408/comments"},"review_comments":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/3408/comments"},"review_comment":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/3408/commits"},"statuses":{"href":"https://api.github.com/repos/snapcore/snapd/statuses/cb79e69c4a1fca1a795f487e1c11fbf4e35b3c05"}}}}
{"actor":{"display_login":"niemeyer"}}