Skip to content

Commit

Permalink
tests: add spread suite for kbuild plugin
Browse files Browse the repository at this point in the history
Move the plugin integration tests for the Kbuild plugin into a Spread
suite.

LP: #1783835

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
  • Loading branch information
kyrofa committed Aug 8, 2018
1 parent 1af1ae5 commit 6e74bd4
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 42 deletions.
2 changes: 2 additions & 0 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ suites:
summary: tests of snapcraft's CMake plugin
tests/spread/plugins/go/:
summary: tests of snapcraft's Go plugin
tests/spread/plugins/kbuild/:
summary: tests of snapcraft's Kbuild plugin

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

This file was deleted.

14 changes: 14 additions & 0 deletions tests/spread/plugins/kbuild/cross_compile/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
summary: Cross-compile a Kbuild snap

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

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap
execute: |
cd "$SNAP_DIR"
snapcraft stage --target-arch=armhf
file stage/bin/myapp | MATCH ",\s*ARM\s*,"
19 changes: 19 additions & 0 deletions tests/spread/plugins/kbuild/run/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
summary: Build and run a basic Kbuild snap

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

restore: |
cd "$SNAP_DIR"
snapcraft clean
rm -f ./*.snap
execute: |
cd "$SNAP_DIR"
snapcraft
sudo snap install kbuild-hello_*.snap --dangerous
# Verify that Foo was configured, and Bar was not
output="$(kbuild-hello.myapp | grep "You have configured" -A2)"
echo "$output" | MATCH "Foo"
echo "$output" | MATCH -v "Bar"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
#
CONFIG_CROSS_COMPILE=""
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
CONFIG_ENABLE_FOO_BAR=y
CONFIG_FOO=y
CONFIG_BAR=y
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: kbuild-hello
version: 1.0
version: '1.0'
summary: simple example using the kbuild build system
description: this is a basic snap using kbuild to build a hello-world
example program

grade: devel
confinement: strict

apps:
myapp:
command: myapp

parts:
kbuild-hello:
plugin: kbuild
Expand All @@ -13,8 +19,10 @@ parts:
build-packages: [gcc, libc6-dev]
kconfigfile: defconfig
kconfigs:
- CONFIG_FOO=n
# This is enabled in the defconfig, make sure we can override
- CONFIG_BAR=n
build-attributes: [no-install]
install: |
override-build: |
snapcraftctl build
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp myapp $SNAPCRAFT_PART_INSTALL/bin/

0 comments on commit 6e74bd4

Please sign in to comment.