Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc][NFC] Fix -DSHOW_INTERMEDIATE_OBJECTS=DEPS to work properly for entry points and unit tests. #79254

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

lntue
Copy link
Contributor

@lntue lntue commented Jan 24, 2024

No description provided.

@llvmbot
Copy link

llvmbot commented Jan 24, 2024

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/79254.diff

2 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCObjectRules.cmake (+1-1)
  • (modified) libc/cmake/modules/LLVMLibCTestRules.cmake (+12-11)
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index b6c2f2d53e88d29..667d7548f783163 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -652,7 +652,7 @@ function(create_entrypoint_object fq_target_name)
   if(SHOW_INTERMEDIATE_OBJECTS)
     message(STATUS "Adding entrypoint object ${fq_target_name}")
     if(${SHOW_INTERMEDIATE_OBJECTS} STREQUAL "DEPS")
-      foreach(dep IN LISTS ADD_OBJECT_DEPENDS)
+      foreach(dep IN LISTS ADD_ENTRYPOINT_OBJ_DEPENDS)
         message(STATUS "  ${fq_target_name} depends on ${dep}")
       endforeach()
     endif()
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 46ffc8316fc8227..0d0a47b33aaeba0 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -129,6 +129,16 @@ function(create_libc_unittest fq_target_name)
   list(APPEND fq_deps_list libc.src.__support.StringUtil.error_to_string
                            libc.test.UnitTest.ErrnoSetterMatcher)
   list(REMOVE_DUPLICATES fq_deps_list)
+
+  if(SHOW_INTERMEDIATE_OBJECTS)
+    message(STATUS "Adding unit test ${fq_target_name}")
+    if(${SHOW_INTERMEDIATE_OBJECTS} STREQUAL "DEPS")
+      foreach(dep IN LISTS LIBC_UNITTEST_DEPENDS)
+        message(STATUS "  ${fq_target_name} depends on ${dep}")
+      endforeach()
+    endif()
+  endif()
+
   get_object_files_for_test(
       link_object_files skipped_entrypoints_list ${fq_deps_list})
   if(skipped_entrypoints_list)
@@ -157,15 +167,6 @@ function(create_libc_unittest fq_target_name)
     return()
   endif()
 
-  if(SHOW_INTERMEDIATE_OBJECTS)
-    message(STATUS "Adding unit test ${fq_target_name}")
-    if(${SHOW_INTERMEDIATE_OBJECTS} STREQUAL "DEPS")
-      foreach(dep IN LISTS ADD_OBJECT_DEPENDS)
-        message(STATUS "  ${fq_target_name} depends on ${dep}")
-      endforeach()
-    endif()
-  endif()
-
   if(LIBC_UNITTEST_NO_RUN_POSTBUILD)
     set(fq_build_target_name ${fq_target_name})
   else()
@@ -521,7 +522,7 @@ function(add_integration_test test_name)
       link_object_files skipped_entrypoints_list ${fq_deps_list})
   if(skipped_entrypoints_list)
     if(LIBC_CMAKE_VERBOSE_LOGGING)
-      set(msg "Skipping unittest ${fq_target_name} as it has missing deps: "
+      set(msg "Skipping integration test ${fq_target_name} as it has missing deps: "
               "${skipped_entrypoints_list}.")
       message(STATUS ${msg})
     endif()
@@ -704,7 +705,7 @@ function(add_libc_hermetic_test test_name)
   get_object_files_for_test(
       link_object_files skipped_entrypoints_list ${fq_deps_list})
   if(skipped_entrypoints_list)
-    set(msg "Skipping unittest ${fq_target_name} as it has missing deps: "
+    set(msg "Skipping hermetic test ${fq_target_name} as it has missing deps: "
             "${skipped_entrypoints_list}.")
     message(STATUS ${msg})
     return()

@@ -652,7 +652,7 @@ function(create_entrypoint_object fq_target_name)
if(SHOW_INTERMEDIATE_OBJECTS)
message(STATUS "Adding entrypoint object ${fq_target_name}")
if(${SHOW_INTERMEDIATE_OBJECTS} STREQUAL "DEPS")
foreach(dep IN LISTS ADD_OBJECT_DEPENDS)
foreach(dep IN LISTS ADD_ENTRYPOINT_OBJ_DEPENDS)
message(STATUS " ${fq_target_name} depends on ${dep}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be too verbose? How about just print out a ; separated list?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in this mode it has been very verbose. But I tried with just print out the list before, and it was very hard to parse and inspect visually.

@lntue lntue merged commit c1cb0b8 into llvm:main Jan 24, 2024
5 checks passed
@lntue lntue deleted the deps branch January 25, 2024 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants