diff --git a/fuzz/main.cc b/fuzz/main.cc index fdb7d68057..741d8e7028 100644 --- a/fuzz/main.cc +++ b/fuzz/main.cc @@ -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(); } diff --git a/src/lib/testutils/meson.build b/src/lib/testutils/meson.build index e6b8d673ff..b0fd2220f3 100644 --- a/src/lib/testutils/meson.build +++ b/src/lib/testutils/meson.build @@ -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}), ) diff --git a/src/lib/testutils/xml_reporting_test_lib.sh.in b/src/lib/testutils/xml_reporting_test_lib.sh.in index 73ed55cb00..da37a24e74 100755 --- a/src/lib/testutils/xml_reporting_test_lib.sh.in +++ b/src/lib/testutils/xml_reporting_test_lib.sh.in @@ -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")