2010-10-08 11:16:04 +04:00
include ( ProcessorCount )
ProcessorCount ( processor_count )
2011-03-18 21:28:24 +03:00
message ( "### 1. This line should be the first line of text in the test output." )
message ( "### 2. If there was output from this test before line #1, then the" )
message ( "### 3. ProcessorCount(...) function call is emitting output that it shouldn't..." )
2010-10-08 11:16:04 +04:00
message ( "processor_count='${processor_count}'" )
2010-11-09 22:29:52 +03:00
execute_process (
2013-01-25 02:15:13 +04:00
C O M M A N D " $ { K W S Y S _ T E S T _ E X E } "
2010-11-09 22:29:52 +03:00
t e s t S y s t e m I n f o r m a t i o n
2011-03-18 21:28:24 +03:00
O U T P U T _ V A R I A B L E t s i _ o u t
2013-01-23 23:23:18 +04:00
E R R O R _ V A R I A B L E t s i _ e r r
R E S U L T _ V A R I A B L E t s i _ r e s
)
if ( tsi_res )
message ( "executing \" ${ KWSYS_TEST_EXE } \" failed " )
message ( FATAL_ERROR "output: ${tsi_res}" )
endif ( )
2010-11-09 22:29:52 +03:00
string ( REGEX REPLACE "(.*)GetNumberOfPhysicalCPU:.([0-9]*)(.*)" "\\2"
2011-03-18 21:28:24 +03:00
s y s t e m _ i n f o _ p r o c e s s o r _ c o u n t " $ { t s i _ o u t } " )
2010-11-10 18:23:50 +03:00
2010-11-09 22:29:52 +03:00
message ( "system_info_processor_count='${system_info_processor_count}'" )
if ( system_info_processor_count EQUAL processor_count )
message ( "processor count matches system information" )
2010-11-08 17:37:04 +03:00
endif ( )
2010-11-10 18:23:50 +03:00
message ( "" )
message ( "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)" )
message ( "" )
2011-03-18 21:28:24 +03:00
message ( "tsi_out='${tsi_out}'" )
message ( "tsi_err='${tsi_err}'" )
2010-11-10 18:23:50 +03:00
message ( "" )
2010-11-09 22:29:52 +03:00
# Evaluate possible error conditions:
#
set ( err 0 )
2011-03-10 00:21:10 +03:00
set ( fatal 0 )
2010-11-09 22:29:52 +03:00
2010-10-08 11:16:04 +04:00
if ( processor_count EQUAL 0 )
2010-11-09 22:29:52 +03:00
set ( err 1 )
2011-03-10 00:21:10 +03:00
set ( fatal 1 )
2010-11-10 18:23:50 +03:00
message ( "err 1" )
2010-11-09 22:29:52 +03:00
message ( " could not determine number of processors
2010-11-08 17:37:04 +03:00
- A d d i t i o n a l c o d e f o r t h i s p l a t f o r m n e e d e d i n P r o c e s s o r C o u n t . c m a k e ? " )
2010-11-10 18:23:50 +03:00
message ( "" )
2010-10-08 11:16:04 +04:00
endif ( )
2010-11-09 22:29:52 +03:00
if ( NOT system_info_processor_count EQUAL processor_count )
set ( err 2 )
2010-11-10 18:23:50 +03:00
message ( "err 2" )
2010-11-09 22:29:52 +03:00
message ( "SystemInformation and ProcessorCount.cmake disagree:\n"
" p r o c e s s o r _ c o u n t = ' $ { p r o c e s s o r _ c o u n t } ' \ n "
" S y s t e m I n f o r m a t i o n p r o c e s s o r _ c o u n t = ' $ { s y s t e m _ i n f o _ p r o c e s s o r _ c o u n t } ' " )
2010-11-10 18:23:50 +03:00
message ( "" )
2010-11-09 22:29:52 +03:00
endif ( )
if ( NOT processor_count MATCHES "^[0-9]+$" )
set ( err 3 )
2011-03-10 00:21:10 +03:00
set ( fatal 1 )
2010-11-10 18:23:50 +03:00
message ( "err 3" )
2010-11-09 22:29:52 +03:00
message ( "ProcessorCount function returned a non-integer" )
2010-11-10 18:23:50 +03:00
message ( "" )
2010-11-09 22:29:52 +03:00
endif ( )
if ( NOT system_info_processor_count MATCHES "^[0-9]+$" )
set ( err 4 )
2010-11-10 18:23:50 +03:00
message ( "err 4" )
2010-11-09 22:29:52 +03:00
message ( "SystemInformation ProcessorCount function returned a non-integer" )
2010-11-10 18:23:50 +03:00
message ( "" )
2010-11-09 22:29:52 +03:00
endif ( )
2011-03-10 00:21:10 +03:00
if ( fatal )
message ( FATAL_ERROR "processor_count='${processor_count}' - see previous test output for more details - it is likely more/different code is needed in ProcessorCount.cmake to fix this test failure - processor_count should be a non-zero positive integer (>=1) for all supported CMake platforms" )
2010-11-09 22:29:52 +03:00
endif ( )