Skip to content
Snippets Groups Projects
Commit 0bfbcaf3 authored by Johannes Marbach's avatar Johannes Marbach
Browse files

Add tests for version flag

parent 194a090d
No related branches found
No related tags found
No related merge requests found
Showing
with 168 additions and 40 deletions
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
......
#!/bin/bash
rm -rf _build
meson _build
meson compile -C _build
#!/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
}
#!/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"
#!/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
#!/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:]]\+"
}
#!/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"
}
source "$(dirname "${BASH_SOURCE[0]}")/../../test/helpers.sh"
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
}
\ No newline at end of file
......@@ -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
......
#!/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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment