[th/handle-test-not-found] run: better handle invalid test name
When running ./run/runtest.sh bogus
, we previously got just a misleading
backtrace, about accessing an array out of bounds.
$ ./nmci/helpers/version_control.py bogus
Traceback (most recent call last):
File "/data/src/NetworkManager-ci/./nmci/helpers/version_control.py", line 16, in <module>
(feature, test_name, tags) = nmci.misc.test_version_check(test_name=sys.argv[1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/src/NetworkManager-ci/./nmci/helpers/../../nmci/misc.py", line 905, in test_version_check
feature_file = self.test_find_feature_file(test_name=test_name, feature=feature)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/src/NetworkManager-ci/./nmci/helpers/../../nmci/misc.py", line 870, in test_find_feature_file
mapper_feature = [
^
IndexError: list index out of range
Better handle invalid test names, and print a suitable failure message.
$ ./nmci/helpers/version_control.py bogus
Test "bogus" not found