diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:05 +0000 |
commit | 1cc8413aaf5f8fa6595aece1933462c096e88639 (patch) | |
tree | e97b4f25c511372d73bdd96c389c5f468d99138a /tests/meson.build | |
parent | Initial commit. (diff) | |
download | nvme-cli-1cc8413aaf5f8fa6595aece1933462c096e88639.tar.xz nvme-cli-1cc8413aaf5f8fa6595aece1933462c096e88639.zip |
Adding upstream version 2.4+really2.3.upstream/2.4+really2.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/meson.build | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..630f35d --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,98 @@ +# 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', +] + +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 formating disabled') +endif |