Add Buffyboard Man pages and Unify Build

This commit is contained in:
Undef 2024-07-26 16:40:49 +00:00 committed by Johannes Marbach
parent edeb5e4a35
commit 0eae2838dc
28 changed files with 243 additions and 191 deletions

5
test/build-with-drm.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
rm -rf _build
meson _build
meson compile -C _build

5
test/build-without-drm.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/bash
rm -rf _build
meson _build -Dwith-drm=disabled
meson compile -C _build

View file

@ -1,5 +1,49 @@
#!/bin/bash
function run_unl0kr_async() {
local log=$1
local conf=$2
./_build/unl0kr/unl0kr -v -C "$conf" > "$log" 2>&1 &
pid=$!
sleep 3
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/unl0kr -v -C "$conf" $@ > "$log" 2>&1
}
function run_buffyboard_async() {
local log=$1
local conf=$2
./_build/buffyboard/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/buffyboard -v -C "$conf" $@ > "$log" 2>&1
}
function info() {
echo -e "[Info] $1"
}
@ -23,5 +67,5 @@ function read_version_from_meson() {
}
function read_version_from_changelog() {
grep "^## [[:digit:]]" "$root/../../CHANGELOG.md" | head -n1 | grep -o "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"
grep "^## [[:digit:]]" "$root/../CHANGELOG.md" | head -n1 | grep -o "[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"
}

6
test/test-all.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
root=$(dirname "${BASH_SOURCE[0]}")
"$root/test-with-drm.sh"
"$root/test-without-drm.sh"

View file

@ -0,0 +1,30 @@
#!/bin/bash
log=tmp.log
conf=tmp.conf
source "$(dirname "${BASH_SOURCE[0]}")/helpers.sh"
function clean_up() {
rm -f "$log" "$conf"
}
trap clean_up EXIT
info "Writing config"
cat << EOF > "$conf"
[general]
backend=drm
EOF
info "Running unl0kr"
run_unl0kr_async "$log" "$conf"
info "Verifying output"
if ! grep "Using DRM backend" "$log"; then
error "Expected DRM backend to be selected"
cat "$log"
exit 1
fi
ok

View file

@ -0,0 +1,23 @@
#!/bin/bash
log=tmp.log
source "$(dirname "${BASH_SOURCE[0]}")/helpers.sh"
function clean_up() {
rm -f "$log"
}
trap clean_up EXIT
info "Running unl0kr"
run_unl0kr_async "$log"
info "Verifying output"
if ! grep "Using framebuffer backend" "$log"; then
error "Expected framebuffer backend to be selected"
cat "$log"
exit 1
fi
ok

View file

@ -0,0 +1,30 @@
#!/bin/bash
log=tmp.log
conf=tmp.conf
source "$(dirname "${BASH_SOURCE[0]}")/helpers.sh"
function clean_up() {
rm -f "$log" "$conf"
}
trap clean_up EXIT
info "Writing config"
cat << EOF > "$conf"
[general]
backend=drm
EOF
info "Running unl0kr"
run_unl0kr_async "$log" "$conf"
info "Verifying output"
if ! grep "Using framebuffer backend" "$log"; then
error "Expected framebuffer backend to be selected"
cat "$log"
exit 1
fi
ok

View file

@ -0,0 +1,30 @@
#!/bin/bash
log=tmp.log
conf=tmp.conf
source "$(dirname "${BASH_SOURCE[0]}")/helpers.sh"
function clean_up() {
rm -f "$log" "$conf"
}
trap clean_up EXIT
info "Writing config"
cat << EOF > "$conf"
[general]
backend=fb
EOF
info "Running unl0kr"
run_unl0kr_async "$log" "$conf"
info "Verifying output"
if ! grep "Using framebuffer backend" "$log"; then
error "Expected framebuffer backend to be selected"
cat "$log"
exit 1
fi
ok

View file

@ -0,0 +1,47 @@
#!/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
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

11
test/test-with-drm.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
root=$(dirname "${BASH_SOURCE[0]}")
source "$root/helpers.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"

11
test/test-without-drm.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
root=$(dirname "${BASH_SOURCE[0]}")
source "$root/helpers.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"