-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add spread suite for cmake plugin
Move the plugin and snapd integration tests for the CMake plugin into a Spread suite. LP: #1783830 Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
- Loading branch information
Showing
17 changed files
with
84 additions
and
119 deletions.
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" ] |
File renamed without changes.
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
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.
File renamed without changes.
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" | ||
} |