From ae4cecd14c36f7bf68a5357727e5874822bebe60 Mon Sep 17 00:00:00 2001
From: Juan Carrano <j.carrano@fu-berlin.de>
Date: Wed, 22 Aug 2018 15:51:00 +0200
Subject: [PATCH] tools/doccheck: Detect when `make doc` fails to run.

The previous doccheck would give a false negative when doxygen does
not even run (for example, because of misconfiguration).

Also, when doxygen fails to run, print the full output.
---
 dist/tools/doccheck/check.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/dist/tools/doccheck/check.sh b/dist/tools/doccheck/check.sh
index b709cd7fca..f5fa0e27ef 100755
--- a/dist/tools/doccheck/check.sh
+++ b/dist/tools/doccheck/check.sh
@@ -20,15 +20,20 @@ else
     CRESET=
 fi
 
-ERRORS=$(make -C "${RIOTBASE}" doc 2>&1 | \
-            grep '.*warning' | \
-            sed "s#${PWD}/\([^:]*\)#\1#g")
+DOXY_OUTPUT=$(make -C "${RIOTBASE}" doc 2>&1)
+DOXY_ERRCODE=$?
 
-if [ -n "${ERRORS}" ]
-then
-    echo -e "${CERROR}ERROR: Doxygen generates the following warnings:${CRESET}"
-    echo "${ERRORS}"
+if [ "${DOXY_ERRCODE}" -ne 0 ] ; then
+    echo "'make doc' exited with non-zero code (${DOXY_ERRCODE})"
+    echo "${DOXY_OUTPUT}"
     exit 2
+else
+    ERRORS=$(echo "${DOXY_OUTPUT}" | grep '.*warning' | sed "s#${PWD}/\([^:]*\)#\1#g")
+    if [ -n "${ERRORS}" ] ; then
+        echo -e "${CERROR}ERROR: Doxygen generates the following warnings:${CRESET}"
+        echo "${ERRORS}"
+        exit 2
+    fi
 fi
 
 exclude_filter() {
-- 
GitLab