Skip to content

Commit a215494

Browse files
Add ML-based contextual classification tests with YAML config and integration tests (#194)
Signed-off-by: Varun Singhal <varusing@qti.qualcomm.com>
1 parent 486a20e commit a215494

7 files changed

Lines changed: 839 additions & 125 deletions

File tree

contextual-classifier/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ if(FLORET_FOUND)
5656

5757
target_link_libraries(ml_inference_lib PRIVATE ${FLORET_LIBRARIES})
5858
target_link_libraries(ContextualClassifier PRIVATE ml_inference_lib)
59+
target_link_libraries(ContextualClassifier PRIVATE RestuneCore)
5960

6061
target_include_directories(ml_inference_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Include)
6162
target_include_directories(ml_inference_lib PRIVATE ${FLORET_INCLUDE_DIRS})

tests/CMakeLists.txt

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ if(BUILD_TESTS)
3030
install(TARGETS UrmTestPlugin DESTINATION ${CMAKE_INSTALL_LIBDIR}/urm)
3131

3232
add_executable(
33-
RestuneComponentTests
34-
${CMAKE_CURRENT_SOURCE_DIR}/Component/ParserTests.cpp
35-
${CMAKE_CURRENT_SOURCE_DIR}/Component/ExtensionIntfTests.cpp
33+
UrmComponentTests
3634
${CMAKE_CURRENT_SOURCE_DIR}/Component/MemoryPoolTests.cpp
3735
${CMAKE_CURRENT_SOURCE_DIR}/Component/ClientDataManagerTests.cpp
36+
${CMAKE_CURRENT_SOURCE_DIR}/Component/ParserTests.cpp
37+
${CMAKE_CURRENT_SOURCE_DIR}/Component/ExtensionIntfTests.cpp
3838
${CMAKE_CURRENT_SOURCE_DIR}/Component/MiscTests.cpp
3939
${CMAKE_CURRENT_SOURCE_DIR}/Component/RequestQueueTests.cpp
4040
${CMAKE_CURRENT_SOURCE_DIR}/Component/ThreadPoolTests.cpp
@@ -46,19 +46,62 @@ if(BUILD_TESTS)
4646
# ${CMAKE_CURRENT_SOURCE_DIR}/Component/RequestMapTests.cpp
4747
${CMAKE_CURRENT_SOURCE_DIR}/Component/Trigger.cpp)
4848

49-
target_link_libraries(RestuneComponentTests PUBLIC UrmAuxUtils
50-
UrmExtAPIs
51-
RestuneCore
52-
RestuneTestUtils)
49+
target_link_libraries(UrmComponentTests PUBLIC UrmAuxUtils
50+
UrmExtAPIs
51+
RestuneCore
52+
RestuneTestUtils
53+
${LIBYAML_LIBRARIES})
54+
target_include_directories(UrmComponentTests PRIVATE ${LIBYAML_INCLUDE_DIRS}
55+
${CMAKE_SOURCE_DIR}/resource-tuner/Include
56+
${CMAKE_SOURCE_DIR}/common/Include)
57+
58+
if(BUILD_CLASSIFIER)
59+
set(FLORET_FOUND FALSE)
60+
set(FLORET_LIBRARIES "")
61+
set(FLORET_INCLUDE_DIRS "")
62+
63+
if(ENABLE_FLORET)
64+
# Use pkg-config to find floret
65+
pkg_check_modules(PC_FLORET QUIET floret)
66+
if(PC_FLORET_FOUND)
67+
set(FLORET_FOUND TRUE)
68+
set(FLORET_LIBRARIES ${PC_FLORET_LIBRARIES})
69+
set(FLORET_INCLUDE_DIRS ${PC_FLORET_INCLUDE_DIRS})
70+
endif()
71+
endif()
72+
73+
if(FLORET_FOUND)
74+
message(STATUS "floret found, building MLInference with USE_FLORET=1")
75+
add_definitions(-DUSE_FLORET=1)
76+
77+
target_sources(UrmComponentTests PRIVATE
78+
${CMAKE_CURRENT_SOURCE_DIR}/Component/ContextClassificationTest.cpp)
79+
80+
target_link_libraries(UrmComponentTests PUBLIC ContextualClassifier
81+
ml_inference_lib)
82+
83+
target_include_directories(UrmComponentTests PRIVATE
84+
${CMAKE_SOURCE_DIR}/contextual-classifier/Include)
85+
else()
86+
message(STATUS "floret not found")
87+
endif()
88+
endif()
89+
90+
install(TARGETS UrmComponentTests DESTINATION ${CMAKE_INSTALL_BINDIR})
91+
92+
add_executable(UrmIntegrationTests Integration/IntegrationTests.cpp)
93+
94+
target_link_libraries(UrmIntegrationTests PUBLIC UrmAuxUtils
95+
UrmClient
96+
RestuneTestUtils
97+
${LIBYAML_LIBRARIES})
98+
target_include_directories(UrmIntegrationTests PRIVATE ${LIBYAML_INCLUDE_DIRS})
5399

54-
install(TARGETS RestuneComponentTests DESTINATION ${CMAKE_INSTALL_BINDIR})
100+
if(BUILD_CLASSIFIER)
101+
target_sources(UrmIntegrationTests PRIVATE
102+
${CMAKE_CURRENT_SOURCE_DIR}/Integration/CCIntegrationTest.cpp)
103+
endif()
55104

56-
add_executable(RestuneIntegrationTests Integration/IntegrationTests.cpp)
57-
target_link_libraries(RestuneIntegrationTests PUBLIC UrmAuxUtils
58-
UrmClient
59-
RestuneTestUtils
60-
${LIBYAML_LIBRARIES})
61-
target_include_directories(RestuneIntegrationTests PRIVATE ${LIBYAML_INCLUDE_DIRS})
62-
install(TARGETS RestuneIntegrationTests RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
105+
install(TARGETS UrmIntegrationTests RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
63106

64107
endif()

0 commit comments

Comments
 (0)