-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/snap-update-ns: fix mount rules for font sharing #4136
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19671ee
cmd/snap-update-ns: fix mount rules for font sharing
zyga a4804c6
Adding test for desktop interface
sergiocazzolato e39528a
tests: check font sharing in the desktop interface
zyga 43d3fba
Merge remote-tracking branch 'upstream/master' into fix/font-sharing
mvo5 7d959de
Merge remote-tracking branch 'upstream/master' into HEAD
mvo5 dd810cd
cmd/snap-update-ns: fix collection of changes made
zyga File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
for dir in "$@"; do | ||
ls $dir | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
for file in "$@"; do | ||
cat $file | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: test-snapd-desktop | ||
version: 1.0 | ||
summary: Basic desktop interface test snap | ||
description: A basic snap to access dektop interface | ||
|
||
apps: | ||
check-files: | ||
command: bin/check-files | ||
plugs: [desktop] | ||
check-dirs: | ||
command: bin/check-dirs | ||
plugs: [desktop] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
summary: Ensure that the desktop interface works. | ||
|
||
details: | | ||
The desktop interface allows to access the different resources. | ||
|
||
The test-snapd-desktop snap checks files and dirs are accessible through the | ||
desktop interface. | ||
|
||
systems: [-ubuntu-core-*] | ||
|
||
prepare: | | ||
echo "Given the desktop snap is installed" | ||
snap try $TESTSLIB/snaps/test-snapd-desktop | ||
|
||
execute: | | ||
CONNECTED_PATTERN=":desktop +test-snapd-desktop" | ||
DISCONNECTED_PATTERN="\- +test-snapd-desktop:desktop" | ||
|
||
dirs="/var/cache/fontconfig /usr/share/icons /usr/share/pixmaps" | ||
files="/etc/xdg/user-dirs.conf /etc/xdg/user-dirs.defaults" | ||
|
||
echo "The plug is connected by default" | ||
snap interfaces | MATCH "$CONNECTED_PATTERN" | ||
|
||
echo "Then the snap is able to desktop files and directories" | ||
test-snapd-desktop.check-files $files | ||
test-snapd-desktop.check-dirs $dirs | ||
|
||
echo "The mount namespace contains shared font directories" | ||
for d in /usr/share/fonts /usr/local/share/fonts /var/cache/fontconfig; do | ||
if [ -d "$d" ]; then | ||
cat /run/snapd/ns/snap.test-snapd-desktop.fstab | MATCH "$d" | ||
test-snapd-desktop.check-dirs "$d" | ||
fi | ||
done | ||
|
||
if [ "$(snap debug confinement)" = partial ] ; then | ||
exit 0 | ||
fi | ||
|
||
echo "When the plug is disconnected" | ||
snap disconnect test-snapd-desktop:desktop | ||
snap interfaces | MATCH "$DISCONNECTED_PATTERN" | ||
|
||
echo "Then the snap is not able to access the desktop files" | ||
for file in $files; do | ||
if test-snapd-desktop.check-files $file 2>${PWD}/call.error; then | ||
echo "Expected permission error calling desktop with disconnected plug" | ||
exit 1 | ||
fi | ||
MATCH "Permission denied" < call.error | ||
done | ||
|
||
echo "Then the snap is not able to access the desktop dirs" | ||
for dir in $dirs; do | ||
if test-snapd-desktop.check-dirs $dir 2>${PWD}/call.error; then | ||
echo "Expected permission error calling desktop with disconnected plug" | ||
exit 1 | ||
fi | ||
MATCH "Permission denied" < call.error | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/able to/able to access/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is coming from a patch by @sergiocazzolato