From ca69365a8654a27e599c842a55125245ff41a1c4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 24 Jul 2017 10:16:18 +1000 Subject: [PATCH] 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 --- circle.yml | 4 ++-- meson.build | 2 ++ tools/ratbagctl.test.wrapper | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100755 tools/ratbagctl.test.wrapper diff --git a/circle.yml b/circle.yml index bbc9e2fb..5e558735 100644 --- a/circle.yml +++ b/circle.yml @@ -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 diff --git a/meson.build b/meson.build index d5de90c2..3d497e9c 100644 --- a/meson.build +++ b/meson.build @@ -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) diff --git a/tools/ratbagctl.test.wrapper b/tools/ratbagctl.test.wrapper new file mode 100755 index 00000000..c0294711 --- /dev/null +++ b/tools/ratbagctl.test.wrapper @@ -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