scripts: unit-test: Derive package name from meson.build

The implementation for package name derivation implemented in
BuildSystem.__init__() simply takes the basename of the directory
containing the source code if another name isn't supplied.

For meson builds we can make a smarter choice, and the result is that
we can lift the requirement that the directory be named after the
project. This is helpful for some workflows where the CI container is
run locally.

By introspecting the build configuration we can extract the meson
project name. Defining the package name as the project name is useful
for meson command invocations. For example, the project name can be used
to specify constraints on build variables (`-D<project>:werror=false`)
and test setups (`--setup=<project>:valgrind`), preventing configuration
from incorrectly propagating into other (sub)projects.

Override the package name once the build configuration is available.

Change-Id: I52dc03253a54589cba0ff2fae5ddba2a74d458ba
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
1 file changed