Skip to content
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

tests: add spread suite for kbuild plugin #2203

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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
tests/spread/plugins/nil/:
summary: tests of snapcraft's Nil plugin

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/