Add tests for version flag
This commit is contained in:
parent
194a090d92
commit
0bfbcaf377
14 changed files with 168 additions and 40 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue