@@ -241,9 +241,12 @@ else
pipelines = wanted_pipelines
endif
-# Tests require the vimc pipeline handler, include it automatically when tests
-# are enabled.
-if get_option('test')
+test_unit_enabled = get_option('test') or get_option('test-unit')
+test_integration_enabled = get_option('test') or get_option('test-integration')
+
+# Integration tests require the vimc pipeline handler, include it automatically
+# when they are enabled.
+if test_integration_enabled
foreach pipeline, archs : pipelines_support
if 'test' in archs and pipeline not in pipelines
message('Enabling ' + pipeline + ' pipeline handler for tests')
@@ -304,7 +307,8 @@ summary({
'GStreamer support': gst_enabled,
'Python bindings': pycamera_enabled,
'V4L2 emulation support': v4l2_enabled,
- 'Unit tests': test_enabled,
+ 'Unit tests': test_unit_enabled,
+ 'Integration tests': test_integration_enabled,
},
section : 'Configuration',
bool_yn : true)
@@ -114,7 +114,17 @@ option('softisp-gpu',
option('test',
type : 'boolean',
value : false,
- description : 'Compile and include the tests')
+ description : 'Compile and include all tests')
+
+option('test-unit',
+ type : 'boolean',
+ value : false,
+ description : 'Compile and include unit tests')
+
+option('test-integration',
+ type : 'boolean',
+ value : false,
+ description : 'Compile and include integration tests')
option('tracing',
type : 'feature',
@@ -36,9 +36,9 @@ supported_ipas = {
ipa_modules = get_option('ipas')
-# Tests require the vimc IPA, similar to vimc pipline-handler for their
-# execution. Include it automatically when tests are enabled.
-if get_option('test') and 'vimc' not in ipa_modules
+# Integration tests require the vimc IPA, similar to the vimc pipeline
+# handler. Include it automatically when integration tests are enabled.
+if test_integration_enabled and 'vimc' not in ipa_modules
message('Enabling vimc IPA to support tests')
ipa_modules += ['vimc']
endif
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
# Tests are listed in order of complexity.
# They are not alphabetically sorted.
camera_tests = [
@@ -8,6 +8,10 @@ control_tests = [
]
foreach test : control_tests
+ if test.get('suite', 'unit') not in test_suites
+ continue
+ endif
+
exe = executable(test['name'], test['sources'],
dependencies : libcamera_public,
link_with : test_libraries,
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
if not gst_enabled
subdir_done()
endif
new file mode 100644
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: CC0-1.0
+
+# Integration test subdirectories register tests in the 'integration' suite.
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_unit_enabled
+ subdir_done()
+endif
+
libipa_test = [
{'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']},
{'name': 'histogram', 'sources': ['histogram.cpp']},
@@ -2,6 +2,10 @@
subdir('libipa')
+if not test_integration_enabled
+ subdir_done()
+endif
+
ipa_test = [
{'name': 'ipa_module_test', 'sources': ['ipa_module_test.cpp']},
{'name': 'ipa_interface_test', 'sources': ['ipa_interface_test.cpp']},
@@ -6,6 +6,10 @@ ipc_tests = [
]
foreach test : ipc_tests
+ if test.get('suite', 'unit') not in test_suites
+ continue
+ endif
+
exe = executable(test['name'], test['sources'],
dependencies : libcamera_private,
link_with : test_libraries,
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_unit_enabled
+ subdir_done()
+endif
+
log_test = [
{'name': 'log_api', 'sources': ['log_api.cpp']},
{'name': 'log_process', 'sources': ['log_process.cpp']},
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
lib_mdev_test_sources = files([
'media_device_test.cpp',
])
@@ -1,11 +1,16 @@
# SPDX-License-Identifier: CC0-1.0
-if not get_option('test')
- test_enabled = false
- subdir_done()
+test_suites = []
+if test_unit_enabled
+ test_suites += 'unit'
+endif
+if test_integration_enabled
+ test_suites += 'integration'
endif
-test_enabled = true
+if test_suites.length() == 0
+ subdir_done()
+endif
# When ASan is enabled, find the path to the ASan runtime needed by multiple
# tests. This currently works with gcc only, as clang uses different file names
@@ -25,6 +30,10 @@ endif
subdir('libtest')
+if test_integration_enabled
+ subdir('integration')
+endif
+
subdir('camera')
subdir('controls')
subdir('gstreamer')
@@ -86,6 +95,10 @@ internal_non_parallel_tests = [
]
foreach test : public_tests
+ if not test_unit_enabled
+ continue
+ endif
+
deps = [libcamera_public]
if 'dependencies' in test
deps += test['dependencies']
@@ -103,6 +116,10 @@ foreach test : public_tests
endforeach
foreach test : internal_tests
+ if test.get('suite', 'unit') not in test_suites
+ continue
+ endif
+
deps = [libcamera_private]
if 'dependencies' in test
deps += test['dependencies']
@@ -120,6 +137,10 @@ foreach test : internal_tests
endforeach
foreach test : internal_non_parallel_tests
+ if not test_integration_enabled
+ continue
+ endif
+
deps = [libcamera_private]
if 'dependencies' in test
deps += test['dependencies']
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_unit_enabled
+ subdir_done()
+endif
+
process_tests = [
{'name': 'process_test', 'sources': ['process_test.cpp']},
]
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
if not pycamera_enabled
subdir_done()
endif
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_unit_enabled
+ subdir_done()
+endif
+
subdir('include/libcamera/ipa')
exe = executable('generated_serializer_test',
@@ -2,6 +2,10 @@
subdir('generated_serializer')
+if not test_integration_enabled
+ subdir_done()
+endif
+
serialization_tests = [
{'name': 'control_serialization', 'sources': ['control_serialization.cpp']},
{'name': 'ipa_data_serializer_test', 'sources': ['ipa_data_serializer_test.cpp']},
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
-if not softisp_enabled
+if not test_unit_enabled or not softisp_enabled
subdir_done()
endif
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_unit_enabled
+ subdir_done()
+endif
+
stream_tests = [
{'name': 'stream_colorspace', 'sources': ['stream_colorspace.cpp']},
{'name': 'stream_formats', 'sources': ['stream_formats.cpp']},
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
if not is_variable('v4l2_compat')
subdir_done()
endif
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
v4l2_subdevice_tests = [
{'name': 'list_formats', 'sources': ['list_formats.cpp']},
{'name': 'test_formats', 'sources': ['test_formats.cpp']},
@@ -1,5 +1,9 @@
# SPDX-License-Identifier: CC0-1.0
+if not test_integration_enabled
+ subdir_done()
+endif
+
# Tests are listed in order of complexity.
# They are not alphabetically sorted.
v4l2_videodevice_tests = [