]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3732] Meson: Report shell tests as xml in builddir by default
authorAndrei Pavel <andrei@isc.org>
Tue, 22 Apr 2025 16:10:32 +0000 (19:10 +0300)
committerAndrei Pavel <andrei@isc.org>
Wed, 23 Apr 2025 20:35:06 +0000 (23:35 +0300)
fuzz/main.cc
src/lib/testutils/meson.build
src/lib/testutils/xml_reporting_test_lib.sh.in

index fdb7d68057340c216d6bd04bc34953c8f7de67ab..741d8e7028606e26ced0293eeaeb93311fd4bc3a 100644 (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();
     }
index e6b8d673fffa88ffb591bc033f420ec61dd09583..b0fd2220f3b00281072f21bc0fda5b4da3b1ee0a 100644 (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}),
 )
index 73ed55cb0019d22be3e56ce0b753db0d9db0057e..da37a24e745d0f21251b799d911e06f63b38ea61 100755 (executable)
@@ -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")