-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some tests to be run in the ci add new examples
- Loading branch information
1 parent
6297e4b
commit d38b1ce
Showing
18 changed files
with
473 additions
and
180 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 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,6 @@ | ||
output/ | ||
.build/ | ||
rootfs-overlay/* | ||
rootfs-overlay/!README | ||
*~ | ||
|
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,10 @@ | ||
Some tests that are run after the images are built. This is used in the CI | ||
to make sure images are built as expected. | ||
|
||
Usage: `./run_all.sh <configuraion> <output-directory>` | ||
|
||
Example: | ||
|
||
```shell | ||
$ ./.test/run_all.sh example-x86_64.conf output | ||
``` |
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,24 @@ | ||
#!/bin/bash | ||
# run all tests for a given configuration. tests are run after images are | ||
# built. we do some simple assertions on the generated artifiacts to e.g. make | ||
# sure the configured packages are included etc. | ||
set -eou pipefail | ||
|
||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
CONF=$1 | ||
OUT=$2 | ||
RC=0 | ||
|
||
echo "----------------------------------------------------------------------" | ||
echo "run tests for $CONF" | ||
echo "----------------------------------------------------------------------" | ||
for t in "$SCRIPT_DIR"/test_*.sh; do | ||
if "$t" "$CONF" "$OUT"; then | ||
echo "test OK" | ||
else | ||
echo "test FAILED" | ||
RC=1 | ||
fi | ||
done | ||
|
||
exit $RC |
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,20 @@ | ||
#!/bin/bash | ||
source $1 | ||
DIR=$2 # e.g. output/ | ||
FAIL=0 | ||
|
||
fail() { | ||
echo " ERROR: $*" | ||
FAIL=1 | ||
} | ||
|
||
PREFIX="openwrt-$LEDE_RELEASE-$LEDE_TARGET-$LEDE_SUBTARGET-$LEDE_PROFILE" | ||
|
||
echo "Test if images are generated for $PREFIX ..." | ||
|
||
FILES=$(find "$DIR" -type f -name "$PREFIX-*.img.gz" \ | ||
-o -name "$PREFIX-*.bin" | wc -l) | ||
|
||
[ "$FILES" -eq "0" ] && fail "no images were built for $PREFIX" | ||
|
||
exit $FAIL |
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,26 @@ | ||
#!/bin/bash | ||
|
||
source $1 | ||
DIR=$2 # e.g. output/ | ||
FAIL=0 | ||
|
||
fail() { | ||
echo " ERROR: $*" | ||
FAIL=1 | ||
} | ||
|
||
PREFIX="openwrt-$LEDE_RELEASE-$LEDE_TARGET-$LEDE_SUBTARGET-$LEDE_PROFILE" | ||
MANIFEST="$DIR/$PREFIX.manifest" | ||
|
||
echo "Test all configured packages are in manifest file $MANIFEST..." | ||
if [ ! -f "$MANIFEST" ]; then | ||
fail "$MANIFEST does not exist" | ||
exit 1 | ||
fi | ||
|
||
for p in $LEDE_PACKAGES; do | ||
[[ $p == -* ]] && continue | ||
grep -q -E "^$p " "$MANIFEST" || fail "package not in manifest: $p" | ||
done | ||
|
||
exit $FAIL |
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,28 @@ | ||
#!/bin/bash | ||
|
||
source $1 | ||
DIR=$2 # e.g. output/ | ||
FAIL=0 | ||
|
||
fail() { | ||
echo " ERROR: $*" | ||
FAIL=1 | ||
} | ||
|
||
PREFIX="openwrt-$LEDE_RELEASE-$LEDE_TARGET-$LEDE_SUBTARGET-$LEDE_PROFILE" | ||
MANIFEST="$DIR/$PREFIX.manifest" | ||
|
||
echo "Test all excluded packages are not in manifest file $MANIFEST..." | ||
if [ ! -f "$MANIFEST" ]; then | ||
fail "$MANIFEST does not exist" | ||
exit 1 | ||
fi | ||
|
||
for p in $LEDE_PACKAGES; do | ||
# consider only excluded packages, starting with "-", e.g. "-ppp" | ||
[[ ! $p == -* ]] && continue | ||
p=${p:1} | ||
grep -q -E "^$p " "$MANIFEST" && fail "package not expected to be in manifest: $p" | ||
done | ||
|
||
exit $FAIL |
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
Oops, something went wrong.