Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/1783840/rub…
Browse files Browse the repository at this point in the history
…y_plugin_spread

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
  • Loading branch information
kyrofa committed Aug 10, 2018
2 parents 4db87a7 + a0d0297 commit 58c445f
Show file tree
Hide file tree
Showing 27 changed files with 145 additions and 193 deletions.
9 changes: 6 additions & 3 deletions debian/tests/integrationtests-spread
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ systemctl reload sshd.service
# Spread will only build with recent go
snap install --classic go

# and now run spread against localhost
# shellcheck disable=SC1091
. /etc/os-release
export GOPATH=/tmp/go
/snap/bin/go get -u github.com/snapcore/spread/cmd/spread

# Remove the go snap since we want to test (among other things) the Go plugin
sudo snap remove go

# and now run spread against localhost
# shellcheck disable=SC1091
. /etc/os-release
export SNAPCRAFT_PACKAGE_TYPE="deb"
/tmp/go/bin/spread -v "autopkgtest:${ID}-${VERSION_ID}-$(dpkg --print-architecture)"

Expand Down
6 changes: 6 additions & 0 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,18 @@ suites:
summary: tests of snapcraft's CMake plugin
tests/spread/plugins/go/:
summary: tests of snapcraft's Go plugin
tests/spread/plugins/godeps/:
summary: tests of snapcraft's Godeps plugin
tests/spread/plugins/kbuild/:
summary: tests of snapcraft's Kbuild plugin
tests/spread/plugins/meson/:
summary: tests of snapcraft's Meson plugin
tests/spread/plugins/nil/:
summary: tests of snapcraft's Nil plugin
tests/spread/plugins/ruby/:
summary: tests of snapcraft's Ruby plugin
tests/spread/plugins/scons/:
summary: tests of snapcraft's SCons plugin

spread_tests/:
summary: old tests of the snapcraft snap, being phased out
Expand Down
68 changes: 0 additions & 68 deletions tests/integration/plugins/test_godeps_plugin.py

This file was deleted.

31 changes: 0 additions & 31 deletions tests/integration/plugins/test_meson_plugin.py

This file was deleted.

31 changes: 0 additions & 31 deletions tests/integration/plugins/test_scons_plugin.py

This file was deleted.

32 changes: 0 additions & 32 deletions tests/integration/snapd/test_scons_snap.py

This file was deleted.

5 changes: 0 additions & 5 deletions tests/integration/snaps/meson-hello/main.c

This file was deleted.

2 changes: 0 additions & 2 deletions tests/integration/snaps/meson-hello/meson.build

This file was deleted.

Empty file.
5 changes: 0 additions & 5 deletions tests/integration/snaps/scons-hello/main.c

This file was deleted.

27 changes: 27 additions & 0 deletions tests/spread/plugins/godeps/run-with-go-packages/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
summary: Build and run a Godeps snap using go-packages

environment:
SNAP_DIR: ../snaps/godeps-with-go-packages
GOBIN/gobin: gobin
GOBIN/no_gobin:

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap
execute: |
if [ -z "$GOBIN" ]; then
unset GOBIN
fi
cd "$SNAP_DIR"
snapcraft
sudo snap install godeps-with-go-packages_*.snap --dangerous
# Verify that bcrypt was not built
[ ! -e "prime/bin/bcrypt" ]
hash="$(godeps-with-go-packages.bcrypt hash 10 password)"
check="$(godeps-with-go-packages.bcrypt check "$hash" password)"
[ "$check" = "Equal" ]
24 changes: 24 additions & 0 deletions tests/spread/plugins/godeps/run/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
summary: Build and run a basic Godeps snap

environment:
SNAP_DIR: ../snaps/godeps
GOBIN/gobin: gobin
GOBIN/no_gobin:

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap
execute: |
if [ -z "$GOBIN" ]; then
unset GOBIN
fi
cd "$SNAP_DIR"
snapcraft
sudo snap install godeps_*.snap --dangerous
hash="$(godeps.bcrypt hash 10 password)"
check="$(godeps.bcrypt check "$hash" password)"
[ "$check" = "Equal" ]
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
name: test-godeps-with-go-packages
version: 0.1
name: godeps-with-go-packages
version: '1.0'
summary: A simple godeps project which targets a specific go package.
description: |
By unsing go-packages this we ensure that only `only-main` gets built
while the bcrypt in the source does not
grade: devel
confinement: strict

apps:
bcrypt:
command: only-main

parts:
simple-godeps:
plugin: godeps
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: test-package
version: 0.1
name: godeps
version: '1.0'
summary: A simple godeps project.
description: |
Proves that it is possible to build a snap using godeps.
grade: devel
confinement: strict

apps:
bcrypt:
command: bcrypt

parts:
simple-godeps:
plugin: godeps
Expand Down
18 changes: 18 additions & 0 deletions tests/spread/plugins/meson/run/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
summary: Build and run a basic meson snap

environment:
SNAP_DIR: ../snaps/meson-hello

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap
# There is no meson on trusty
systems: [-ubuntu-14.04*]

execute: |
cd "$SNAP_DIR"
snapcraft
sudo snap install meson-hello_*.snap --dangerous
[ "$(meson-hello)" = "hello world" ]
7 changes: 7 additions & 0 deletions tests/spread/plugins/meson/snaps/meson-hello/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h>

int main()
{
printf("hello world\n");
return 0;
}
2 changes: 2 additions & 0 deletions tests/spread/plugins/meson/snaps/meson-hello/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project('meson-hello', 'c')
executable('hello', 'main.c', install : true)
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: meson-hello
version: 0.1
version: '1.0'
summary: test the meson plugin
description: |
This is a basic meson snap. It just prints a hello world.
If you want to add other functionalities to this snap, please don't.
Make a new one.
grade: devel
confinement: strict

build-packages: [gcc, libc6-dev]
apps:
meson-hello:
command: hello

parts:
meson-project:
meson-parameters:
- --prefix=/opt
plugin: meson
source: .
meson-parameters:
- --prefix=/
build-packages: [gcc, libc6-dev]
15 changes: 15 additions & 0 deletions tests/spread/plugins/scons/run/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
summary: Build and run a basic SCons snap

environment:
SNAP_DIR: ../snaps/scons-hello

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap
execute: |
cd "$SNAP_DIR"
snapcraft
sudo snap install scons-hello_*.snap --dangerous
[ "$(scons-hello)" = "hello world" ]
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ AddOption('--prefix',
help='installation prefix')

env = Environment()
hello = env.Program('main.c')
hello = env.Program('hello', 'main.c')
DESTDIR = os.environ.get('DESTDIR', '')

if DESTDIR:
Expand Down

0 comments on commit 58c445f

Please sign in to comment.