From d79360ea13b960906dcccecbb3f22df6bbff2007 Mon Sep 17 00:00:00 2001
From: Kent McLeod <Kent.Mcleod@data61.csiro.au>
Date: Tue, 12 Mar 2019 08:30:04 +1100
Subject: [PATCH] hardware_gen.py: fail execute_process on error

Fail with an error if the script returns an error. Additionally hook
stdio up to execute process to allow easier use of python debugging
tools if required.
---
 src/arch/arm/config.cmake | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/arch/arm/config.cmake b/src/arch/arm/config.cmake
index 220b5906c..43368039d 100644
--- a/src/arch/arm/config.cmake
+++ b/src/arch/arm/config.cmake
@@ -130,7 +130,14 @@ if (DEFINED KernelDTSList)
     # Generate devices_gen header based on DTB
     execute_process(
         COMMAND ${PYTHON} "${HARDWARE_GEN_PATH}" --dtb "${KernelDTBPath}" --compatibility-strings "${compatibility_outfile}" --output "${device_dest}" --config "${config_file}" --schema "${config_schema}"
+        INPUT_FILE /dev/stdin
+        OUTPUT_FILE /dev/stdout
+        ERROR_FILE /dev/stderr
+        RESULT_VARIABLE error
     )
+    if (error)
+        message(FATAL_ERROR "Failed to generate: ${device_dest}")
+    endif()
     file(READ "${compatibility_outfile}" compatibility_strings)
 
     include(src/drivers/config.cmake)
-- 
GitLab