summaryrefslogtreecommitdiffstats
path: root/tests/meson.build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:41:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:41:32 +0000
commitf26f66d866ba1a9f3204e6fdfe2b07e67b5492ad (patch)
treec953c007cbe4f60a147ab62f97937d58abb2e9ca /tests/meson.build
parentInitial commit. (diff)
downloadnvme-cli-upstream/2.8.tar.xz
nvme-cli-upstream/2.8.zip
Adding upstream version 2.8.upstream/2.8
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/meson.build')
-rw-r--r--tests/meson.build99
1 files changed, 99 insertions, 0 deletions
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..f8c6aa2
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,99 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+infra = [
+ 'config.json',
+ 'nvme_test.py',
+ 'nvme_test_io.py',
+ 'nvme_test_logger.py',
+ 'nvme_simple_template_test.py',
+]
+
+tests = [
+ 'nvme_attach_detach_ns_test.py',
+ 'nvme_compare_test.py',
+ 'nvme_create_max_ns_test.py',
+ 'nvme_error_log_test.py',
+ 'nvme_flush_test.py',
+ 'nvme_format_test.py',
+ 'nvme_fw_log_test.py',
+ 'nvme_get_features_test.py',
+ 'nvme_id_ctrl_test.py',
+ 'nvme_id_ns_test.py',
+ 'nvme_read_write_test.py',
+ 'nvme_smart_log_test.py',
+ 'nvme_writeuncor_test.py',
+ 'nvme_writezeros_test.py',
+ 'nvme_copy_test.py',
+ 'nvme_dsm_test.py',
+ 'nvme_verify_test.py',
+ 'nvme_lba_status_log_test.py',
+ 'nvme_get_lba_status_test.py',
+ 'nvme_ctrl_reset_test.py',
+]
+
+runtests = find_program('nose2', required : false)
+
+if meson.version().version_compare('>= 0.56')
+ nvmecli_path = meson.project_build_root()
+else
+ nvmecli_path = meson.build_root()
+endif
+
+if runtests.found()
+ foreach file : infra + tests
+ configure_file(
+ input: file,
+ output: file,
+ copy: true)
+ endforeach
+
+ foreach t : tests
+ t_name = t.split('.')[0]
+ test(t_name, runtests,
+ args: ['--verbose', '--start-dir', meson.current_build_dir(), t_name],
+ env: ['PATH=' + nvmecli_path + ':/usr/bin:/usr/sbin'],
+ timeout: 500)
+ endforeach
+endif
+
+python_module = import('python')
+
+python = python_module.find_installation('python3')
+
+mypy = find_program(
+ 'mypy',
+ required : false,
+)
+flake8 = find_program(
+ 'flake8',
+ required : false,
+)
+linter_script = files('run_py_linters.py')
+
+if mypy.found() and flake8.found()
+ run_target(
+ 'lint-python',
+ command : [python, linter_script, 'lint'],
+ )
+else
+ message('Mypy or Flake8 not found. Python linting disabled')
+endif
+
+
+autopep8 = find_program(
+ 'autopep8',
+ required : false,
+)
+isort = find_program(
+ 'isort',
+ required : false,
+)
+
+if autopep8.found() and isort.found()
+ run_target(
+ 'format-python',
+ command : [python, linter_script, 'format'],
+ )
+else
+ message('autopep8 or isort not found. Python formatting disabled')
+endif