Browse Source

GHS: Update tests for updated binary layout

The tests need to look for the items in the correct locations.
Fred Baksik 3 years ago
parent
commit
829e946c69

+ 5 - 10
Tests/GhsMulti/GhsMultiCompilerOptions/CMakeLists.txt

@@ -27,8 +27,7 @@ try_compile(RESULT
 message("Output from build:\n${OUTPUT}")
 if (RUN_TEST STREQUAL "RELEASE_FLAGS")
   find_file (fileName test_none.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/build
-    ${CMAKE_CURRENT_BINARY_DIR}/build/test_none
+    ${CMAKE_CURRENT_BINARY_DIR}/build/test_none.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -40,8 +39,7 @@ if (RUN_TEST STREQUAL "RELEASE_FLAGS")
 else()
   unset(fileName CACHE)
   find_file (fileName K1.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/build
-    ${CMAKE_CURRENT_BINARY_DIR}/build/K1
+    ${CMAKE_CURRENT_BINARY_DIR}/build/K1.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -53,8 +51,7 @@ else()
 
   unset(fileName CACHE)
   find_file (fileName K2.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/build
-    ${CMAKE_CURRENT_BINARY_DIR}/build/K2
+    ${CMAKE_CURRENT_BINARY_DIR}/build/K2.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -66,8 +63,7 @@ else()
 
   unset(fileName CACHE)
   find_file (fileName K3.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/build
-    ${CMAKE_CURRENT_BINARY_DIR}/build/K3
+    ${CMAKE_CURRENT_BINARY_DIR}/build/K3.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -79,8 +75,7 @@ else()
 
   unset(fileName CACHE)
   find_file (fileName K4.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/build
-    ${CMAKE_CURRENT_BINARY_DIR}/build/K4
+    ${CMAKE_CURRENT_BINARY_DIR}/build/K4.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)

+ 2 - 0
Tests/GhsMulti/GhsMultiExclude/CMakeLists.txt

@@ -14,4 +14,6 @@ set_target_properties( lib1 PROPERTIES EXCLUDE_FROM_ALL yes )
 
 add_library(lib2 EXCLUDE_FROM_ALL lib1.c)
 
+add_library(lib3 lib1.c)
+
 add_executable(exe1 exe1.c)

+ 53 - 51
Tests/GhsMulti/GhsMultiExclude/verify.cmake

@@ -1,54 +1,56 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-#test project was generated
-unset(fileName CACHE)
-find_file (fileName lib1.gpj
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/lib1
-  )
-
-if (fileName)
-  message("Found target lib1: ${fileName}")
-else()
-  message(SEND_ERROR "Could not find target lib1: ${fileName}")
-endif()
-
-#test project was built
-unset(fileName CACHE)
-find_file (fileName lib1.a
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/lib1
-  )
-
-if (fileName)
-  message(SEND_ERROR "Found target lib1: ${fileName}")
-else()
-  message("Could not find target lib1: ${fileName}")
-endif()
-
-#test project was generated
-unset(fileName CACHE)
-find_file (fileName lib2.gpj
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/lib2
-  )
-
-if (fileName)
-  message("Found target lib2 ${fileName}")
-else()
-  message(SEND_ERROR "Could not find target lib2: ${fileName}")
-endif()
-
-#test project was built
-unset(fileName CACHE)
-find_file (fileName lib2.a
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/lib2
-  )
-
-if (fileName)
-  message(SEND_ERROR "Found target lib2: ${fileName}")
-else()
-  message("Could not find target lib2: ${fileName}")
-endif()
+function(verify_skipped_tgt name)
+  unset(fileName CACHE)
+  find_file (fileName ${name}.tgt.gpj
+    ${CMAKE_CURRENT_BINARY_DIR}
+    )
+
+  if (fileName)
+    message("Found target ${name}: ${fileName}")
+  else()
+    message(SEND_ERROR "Could not find target ${name}: ${fileName}")
+  endif()
+
+  #test project was built
+  unset(fileName CACHE)
+  find_file (fileName lib${name}.a
+    ${CMAKE_CURRENT_BINARY_DIR}
+    )
+
+  if (fileName)
+    message(SEND_ERROR "Found target ${name}: ${fileName}")
+  else()
+    message("Could not find target ${name}: ${fileName}")
+  endif()
+endfunction()
+
+function(locate_tgt name)
+  unset(fileName CACHE)
+  find_file (fileName ${name}.tgt.gpj
+    ${CMAKE_CURRENT_BINARY_DIR}
+    )
+
+  if (fileName)
+    message("Found target ${name}: ${fileName}")
+  else()
+    message(SEND_ERROR "Could not find target ${name}: ${fileName}")
+  endif()
+
+  #test project was built
+  unset(fileName CACHE)
+  find_file (fileName lib${name}.a
+    ${CMAKE_CURRENT_BINARY_DIR}
+    )
+
+  if (fileName)
+    message( "Found target ${name}: ${fileName}")
+  else()
+    message(SEND_ERROR "Could not find target ${name}: ${fileName}")
+  endif()
+endfunction()
+
+verify_skipped_tgt(lib1)
+verify_skipped_tgt(lib2)
+locate_tgt(lib3)

+ 9 - 6
Tests/GhsMulti/GhsMultiLinkTest/CMakeLists.txt

@@ -38,8 +38,7 @@ if (RUN_TEST STREQUAL "NO_FLAGS")
 else()
   unset(fileName CACHE)
   find_file(fileName exe1.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/link_build
-    ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1
+    ${CMAKE_CURRENT_BINARY_DIR}/link_build/exe1.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -54,13 +53,14 @@ else()
     string(FIND "${fileText}" "${opt}" opt_found)
     if ( opt_found EQUAL -1 )
       message(SEND_ERROR "Could not find: ${opt}")
+    else()
+      message("located: ${opt}")
     endif()
   endforeach()
 
   unset(fileName CACHE)
   find_file (fileName lib1.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/link_build
-    ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib1
+    ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib1.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -71,13 +71,14 @@ else()
     string(FIND "${fileText}" "${opt}" opt_found)
     if (opt_found EQUAL -1)
       message(SEND_ERROR "Could not find: ${opt}")
+    else()
+      message("located: ${opt}")
     endif()
   endforeach()
 
   unset(fileName CACHE)
   find_file (fileName lib2.gpj
-    ${CMAKE_CURRENT_BINARY_DIR}/link_build
-    ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib2
+    ${CMAKE_CURRENT_BINARY_DIR}/link_build/lib2.dir
     )
   message("Parsing project file: ${fileName}")
   file(STRINGS ${fileName} fileText)
@@ -87,6 +88,8 @@ else()
     string(FIND "${fileText}" "${opt}" opt_found)
     if ( opt_found EQUAL -1 )
       message(SEND_ERROR "Could not find: ${opt}")
+    else()
+      message("located: ${opt}")
     endif()
   endforeach()
 endif()

+ 35 - 55
Tests/GhsMulti/GhsMultiMultipleProjects/verify.cmake

@@ -1,58 +1,38 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-#test project was generated
-unset(fileName CACHE)
-find_file(fileName lib3.gpj
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/lib3
-  ${CMAKE_CURRENT_BINARY_DIR}/examples
-  )
-
-if (fileName)
-  message("Found target lib3: ${fileName}")
-else()
-  message(SEND_ERROR "Could not find target lib3: ${fileName}")
-endif()
-
-#test project was generated
-unset(fileName CACHE)
-find_file (fileName exe3.gpj
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/exe3
-  ${CMAKE_CURRENT_BINARY_DIR}/examples
-  )
-
-if (fileName)
-  message("Found target exe3: ${fileName}")
-else()
-  message(SEND_ERROR "Could not find target exe3: ${fileName}")
-endif()
-
-#test project was not built
-unset(fileName CACHE)
-find_file (fileName lib3.a
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/lib3
-  ${CMAKE_CURRENT_BINARY_DIR}/examples
-  )
-
-if (fileName)
-  message(SEND_ERROR "Found target lib3: ${fileName}")
-else()
-  message("Could not find target lib3: ${fileName}")
-endif()
-
-unset(fileName CACHE)
-find_file (fileName NAMES exe3.as exe3
-  HINTS
-  ${CMAKE_CURRENT_BINARY_DIR}
-  ${CMAKE_CURRENT_BINARY_DIR}/exe3
-  ${CMAKE_CURRENT_BINARY_DIR}/examples
-  )
-
-if (fileName)
-  message(SEND_ERROR "Found target exe3: ${fileName}")
-else()
-  message("Could not find target exe3: ${fileName}")
-endif()
+function(verify_project_top name)
+  unset(fileName CACHE)
+  find_file (fileName ${name}.top.gpj
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}/sub
+    ${CMAKE_CURRENT_BINARY_DIR}/examples
+    )
+
+  if (fileName)
+    message("Found target ${name}: ${fileName}")
+  else()
+    message(SEND_ERROR "Could not find project ${name}: ${fileName}")
+  endif()
+endfunction()
+
+function(verify_exe_built name)
+  unset(fileName CACHE)
+  find_file (fileName ${name}
+    ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}/sub
+    )
+
+  if (fileName)
+    message("Found target ${name}: ${fileName}")
+  else()
+    message(SEND_ERROR "Could not find project ${name}: ${fileName}")
+  endif()
+endfunction()
+
+#test project top files were generated
+verify_project_top(test)
+verify_project_top(test2)
+verify_project_top(test3)
+verify_exe_built(exe1)
+verify_exe_built(exe2)