Commit 441a0886 authored by Sam Thursfield's avatar Sam Thursfield

meson: Rework how 400-extractor-metadata is run

We now create a separate test() instance corresponding to each of the
test cases, which were previously treated as one single test.

This allows running only one of the tests by doing something like
`meson test functional/extract/images/roi.expected.json`, which is
useful for debugging.
parent 6332ecef
......@@ -204,30 +204,6 @@ class ExtractionTestCase (ut.TestCase):
def run_all ():
# Traverse the TEST_DATA_PATH directory looking for .description files
# Add a new TestCase to the suite per .description file and run the suite.
# Is we do this inside a single TestCase an error in one test would stop the whole
# testing.
if (os.path.exists (os.getcwd() + "/test-extraction-data")):
# Use local directory if available
TEST_DATA_PATH = os.getcwd() + "/test-extraction-data"
TEST_DATA_PATH = os.path.join (cfg.DATADIR, "tracker-tests",
print "Loading test descriptions from", TEST_DATA_PATH
extractionTestSuite = ut.TestSuite ()
for root, dirs, files in os.walk (TEST_DATA_PATH):
descriptions = [os.path.join (root, f) for f in files if f.endswith ("expected")]
for descfile in descriptions:
tc = ExtractionTestCase(descfile=descfile)
result = ut.TextTestRunner (verbosity=1).run (extractionTestSuite)
sys.exit(not result.wasSuccessful())
def run_one (filename):
# Run just one .description file
......@@ -242,15 +218,10 @@ def run_one (filename):
sys.exit(not result.wasSuccessful())
if __name__ == "__main__":
if (len (sys.argv) == 1):
run_all ()
if os.path.exists (sys.argv[1]) and sys.argv[1].endswith (".expected"):
run_one (sys.argv[1])
# FIXME: for the case when invoked by testrunner (see
elif sys.argv[1] == "ExtractionTestCase":
run_all ()
print "Usage: %s [FILE.expected]" % (sys.argv[0])
test = sys.argv[1]
if os.path.exists (sys.argv[1]) and sys.argv[1].endswith (".expected"):
run_one (sys.argv[1])
print("Usage: %s [FILE.expected]" % (sys.argv[0]))
......@@ -10,7 +10,6 @@ functional_tests = [
......@@ -18,6 +17,30 @@ functional_tests = [
extractor_tests = [
config_json_full_path = join_paths(meson.current_build_dir(), 'configuration.json')
dconf_profile_full_path = join_paths(meson.current_source_dir(), 'trackertest')
tracker_extractors_dir = join_paths(meson.current_build_dir(), '..', '..', 'src', 'tracker-extract')
......@@ -38,3 +61,10 @@ foreach t: functional_tests
# FIXME: these tests are all too slow
timeout: 180)
foreach t: extractor_tests
test('functional/extract/' + t, test_runner,
args: ['./', join_paths('test-extraction-data', t)],
env: test_env,
workdir: meson.current_source_dir())
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