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): ...@@ -204,30 +204,6 @@ class ExtractionTestCase (ut.TestCase):
section)) section))
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"
else:
TEST_DATA_PATH = os.path.join (cfg.DATADIR, "tracker-tests",
"test-extraction-data")
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)
extractionTestSuite.addTest(tc)
result = ut.TextTestRunner (verbosity=1).run (extractionTestSuite)
sys.exit(not result.wasSuccessful())
def run_one (filename): def run_one (filename):
## ##
# Run just one .description file # Run just one .description file
...@@ -242,15 +218,10 @@ def run_one (filename): ...@@ -242,15 +218,10 @@ def run_one (filename):
sys.exit(not result.wasSuccessful()) sys.exit(not result.wasSuccessful())
if __name__ == "__main__": test = sys.argv[1]
if (len (sys.argv) == 1):
run_all () if os.path.exists (sys.argv[1]) and sys.argv[1].endswith (".expected"):
else: run_one (sys.argv[1])
if os.path.exists (sys.argv[1]) and sys.argv[1].endswith (".expected"): else:
run_one (sys.argv[1]) print("Usage: %s [FILE.expected]" % (sys.argv[0]))
# FIXME: for the case when invoked by testrunner (see create-tests-xml.py) sys.exit(1)
elif sys.argv[1] == "ExtractionTestCase":
run_all ()
else:
print "Usage: %s [FILE.expected]" % (sys.argv[0])
...@@ -10,7 +10,6 @@ functional_tests = [ ...@@ -10,7 +10,6 @@ functional_tests = [
'300-miner-basic-ops', '300-miner-basic-ops',
'301-miner-resource-removal', '301-miner-resource-removal',
'310-fts-indexing', '310-fts-indexing',
'400-extractor-metadata',
'410-extractor-decorator', '410-extractor-decorator',
'500-writeback', '500-writeback',
'501-writeback-details', '501-writeback-details',
...@@ -18,6 +17,30 @@ functional_tests = [ ...@@ -18,6 +17,30 @@ functional_tests = [
'601-applications-sync', '601-applications-sync',
] ]
extractor_tests = [
'audio/audio-test-1.expected',
'audio/empty_albumi_song3.expected',
'audio/Jazz_Audio_OPLs0.expected',
'audio/audio-test-2.expected',
'images/test-image-1.expected',
'images/xmp-loaded-1.expected',
'images/test-image-3.expected',
'images/corrupted-image.expected',
'images/test-iptcdata-records.expected',
'images/roi2.expected',
'images/test-image-4.expected',
'images/test-image-2.expected',
'images/comment-extension-block.expected',
'images/roi.expected',
'video/184505.expected',
'video/video-1.expected',
'video/video-2.expected',
'playlists/playlist-test-1.expected',
'office/office-doc.expected',
'office/powerpoint.expected',
'office/pdf-doc.expected',
]
config_json_full_path = join_paths(meson.current_build_dir(), 'configuration.json') config_json_full_path = join_paths(meson.current_build_dir(), 'configuration.json')
dconf_profile_full_path = join_paths(meson.current_source_dir(), 'trackertest') dconf_profile_full_path = join_paths(meson.current_source_dir(), 'trackertest')
tracker_extractors_dir = join_paths(meson.current_build_dir(), '..', '..', 'src', 'tracker-extract') tracker_extractors_dir = join_paths(meson.current_build_dir(), '..', '..', 'src', 'tracker-extract')
...@@ -38,3 +61,10 @@ foreach t: functional_tests ...@@ -38,3 +61,10 @@ foreach t: functional_tests
# FIXME: these tests are all too slow # FIXME: these tests are all too slow
timeout: 180) timeout: 180)
endforeach endforeach
foreach t: extractor_tests
test('functional/extract/' + t, test_runner,
args: ['./400-extractor-metadata.py', join_paths('test-extraction-data', t)],
env: test_env,
workdir: meson.current_source_dir())
endforeach
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