meson: run ratbagctl.test as part of ninja test

Or at least do so when we're root.

Test is skipped on CircleCI because we don't have DBus.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-07-24 10:16:18 +10:00
committed by Benjamin Tissoires
parent 98fa9c168a
commit ca69365a86
3 changed files with 25 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ libratbag_references:
fedora_install: &fedora_install
run:
name: Install prerequisites
command: dnf install -y tree git gcc gcc-c++ meson check-devel libudev-devel libevdev-devel doxygen graphviz valgrind
command: dnf install -y tree git gcc gcc-c++ meson check-devel libudev-devel libevdev-devel doxygen graphviz valgrind python3-gobject
fedora_settings: &fedora_settings
@@ -74,7 +74,7 @@ ubuntu_settings: &ubuntu_settings
apt-get install -y software-properties-common
add-apt-repository universe
apt-get update
apt-get install -y tree git gcc g++ pkg-config meson check libudev-dev libevdev-dev libsystemd-dev doxygen graphviz valgrind
apt-get install -y tree git gcc g++ pkg-config meson check libudev-dev libevdev-dev libsystemd-dev doxygen graphviz valgrind python3-gi
- checkout
- *build_and_test
- *install

View File

@@ -542,6 +542,8 @@ configure_file(input : 'tools/ratbagctl.devel.in',
configure_file(input : 'tools/ratbagctl.test.in',
output : 'ratbagctl.test',
configuration : config_ratbagctl_devel)
ratbagctl_test_wrapper = find_program('tools/ratbagctl.test.wrapper')
test('ratbagctl-test', ratbagctl_test_wrapper, args: [meson.build_root()])
#### output files ####
configure_file(output: 'config.h', install: false, configuration: config_h)

21
tools/ratbagctl.test.wrapper Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
#
# Wrapper to execute ratbagctl.test. Required because meson does not allow
# a configure_file() output to be used as test. And besides, we need to run
# this as root anyway.
#
if [ `whoami` != "root" ]; then
echo "This test must be run as root"
# Skippedy skip skip
exit 77
fi
if ! [ -z "$CIRCLECI" ]; then
echo "CircleCI does not have DBus. Skipping test"
# Skippedy skip skip
exit 77
fi
MESON_BUILD_ROOT="$1"
"$MESON_BUILD_ROOT"/ratbagctl.test