Merge branch 'johannes/version-tests' into 'master'
Add tests for version flag See merge request postmarketOS/buffybox!18
This commit is contained in:
commit
1d38f532a8
14 changed files with 168 additions and 40 deletions
|
|
@ -1,14 +1,13 @@
|
|||
build-buffyboard:
|
||||
build-and-test-buffyboard:
|
||||
image: alpine:3.19
|
||||
tags:
|
||||
- saas-linux-small-amd64
|
||||
script:
|
||||
- apk -q add git build-base meson linux-headers inih-dev libinput-dev eudev-dev
|
||||
- apk -q add git bash build-base meson linux-headers inih-dev libinput-dev eudev-dev
|
||||
- git submodule init
|
||||
- git submodule update
|
||||
- cd buffyboard
|
||||
- meson _build
|
||||
- meson compile -C _build
|
||||
- ./test/test-all.sh
|
||||
|
||||
build-and-test-unl0kr-with-drm:
|
||||
image: alpine:3.19
|
||||
|
|
|
|||
5
buffyboard/test/build.sh
Executable file
5
buffyboard/test/build.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -rf _build
|
||||
meson _build
|
||||
meson compile -C _build
|
||||
25
buffyboard/test/helpers.sh
Normal file
25
buffyboard/test/helpers.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/../../test/helpers.sh"
|
||||
|
||||
function run_buffyboard_async() {
|
||||
local log=$1
|
||||
local conf=$2
|
||||
|
||||
./_build/buffyboard -v -C "$conf" > "$log" 2>&1 &
|
||||
pid=$!
|
||||
sleep 3
|
||||
|
||||
kill -9 $pid
|
||||
wait $pid > /dev/null 2>&1
|
||||
}
|
||||
|
||||
function run_buffyboard_sync() {
|
||||
local log=$1
|
||||
shift
|
||||
local conf=$2
|
||||
shift
|
||||
local args=$@
|
||||
|
||||
./_build/buffyboard -v -C "$conf" $@ > "$log" 2>&1
|
||||
}
|
||||
8
buffyboard/test/test-all.sh
Executable file
8
buffyboard/test/test-all.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
root=$(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
source "$root/helpers.sh"
|
||||
|
||||
run_script "$root/build.sh"
|
||||
run_script "$root/test-version-matches-meson-and-changelog.sh"
|
||||
37
buffyboard/test/test-version-matches-meson-and-changelog.sh
Executable file
37
buffyboard/test/test-version-matches-meson-and-changelog.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
log=tmp.log
|
||||
|
||||
root=$(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
source "$root/helpers.sh"
|
||||
|
||||
function clean_up() {
|
||||
rm -f "$log"
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
info "Querying version from build.meson"
|
||||
meson_version=$(read_version_from_meson)
|
||||
|
||||
info "Querying version from CHANGELOG.md"
|
||||
changelog_version=$(read_version_from_changelog)
|
||||
|
||||
info "Verifying versions"
|
||||
if [[ "$meson_version" != "$changelog_version" ]]; then
|
||||
error "Version $meson_version from meson.build doesn't match version $changelog_version from CHANGELOG.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
info "Running buffyboard"
|
||||
run_buffyboard_sync "$log" "$conf" -V
|
||||
|
||||
info "Verifying output"
|
||||
if ! grep "buffyboard $meson_version" "$log"; then
|
||||
error "Expected version $meson_version"
|
||||
cat "$log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ok
|
||||
27
test/helpers.sh
Normal file
27
test/helpers.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
function info() {
|
||||
echo -e "[Info] $1"
|
||||
}
|
||||
|
||||
function error() {
|
||||
echo -e "\e[31m[Error]\e[0m $1"
|
||||
}
|
||||
|
||||
function ok() {
|
||||
echo -e "\e[32m[Ok]\e[0m $1"
|
||||
}
|
||||
|
||||
function run_script() {
|
||||
info "Executing $1"
|
||||
"$1"
|
||||
echo
|
||||
}
|
||||
|
||||
function read_version_from_meson() {
|
||||
grep "^[[:space:]]*version:" "$root/../meson.build" | head -n1 | grep -o "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"
|
||||
}
|
||||
|
||||
function read_version_from_changelog() {
|
||||
grep "^## [[:digit:]]" "$root/../../CHANGELOG.md" | head -n1 | grep -o "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"
|
||||
}
|
||||
|
|
@ -1,18 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
function info() {
|
||||
echo -e "[Info] $1"
|
||||
}
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/../../test/helpers.sh"
|
||||
|
||||
function error() {
|
||||
echo -e "\e[31m[Error]\e[0m $1"
|
||||
}
|
||||
|
||||
function ok() {
|
||||
echo -e "\e[32m[Ok]\e[0m $1"
|
||||
}
|
||||
|
||||
function run_unl0kr() {
|
||||
function run_unl0kr_async() {
|
||||
local log=$1
|
||||
local conf=$2
|
||||
|
||||
|
|
@ -23,3 +13,13 @@ function run_unl0kr() {
|
|||
kill -9 $pid
|
||||
wait $pid > /dev/null 2>&1
|
||||
}
|
||||
|
||||
function run_unl0kr_sync() {
|
||||
local log=$1
|
||||
shift
|
||||
local conf=$2
|
||||
shift
|
||||
local args=$@
|
||||
|
||||
./_build/unl0kr -v -C "$conf" $@ > "$log" 2>&1
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ backend=drm
|
|||
EOF
|
||||
|
||||
info "Running unl0kr"
|
||||
run_unl0kr "$log" "$conf"
|
||||
run_unl0kr_async "$log" "$conf"
|
||||
|
||||
info "Verifying output"
|
||||
if ! grep "Using DRM backend" "$log"; then
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ function clean_up() {
|
|||
trap clean_up EXIT
|
||||
|
||||
info "Running unl0kr"
|
||||
run_unl0kr "$log"
|
||||
run_unl0kr_async "$log"
|
||||
|
||||
info "Verifying output"
|
||||
if ! grep "Using framebuffer backend" "$log"; then
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ backend=drm
|
|||
EOF
|
||||
|
||||
info "Running unl0kr"
|
||||
run_unl0kr "$log" "$conf"
|
||||
run_unl0kr_async "$log" "$conf"
|
||||
|
||||
info "Verifying output"
|
||||
if ! grep "Using framebuffer backend" "$log"; then
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ backend=fb
|
|||
EOF
|
||||
|
||||
info "Running unl0kr"
|
||||
run_unl0kr "$log" "$conf"
|
||||
run_unl0kr_async "$log" "$conf"
|
||||
|
||||
info "Verifying output"
|
||||
if ! grep "Using framebuffer backend" "$log"; then
|
||||
|
|
|
|||
37
unl0kr/test/test-version-matches-meson-and-changelog.sh
Executable file
37
unl0kr/test/test-version-matches-meson-and-changelog.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
|
||||
log=tmp.log
|
||||
|
||||
root=$(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
source "$root/helpers.sh"
|
||||
|
||||
function clean_up() {
|
||||
rm -f "$log"
|
||||
}
|
||||
|
||||
trap clean_up EXIT
|
||||
|
||||
info "Querying version from build.meson"
|
||||
meson_version=$(read_version_from_meson)
|
||||
|
||||
info "Querying version from CHANGELOG.md"
|
||||
changelog_version=$(read_version_from_changelog)
|
||||
|
||||
info "Verifying versions"
|
||||
if [[ "$meson_version" != "$changelog_version" ]]; then
|
||||
error "Version $meson_version from meson.build doesn't match version $changelog_version from CHANGELOG.md"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
info "Running unl0kr"
|
||||
run_unl0kr_sync "$log" "$conf" -V
|
||||
|
||||
info "Verifying output"
|
||||
if ! grep "unl0kr $meson_version" "$log"; then
|
||||
error "Expected version $meson_version"
|
||||
cat "$log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ok
|
||||
|
|
@ -4,13 +4,8 @@ root=$(dirname "${BASH_SOURCE[0]}")
|
|||
|
||||
source "$root/helpers.sh"
|
||||
|
||||
function run() {
|
||||
info "Executing $1"
|
||||
"$1"
|
||||
echo
|
||||
}
|
||||
|
||||
run "$root/build-with-drm.sh"
|
||||
run "$root/test-uses-fb-backend-by-default.sh"
|
||||
run "$root/test-uses-fb-backend-if-selected-via-config.sh"
|
||||
run "$root/test-uses-drm-backend-if-selected-via-config-and-available.sh"
|
||||
run_script "$root/build-with-drm.sh"
|
||||
run_script "$root/test-version-matches-meson-and-changelog.sh"
|
||||
run_script "$root/test-uses-fb-backend-by-default.sh"
|
||||
run_script "$root/test-uses-fb-backend-if-selected-via-config.sh"
|
||||
run_script "$root/test-uses-drm-backend-if-selected-via-config-and-available.sh"
|
||||
|
|
|
|||
|
|
@ -4,13 +4,8 @@ root=$(dirname "${BASH_SOURCE[0]}")
|
|||
|
||||
source "$root/helpers.sh"
|
||||
|
||||
function run() {
|
||||
info "Executing $1"
|
||||
"$1"
|
||||
echo
|
||||
}
|
||||
|
||||
run "$root/build-without-drm.sh"
|
||||
run "$root/test-uses-fb-backend-by-default.sh"
|
||||
run "$root/test-uses-fb-backend-if-selected-via-config.sh"
|
||||
run "$root/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh"
|
||||
run_script "$root/build-without-drm.sh"
|
||||
run_script "$root/test-version-matches-meson-and-changelog.sh"
|
||||
run_script "$root/test-uses-fb-backend-by-default.sh"
|
||||
run_script "$root/test-uses-fb-backend-if-selected-via-config.sh"
|
||||
run_script "$root/test-uses-fb-backend-if-drm-selected-via-config-but-unavailable.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue