meson/mesonbuild/interpreter
Eli Schwartz 7df6c6a728
add early sanity check for test programs existing
It used to be possible to do this:

```
bomb = find_program('nonexisting', required: false)
test('traceback during meson test', bomb)
```

and it would in fact bomb out, with:

```
[0/1] Running all tests.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/mesonbuild/mesonmain.py", line 149, in run
    return options.run_func(options)
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 2017, in run
    return th.doit()
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 1685, in doit
    runners.extend(self.get_test_runner(test) for test in tests)
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 1685, in <genexpr>
    runners.extend(self.get_test_runner(test) for test in tests)
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 1586, in get_test_runner
    return SingleTestRunner(test, env, name, options)
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 1308, in __init__
    self.cmd = self._get_cmd()
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 1374, in _get_cmd
    test_cmd = self._get_test_cmd()
  File "/usr/lib/python3.10/site-packages/mesonbuild/mtest.py", line 1352, in _get_test_cmd
    if self.options.no_rebuild and not os.path.isfile(testentry):
  File "/usr/lib/python3.10/genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

ERROR: Unhandled python exception

    This is a Meson bug and should be reported!
```

This is something we explicitly check for elsewhere, for example when
using a not-found program as a command in a custom target or generator.

Check for it when making a test too, and error out with a similar error.

Fixes #10091
2022-03-08 23:49:26 -05:00
..
primitives move a bunch of imports into TYPE_CHECKING blocks 2022-03-07 19:09:50 -05:00
__init__.py interpreter: replace ConfigurationDataObject with ConfigurationDataHolder 2022-01-18 17:53:29 -05:00
compiler.py fix UI regression in compiler.compiles logging 2022-02-09 19:42:16 -05:00
dependencyfallbacks.py interpreter: use typed_kwargs for subproject() 2022-03-03 10:29:14 -08:00
interpreter.py add early sanity check for test programs existing 2022-03-08 23:49:26 -05:00
interpreterobjects.py treewide: string-quote the first argument to T.cast 2022-03-07 19:01:04 -05:00
kwargs.py interpreter: use typed_kwargs for subproject() 2022-03-03 10:29:14 -08:00
mesonmain.py treewide: string-quote the first argument to T.cast 2022-03-07 19:01:04 -05:00
type_checking.py move a bunch of imports into TYPE_CHECKING blocks 2022-03-07 19:09:50 -05:00