2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[#3732] Meson: Report shell tests as xml in builddir by default

This commit is contained in:
Andrei Pavel
2025-04-22 19:10:32 +03:00
parent b617fe75d3
commit c87c5c99ed
3 changed files with 15 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ main(int, char* argv[]) {
// Determine some paths.
Path const this_binary(argv[0]);
string ancestor_path(this_binary.parentPath());
// TODO: remove kludgy if-condition when autotools gets removed.
// TODO: remove kludgy if-condition when autotools are removed.
if (Path(ancestor_path).filename() == ".libs") {
ancestor_path = Path(ancestor_path).parentPath();
}

View File

@@ -27,5 +27,5 @@ configure_file(
configure_file(
input: 'xml_reporting_test_lib.sh.in',
output: 'xml_reporting_test_lib.sh',
copy: true,
configuration: configuration_data({'TOP_BUILD_DIR': TOP_BUILD_DIR}),
)

View File

@@ -14,8 +14,8 @@ set -eu
# Add an entry to the XML test report.
report_test_result_in_xml() {
# If GTEST_OUTPUT is not defined...
if ! test -n "${GTEST_OUTPUT+x}"; then
# TODO: Remove this if-statemenet when autotools are removed.
if test ! -d "@TOP_BUILD_DIR@"; then
# There is nowhere to report.
return
fi
@@ -32,12 +32,18 @@ report_test_result_in_xml() {
test_suite=$(printf '%s' "${test_name}" | cut -d '.' -f 1)
test_case=$(printf '%s' "${test_name}" | cut -d '.' -f 2-)
# Strip the 'xml:' at the start of GTEST_OUTPUT if it is there.
xml="${GTEST_OUTPUT}"
if test "$(printf '%s' "${xml}" | cut -c 1-4)" = 'xml:'; then
xml=$(printf '%s' "${xml}" | cut -c 5-)
# If GTEST_OUTPUT is defined...
if test -n "${GTEST_OUTPUT+x}"; then
# Strip the 'xml:' at the start of GTEST_OUTPUT if it is there.
xml="${GTEST_OUTPUT}"
if test "$(printf '%s' "${xml}" | cut -c 1-4)" = 'xml:'; then
xml=$(printf '%s' "${xml}" | cut -c 5-)
fi
xml="${xml}/${test_suite}.sh.xml"
else
# Report in the same place as the default meson test logs.
xml="@TOP_BUILD_DIR@/meson-logs/${test_suite}.sh.xml"
fi
xml="${xml}/${test_suite}.sh.xml"
# Convert to seconds, but keep the millisecond precision.
duration=$(_calculate "${duration} / 1000.0")