summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2021-09-01 12:27:33 +0200
committerBastien Nocera <hadess@hadess.net>2021-09-02 17:40:56 +0200
commit46ed29945125c241fe9a103e8b4f565472d453ef (patch)
tree6c45aece060078c45a34ce3696349f70478e5ab0
parentfbbcb0c03f0528d36ece5b4868112d36f7256aa5 (diff)
downloadupower-46ed29945125c241fe9a103e8b4f565472d453ef.tar.gz
tests: Return 77 when skipping tests
77 is the special value meaning that the test was skipped. Both meson make check will display the information correctly. Note that the test is currently executed directly in check-local. So add a workaround to ignore the 77 error code and exit 0 instead in that case.
-rw-r--r--src/Makefile.am4
-rwxr-xr-xsrc/linux/integration-test6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4c47d46..bcb1187 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -105,7 +105,9 @@ if UP_BUILD_TESTS
check-local: upowerd
# To launch a single test
# env GI_TYPELIB_PATH=$(top_builddir)/libupower-glib:$(GI_TYPELIB_PATH) LD_LIBRARY_PATH=$(top_builddir)/libupower-glib/.libs:$(LD_LIBRARY_PATH) top_builddir=$(top_builddir) $(srcdir)/linux/integration-test -v Tests.test_bluetooth_le_mouse
- env GI_TYPELIB_PATH=$(top_builddir)/libupower-glib:$(GI_TYPELIB_PATH) LD_LIBRARY_PATH=$(top_builddir)/libupower-glib/.libs:$(LD_LIBRARY_PATH) top_builddir=$(top_builddir) $(srcdir)/linux/integration-test -v
+ env GI_TYPELIB_PATH=$(top_builddir)/libupower-glib:$(GI_TYPELIB_PATH) LD_LIBRARY_PATH=$(top_builddir)/libupower-glib/.libs:$(LD_LIBRARY_PATH) top_builddir=$(top_builddir) $(srcdir)/linux/integration-test -v; \
+ res=$$?; test $$res -eq 77 && res=0; \
+ exit $$res
endif
endif
diff --git a/src/linux/integration-test b/src/linux/integration-test
index 2a54417..3748e2a 100755
--- a/src/linux/integration-test
+++ b/src/linux/integration-test
@@ -34,20 +34,20 @@ try:
from gi.repository import UPowerGlib
except ImportError as e:
sys.stderr.write('Skipping tests, PyGobject not available for Python 3, or missing GI typelibs: %s\n' % str(e))
- sys.exit(0)
+ sys.exit(77)
try:
gi.require_version('UMockdev', '1.0')
from gi.repository import UMockdev
except ImportError:
sys.stderr.write('Skipping tests, umockdev not available (https://github.com/martinpitt/umockdev)\n')
- sys.exit(0)
+ sys.exit(77)
try:
import dbusmock
except ImportError:
sys.stderr.write('Skipping tests, python-dbusmock not available (http://pypi.python.org/pypi/python-dbusmock).\n')
- sys.exit(0)
+ sys.exit(77)
UP = 'org.freedesktop.UPower'