[llvm] 953bb5e - [test] Make sure the test program in GetErrcMessages.cmake exits normally.

Markus Böck via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 04:22:46 PDT 2021


Author: Markus Böck
Date: 2021-03-16T12:22:40+01:00
New Revision: 953bb5e5c8f60dc769942a3615d800fe166ffd1d

URL: https://github.com/llvm/llvm-project/commit/953bb5e5c8f60dc769942a3615d800fe166ffd1d
DIFF: https://github.com/llvm/llvm-project/commit/953bb5e5c8f60dc769942a3615d800fe166ffd1d.diff

LOG: [test] Make sure the test program in GetErrcMessages.cmake exits normally.

If for some reason the test program does not exit normally it'd currently lead to a false positive and it's stdout output being assigned to the output variable.

Instead, check the test program exited normally before assigning the process output to the out variable.

Follow up on rGaf2796c76d2ff4b73165ed47959afd35a769beee
Fixes an issue discovered post commit in https://reviews.llvm.org/D98278

Added: 
    

Modified: 
    llvm/cmake/modules/GetErrcMessages.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/GetErrcMessages.cmake b/llvm/cmake/modules/GetErrcMessages.cmake
index 908b1f538b95..2db1e0304ba0 100644
--- a/llvm/cmake/modules/GetErrcMessages.cmake
+++ b/llvm/cmake/modules/GetErrcMessages.cmake
@@ -29,7 +29,7 @@ function(get_errc_messages outvar)
             ${errc_test_code}
             RUN_OUTPUT_VARIABLE errc_result
             COMPILE_OUTPUT_VARIABLE errc_compile_errors)
-    if (errc_compiled)
+    if (errc_compiled AND "${errc_exit_code}" STREQUAL "0")
         set(${outvar} ${errc_result} PARENT_SCOPE)
     else()
         set(${outvar} "" PARENT_SCOPE)


        


More information about the llvm-commits mailing list