tests/kvm: Forward the test environment variables to the VM

This will help with finding the right libdefault.so and correctly setup
the GLib test framework.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2152>
This commit is contained in:
Jonas Ådahl 2022-02-09 10:47:50 +01:00 committed by Marge Bot
parent 3650cb941f
commit 31bc1c80ab
2 changed files with 10 additions and 0 deletions

View File

@ -27,6 +27,12 @@ endif
virtme_run = find_program('virtme-run.sh')
vm_env_entries = []
foreach name, value: test_env_variables
vm_env_entries += ['@0@=@1@'.format(name, value)]
endforeach
vm_env = ' '.join(vm_env_entries)
foreach test_case: privileged_tests
test('kvm-' + test_case['name'], virtme_run,
suite: ['core', 'mutter/kvm', 'mutter/kvm/' + test_case['suite']],
@ -34,12 +40,14 @@ foreach test_case: privileged_tests
kernel_image_target,
],
workdir: mutter_srcdir,
env: test_env,
args: [
kernel_image_path,
meta_dbus_runner.full_path(),
'--kvm',
test_case['executable'].full_path(),
meson.current_build_dir(),
vm_env,
]
)
endforeach

View File

@ -8,6 +8,7 @@ WRAPPER="$2"
WRAPPER_ARGS="$3"
TEST_EXECUTABLE="$4"
TEST_BUILD_DIR="$5"
VM_ENV="$6"
TEST_RESULT_FILE=$(mktemp -p "$TEST_BUILD_DIR" -t test-result-XXXXXX)
echo 1 > "$TEST_RESULT_FILE"
@ -16,6 +17,7 @@ VIRTME_ENV="\
HOME=$HOME \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH \
XDG_DATA_DIRS=$XDG_DATA_DIRS \
$VM_ENV \
"
virtme-run \