1# Copyright (c) 2010, 2021, Oracle and/or its affiliates.
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License, version 2.0,
5# as published by the Free Software Foundation.
6#
7# This program is also distributed with certain software (including
8# but not limited to OpenSSL) that is licensed under separate terms,
9# as designated in a particular file or component or in included license
10# documentation.  The authors of MySQL hereby grant you an additional
11# permission to link the program and your derivative works with the
12# separately licensed software that they have included with MySQL.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License, version 2.0, for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
23SET(SCRIPT "@SCRIPT@")
24SET(WITH_EMBEDDED_SERVER "@WITH_EMBEDDED_SERVER@")
25SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
26
27FILE(STRINGS "${SCRIPT}"  commands)
28FOREACH(command ${commands})
29  SET(SKIP_COMMAND 0)
30
31  IF(NOT WITH_EMBEDDED_SERVER)
32    IF(command MATCHES "--embedded")
33      MESSAGE(STATUS
34       "Skipping command ${command}, because embedded server was not built")
35      SET(SKIP_COMMAND 1)
36    ENDIF()
37  ENDIF()
38
39  IF(command MATCHES "--suite=nist")
40    IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/mysql-test/suite/nist)
41      MESSAGE(STATUS
42        "Skipping command ${command}, because NIST test suite does not exist")
43      SET(SKIP_COMMAND 1)
44    ENDIF()
45  ENDIF()
46
47  IF(NOT SKIP_COMMAND)
48    # Convert string to list (EXECUTE_PROCESS needs lists)
49    STRING(REGEX REPLACE "[ ]+" ";" command "${command}" )
50    EXECUTE_PROCESS(COMMAND ${command} RESULT_VARIABLE result)
51    IF(NOT result EQUAL 0)
52      # Give a non-fatal warning if process failed
53      LIST(LENGTH command length)
54      IF(length)
55        LIST(GET command 0 exe)
56        MESSAGE(STATUS "EXECUTE_PROCESS ${exe} failed with ${result}")
57      ENDIF()
58    ENDIF()
59  ENDIF()
60ENDFOREACH()
61
62