summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2017-02-16 12:47:41 +0100
committerAdrian Szyndela <adrian.s@samsung.com>2017-02-16 12:57:59 +0100
commit321a18e45eaf5a04597749c541f35deaa723ee1d (patch)
treefeaccb583d89b332cef631bd904b4bb426d4712f
parentb0e9b25d25f0932f3da6d0613df16c8e33798fd2 (diff)
downloaddbus-321a18e45eaf5a04597749c541f35deaa723ee1d.tar.gz
dbus-321a18e45eaf5a04597749c541f35deaa723ee1d.tar.bz2
dbus-321a18e45eaf5a04597749c541f35deaa723ee1d.zip
tests: general fix for tests setup
Before this patch tests were installed into custom directory /usr/lib/dbus-tests/test-suites/dbus-tests Originally, dbus wants its installed tests in /usr/lib/dbus/installed-tests/dbus This path seems to be partially hardcoded in the configuration files - it relies on defined datadir. As datadir is used also for something else than tests, we don't want to change it. This commit switches installation directory to the original, and adds symbolic links in our custom directory. Change-Id: Icf330ba3b5be59ee941d51b15a8f78a082297846
-rw-r--r--packaging/dbus.spec20
-rw-r--r--test-runner.c6
2 files changed, 18 insertions, 8 deletions
diff --git a/packaging/dbus.spec b/packaging/dbus.spec
index afaad50d..50d1da33 100644
--- a/packaging/dbus.spec
+++ b/packaging/dbus.spec
@@ -220,15 +220,22 @@ install -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/profile.d/dbus.sh
rm -rf %{buildroot}%{_datadir}/doc
# build test binaries and copy test data
-%define relative_dbus_tests_base_dir %{_prefix}/lib/dbus-tests
+%define relative_dbus_tests_base_dir %{_libdir}/dbus-tests
%define dbus_tests_base_dir %{buildroot}%{relative_dbus_tests_base_dir}
+%define dbus_installed_tests_dir %{_libdir}/dbus/installed-tests/dbus
mkdir -p %{dbus_tests_base_dir}/test-suites/dbus-tests/
mkdir -p %{dbus_tests_base_dir}/runner/
-%__cc %{_builddir}/%{name}-%{version}/test-runner.c -o %{dbus_tests_base_dir}/runner/dbus-tests
-cp -fr %{buildroot}%{_libdir}/dbus/installed-tests/dbus/* %{dbus_tests_base_dir}/test-suites/dbus-tests/
-rm -fr %{buildroot}%{_libdir}/dbus/installed-tests/dbus
+%__cc %{_builddir}/%{name}-%{version}/test-runner.c -g -o %{dbus_tests_base_dir}/runner/dbus-tests
rm -fr %{buildroot}/usr/share/installed-tests/dbus
+# The tests are installed in standard directory for dbus tests.
+# However, we need to have the tests also available for dbus-integration-tests package.
+# Thus, we link selected tests to our dbus-integration-tests directory
+for f in manual-dir-iter manual-tcp test-corrupt test-dbus-daemon \
+ test-dbus-daemon-eavesdrop test-fdpass test-loopback test-marshal \
+ test-monitor test-printf test-refs test-relay test-sd-activation \
+ test-shell test-syntax test-syslog test-uid-permissions
+do ln -s %{dbus_installed_tests_dir}/$f %{dbus_tests_base_dir}/test-suites/dbus-tests/$f; done
%if %{with coverage}
%define relative_cov_lib_dir %{relative_dbus_tests_base_dir}/coverage-libs
@@ -315,8 +322,9 @@ install -m 0644 coverage-objects/* %{cov_lib_dir}/objects
%files tests
%manifest %{name}.manifest
%defattr(-,root,root)
-%{_prefix}/lib/dbus-tests/test-suites/dbus-tests
-%{_prefix}/lib/dbus-tests/runner/dbus-tests
+%{_libdir}/dbus-tests/test-suites/dbus-tests
+%{_libdir}/dbus-tests/runner/dbus-tests
+%{_libdir}/dbus/installed-tests
%if %{with coverage}
%files coverage
diff --git a/test-runner.c b/test-runner.c
index c750e321..a248c641 100644
--- a/test-runner.c
+++ b/test-runner.c
@@ -41,6 +41,8 @@
#define MAX_BUFFER (64*1024)
#define MAX_COMMENT 1024
+#define INSTALLED_TESTS_DIR "/usr/lib/dbus/installed-tests/dbus/data"
+
enum {
INIT_TEST,
NEW_STDOUT,
@@ -255,13 +257,13 @@ char** prepare_args_for_dir_iter(const struct binary* b, const char* test_name)
{
static char* args_dir[2];
args_dir[0] = (char*)b->name;
- args_dir[1] = "/usr/lib/dbus-tests/test-suites/dbus-tests/data";
+ args_dir[1] = INSTALLED_TESTS_DIR;
return args_dir;
}
int init_environment_vars()
{
- return !(putenv("DBUS_TEST_DATA=/usr/lib/dbus-tests/test-suites/dbus-tests/data"));
+ return !(putenv("DBUS_TEST_DATA="INSTALLED_TESTS_DIR));
}
void parse_binary_outputs(const struct binary* b, const char* test_name, char* buffer, int state_change, int state_option)