-
Notifications
You must be signed in to change notification settings - Fork 441
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 cmake plugin #2183
Merged
sergiusens
merged 3 commits into
canonical:master
from
kyrofa:feature/1783830/spread_cmake
Aug 2, 2018
Merged
Changes from 1 commit
Commits
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
summary: Build and run a basic cmake snap | ||
|
||
environment: | ||
SNAP_DIR: ../snaps/cmake-with-lib | ||
|
||
prepare: | | ||
. "$SETUP_DIR/config.sh" | ||
set_outdated_step_action "clean" | ||
|
||
restore: | | ||
. "$SETUP_DIR/config.sh" | ||
clear_config | ||
|
||
cd "$SNAP_DIR" | ||
snapcraft clean | ||
rm -f ./*.snap | ||
|
||
execute: | | ||
cd "$SNAP_DIR" | ||
output="$(snapcraft prime)" | ||
|
||
# Assert that cmake actually configured and built from scratch | ||
echo "$output" | MATCH "The CXX compiler identification" | ||
echo "$output" | MATCH "Building CXX object CMakeFiles/foo.dir/foo.cpp.o" | ||
echo "$output" | MATCH "Building CXX object CMakeFiles/usefoo.dir/main.cpp.o" | ||
|
||
[ "$(./prime/bin/usefoo)" = "foo" ] | ||
|
||
# Modify the source code | ||
cp new_foo.cpp src/foo.cpp | ||
|
||
# Prime again. This should rebuild | ||
output="$(snapcraft prime)" | ||
|
||
# Assert that cmake did not start from scratch, and reused everything it could | ||
echo "$output" | MATCH -v "The CXX compiler identification" | ||
echo "$output" | MATCH -v "Building CXX object CMakeFiles/usefoo.dir/main.cpp.o" | ||
echo "$output" | MATCH "Building CXX object CMakeFiles/foo.dir/foo.cpp.o" | ||
|
||
[ "$(./prime/bin/usefoo)" = "new foo" ] |
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,15 @@ | ||
summary: Build and run a basic cmake snap | ||
|
||
environment: | ||
SNAP_DIR: ../snaps/cmake-hello | ||
|
||
restore: | | ||
cd "$SNAP_DIR" | ||
snapcraft clean | ||
rm -f ./*.snap | ||
|
||
execute: | | ||
cd "$SNAP_DIR" | ||
snapcraft | ||
sudo snap install cmake-hello_*.snap --dangerous | ||
[ "$(cmake-hello)" = "hello world" ] |
2 changes: 1 addition & 1 deletion
2
...egration/snaps/cmake-hello/CMakeLists.txt → ...ns/cmake/snaps/cmake-hello/CMakeLists.txt
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
cmake_minimum_required(VERSION 2.6) | ||
project(cmake-hello C) | ||
add_executable(cmake-hello test.c) | ||
install(TARGETS cmake-hello RUNTIME DESTINATION bin) |
5 changes: 3 additions & 2 deletions
5
...egration/snaps/cmake-hello/snapcraft.yaml → ...ake/snaps/cmake-hello/snap/snapcraft.yaml
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
name: cmake-hello | ||
version: 0.1 | ||
version: 1.0 | ||
summary: test the cmake plugin | ||
description: | | ||
This is a basic cmake snap. It just prints a hello world. | ||
If you want to add other functionalities to this snap, please don't. | ||
Make a new one. | ||
icon: icon.png | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great, we do not need icons :-) |
||
|
||
grade: devel | ||
confinement: strict | ||
|
||
build-packages: [gcc, libc6-dev] | ||
|
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,7 @@ | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
printf("hello world\n"); | ||
return 0; | ||
} |
File renamed without changes.
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ parts: | |
my-part: | ||
plugin: cmake | ||
source: src/ | ||
build-packages: [g++] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,17 @@ | ||
#!/bin/sh -e | ||
|
||
export CONFIG_FILE_PATH="$HOME/.config/snapcraft/cli.cfg" | ||
mkdir -p "$(dirname "$CONFIG_FILE_PATH")" | ||
|
||
set_outdated_step_action() | ||
{ | ||
cat <<- EOF > "$CONFIG_FILE_PATH" | ||
[Lifecycle] | ||
outdated_step_action = $1 | ||
EOF | ||
} | ||
|
||
clear_config() | ||
{ | ||
rm -f "$CONFIG_FILE_PATH" | ||
} |
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.
this is missing quotes
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.
Sure, fixed.