diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 346e7ba65..3d5ac20a7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,7 +18,7 @@ file(GLOB test_srcs CONFIGURE_DEPENDS # ) # google unit test -add_executable(unit_tests test.cpp c_api.cpp gtest_main.cpp tests.cpp) +add_executable(unit_tests main.cpp c_api.cpp tests.cpp) target_include_directories(unit_tests PRIVATE ${ORT_HEADER_DIR} ${CMAKE_SOURCE_DIR}/src diff --git a/test/gtest_main.cpp b/test/gtest_main.cpp deleted file mode 100644 index e12572ece..000000000 --- a/test/gtest_main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#include -#include -#include - -extern std::unique_ptr g_ort_env; - -int main(int argc, char **argv) { - std::cout << "Generators Utility Library" << std::endl; - std::cout << "Initializing OnnxRuntime... "; - std::cout.flush(); - Ort::InitApi(); - g_ort_env = OrtEnv::Create(); - std::cout << "done" << std::endl; - ::testing::InitGoogleTest(&argc, argv); - int result = RUN_ALL_TESTS(); - std::cout << "Shutting down OnnxRuntime... "; - g_ort_env.release(); - std::cout << "done" << std::endl; - return result; -} \ No newline at end of file diff --git a/test/main.cpp b/test/main.cpp index 012b1c6b4..e12572ece 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,43 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#include #include #include -// #include "tests.cpp" -// #include "c_api.cpp" extern std::unique_ptr g_ort_env; -void Test_GreedySearch_Gpt_Fp32_C_API(); -void Test_GreedySearch_Gpt_Fp32(); -void Test_BeamSearch_Gpt_Fp32(); - -#if USE_CUDA -void Test_GreedySearch_Gpt_Cuda(); -void Test_BeamSearch_Gpt_Cuda(); -#endif - -int main() { +int main(int argc, char **argv) { std::cout << "Generators Utility Library" << std::endl; - - try { - - std::cout << "Initializing OnnxRuntime..."; - std::cout.flush(); - Ort::InitApi(); - g_ort_env = OrtEnv::Create(); - std::cout << "done" << std::endl; - - Test_GreedySearch_Gpt_Fp32_C_API(); - Test_GreedySearch_Gpt_Fp32(); - Test_BeamSearch_Gpt_Fp32(); - -#if USE_CUDA - Test_GreedySearch_Gpt_Cuda(); - Test_BeamSearch_Gpt_Cuda(); -#endif - } catch (const std::exception& e) { - std::cout << "Fatal Exception: " << e.what() << std::endl; - } - return 0; -} + std::cout << "Initializing OnnxRuntime... "; + std::cout.flush(); + Ort::InitApi(); + g_ort_env = OrtEnv::Create(); + std::cout << "done" << std::endl; + ::testing::InitGoogleTest(&argc, argv); + int result = RUN_ALL_TESTS(); + std::cout << "Shutting down OnnxRuntime... "; + g_ort_env.release(); + std::cout << "done" << std::endl; + return result; +} \ No newline at end of file diff --git a/test/test.cpp b/test/test.cpp deleted file mode 100644 index bed7b59ed..000000000 --- a/test/test.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -// Demonstrate some basic assertions. -TEST(HelloTest, BasicAssertions) { - // Expect two strings not to be equal. - EXPECT_STRNE("hello", "world"); - // Expect equality. - EXPECT_EQ(7 * 6, 42); -} \ No newline at end of file