Commit fc09a26b authored by Andrea Azzarone's avatar Andrea Azzarone 🚴 Committed by Sam Thursfield

tests: Don't depend on installed service file

Run dbus-run-session with the --config-file parameter in order to allow to run
tests without installing tracker before.

Closes: #24
parent fd587b6e
......@@ -15,7 +15,7 @@ test-fedora-latest:
# screenful of junk each time unless we strip these.
unset $(env|grep -o '^CI_[^=]*')
su tracker -c 'cd build; dbus-run-session -- env LANG=en_US.UTF8 meson test --print-errorlogs'
su tracker -c 'cd build; meson test --print-errorlogs'
artifacts:
when: always
......
......@@ -270,6 +270,7 @@ conf.set('TRACKER_INTERFACE_AGE', 0)
conf.set('TRACKER_BINARY_AGE', 100 * tracker_minor_version + tracker_micro_version)
# Config that goes in some other generated files (.desktop, .pc, etc)
conf.set('abs_top_builddir', meson.current_build_dir())
conf.set('exec_prefix', get_option('prefix'))
conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
conf.set('datadir', datadir)
......@@ -331,6 +332,7 @@ vapi_dir = join_paths(get_option('prefix'), get_option('datadir'), 'vala', 'vapi
glib_mkenums = find_program('glib-mkenums')
g_ir_compiler = find_program('g-ir-compiler', gobject_introspection.get_pkgconfig_variable('g_ir_compiler'))
g_ir_merge = find_program('g-ir-merge', join_paths(meson.current_source_dir(), 'utils', 'g-ir-merge', 'g-ir-merge'))
dbus_run_session = find_program('dbus-run-session')
gir_dir = gobject_introspection.get_pkgconfig_variable('girdir',
define_variable: [ 'datadir', datadir ])
......
test_runner = find_program('test-runner.sh')
test_runner = configure_file(
input: 'test-runner.sh.in',
output: 'test-runner.sh',
configuration: conf)
test_runner = find_program(test_runner)
config_json = configure_file(
input: 'configuration.json.in',
......
......@@ -4,8 +4,6 @@
set -e
SCRIPT=$1
export TEMP_DIR=`mktemp --tmpdir -d tracker-test-XXXX`
# We need to use the actual home directory for some tests because
......@@ -17,6 +15,6 @@ export REAL_HOME=`echo ~`
HOME=$TEMP_DIR
echo "Running $@"
dbus-run-session -- "$@"
dbus-run-session --config-file=@abs_top_builddir@/tests/test-bus.conf -- "$@"
rm -R $TEMP_DIR
......@@ -4,4 +4,7 @@ gvdb_test = executable('gvdb-test',
include_directories: configinc,
)
test('gvdb', gvdb_test)
tests += {
'name': 'gvdb',
'exe': gvdb_test,
}
......@@ -20,7 +20,10 @@ foreach base_name: libtracker_common_tests
dependencies: libtracker_common_test_deps,
c_args: test_c_args)
test(test_name, binary)
tests += {
'name': test_name,
'exe': binary
}
endforeach
# This is a manual test case
......
......@@ -11,10 +11,6 @@ libtracker_data_slow_tests = [
'sparql'
]
libtracker_data_test_environment = environment()
libtracker_data_test_environment.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', '@0@/src/libtracker-common/stop-words'.format(source_root))
libtracker_data_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
libtracker_data_test_deps = [tracker_common_dep, tracker_data_dep, tracker_sparql_dep]
foreach base_name: libtracker_data_tests
......@@ -26,8 +22,10 @@ foreach base_name: libtracker_data_tests
dependencies: libtracker_data_test_deps,
c_args: test_c_args)
test(test_name, binary,
env: libtracker_data_test_environment)
tests += {
'name': test_name,
'exe': binary
}
endforeach
foreach base_name: libtracker_data_slow_tests
......@@ -39,7 +37,9 @@ foreach base_name: libtracker_data_slow_tests
dependencies: libtracker_data_test_deps,
c_args: test_c_args)
test(test_name, binary,
timeout: 180,
env: libtracker_data_test_environment)
tests += {
'name': test_name,
'exe': binary,
'timeout': 180
}
endforeach
libtracker_fts_test_environment = environment()
libtracker_fts_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
fts_test = executable('tracker-fts-test',
'tracker-fts-test.c',
dependencies: [tracker_common_dep, tracker_sparql_dep, tracker_data_dep, tracker_testcommon_dep],
c_args: test_c_args
)
test('fts', fts_test,
env: libtracker_fts_test_environment)
tests += {
'name': 'fts',
'exe': fts_test
}
......@@ -22,10 +22,6 @@ libtracker_miner_test_c_args = [
'-DTEST_ONTOLOGIES_DIR="@0@/src/ontologies/nepomuk"'.format(source_root),
]
libtracker_miner_test_environment = environment()
libtracker_miner_test_environment.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', '@0@/src/libtracker-common/stop-words'.format(source_root))
libtracker_miner_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
libtracker_miner_test_deps = [tracker_common_dep, tracker_miner_dep, tracker_sparql_dep]
foreach base_name: libtracker_miner_tests
......@@ -38,8 +34,10 @@ foreach base_name: libtracker_miner_tests
c_args: libtracker_miner_test_c_args,
link_with: [libtracker_miner_private])
test(test_name, binary,
env: libtracker_miner_test_environment)
tests += {
'name': test_name,
'exe': binary
}
endforeach
foreach base_name: libtracker_miner_slow_tests
......@@ -52,7 +50,9 @@ foreach base_name: libtracker_miner_slow_tests
c_args: libtracker_miner_test_c_args,
link_with: [libtracker_miner_private])
test(test_name, binary,
env: libtracker_miner_test_environment,
timeout: 180)
tests += {
'name': test_name,
'exe': binary,
'timeout': 180
}
endforeach
......@@ -13,10 +13,6 @@ libtracker_sparql_test_deps = [
tracker_common_dep, tracker_sparql_dep
]
libtracker_sparql_test_environment = environment()
libtracker_sparql_test_environment.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', '@0@/src/libtracker-common/stop-words'.format(source_root))
libtracker_sparql_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
foreach base_name: libtracker_sparql_tests
source = 'tracker-@0@-test.c'.format(base_name)
binary_name = 'tracker-@0@-test'.format(base_name)
......@@ -26,6 +22,10 @@ foreach base_name: libtracker_sparql_tests
dependencies: libtracker_sparql_test_deps,
c_args: libtracker_sparql_test_c_args)
test(test_name, binary,
env: libtracker_sparql_test_environment)
tests += {
'name': test_name,
'exe': binary,
'is_parallel': false
}
[[test_name, binary]]
endforeach
tests = []
subdir('common')
subdir('gvdb')
......@@ -15,3 +17,32 @@ subdir('tracker-steroids')
if get_option('functional_tests')
subdir('functional-tests')
endif
subdir('services')
test_bus_conf_file = configure_file(
input: 'test-bus.conf.in',
output: 'test-bus.conf',
configuration: conf)
foreach t: tests
test_name = t.get('name')
test_exe = t.get('exe')
test_timeout = t.get('timeout', 30)
test_is_parallel = t.get('is_parallel', true)
test_env = environment()
test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(build_root, 'data'))
test_env.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', join_paths(source_root, 'src', 'libtracker-common', 'stop-words'))
test_env.set('TRACKER_TEST_DOMAIN_ONTOLOGY_RULE', join_paths(source_root, 'src', 'tracker-store', 'default.rule'))
test_env.set('TRACKER_DB_ONTOLOGIES_DIR', join_paths(source_root, 'src', 'ontologies', 'nepomuk'))
test_env.set('LANG', 'en_US.UTF8')
test (test_name, dbus_run_session,
env: test_env,
args: ['--config-file=@0@'.format(join_paths(meson.current_build_dir(), 'test-bus.conf')),
'--',
test_exe],
timeout: test_timeout,
is_parallel: test_is_parallel)
endforeach
test_dbus_service_file = configure_file(
input: 'org.freedesktop.Tracker1.service.in',
output: 'org.freedesktop.Tracker1.service',
configuration: conf)
[D-BUS Service]
Name=org.freedesktop.Tracker1
Exec=@abs_top_builddir@/src/tracker-store/tracker-store
SystemdService=tracker-store.service
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Our well-known bus type, don't change this -->
<type>session</type>
<listen>unix:tmpdir=./</listen>
<servicedir>@abs_top_builddir@/tests/services/</servicedir>
<policy context="default">
<!-- Allow everything to be sent -->
<allow send_destination="*"/>
<!-- Allow everything to be received -->
<allow eavesdrop="true"/>
<!-- Allow anyone to own anything -->
<allow own="*"/>
</policy>
</busconfig>
......@@ -7,4 +7,7 @@ steroids_test = executable('tracker-steroids-test',
'tracker-test.c',
dependencies: [tracker_common_dep, tracker_sparql_dep],
c_args: [tracker_c_args, test_c_args])
test('steroids', steroids_test)
tests += {
'name': 'steroids',
'exe': steroids_test
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment