include(cc_test)

if(USE_NPU)
  cc_test(
    NAME
      acl_graph_executor_test
    SRCS
      acl_graph_executor_test.cpp
    DEPS
      :xllm_server
      :runtime
      :model_loader
      :batch
      :block
      :model
      :models
      :sampler
      :kv_cache
      GTest::gtest_main
      torch_npu
      atb_customize
  )
  target_link_libraries(acl_graph_executor_test
                        PRIVATE
                        torch_npu
                        ascendcl
                        hccl
                        c_sec
                        nnopbase)
  target_link_options(acl_graph_executor_test PRIVATE
    "-Wl,--whole-archive"
    "${CMAKE_BINARY_DIR}/third_party/spdlog/libspdlog.a"
    "-Wl,--no-whole-archive")
endif()

cc_test(
  NAME
    spec_input_builder_test
  SRCS
    spec_input_builder_test.cpp
    "${PROJECT_SOURCE_DIR}/xllm/core/runtime/spec_input_builder.cpp"
  DEPS
    torch
    glog::glog
    proto::xllm_proto
    GTest::gtest_main
)

if(USE_MLU)
  cc_test(
    NAME
      mlu_graph_executor_test
    SRCS
      mlu_graph_executor_test.cpp
    DEPS
      :runtime
      :model_loader
      :batch
      :kv_cache
      :platform
      GTest::gtest_main
      torch_mlu
  )
endif()

if(USE_CUDA)
  cc_test(
    NAME
      cuda_graph_executor_test
    SRCS
      cuda_graph_executor_test.cpp
    DEPS
      :runtime
      :cuda_layers
      :batch
      :block
      :kv_cache
      :kernels
      GTest::gtest_main
      torch
  )
endif()
