Skip to content

Commit 0d43e6c

Browse files
authored
Cleanup URM Test Framework (#205)
--- Signed-off-by: Kartik Nema <kartnema@qti.qualcomm.com>
1 parent f876207 commit 0d43e6c

5 files changed

Lines changed: 40 additions & 30 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
ls,cp,sh,mv,rm,mkdir,touch,find,irqbalance,cpuUsage.sh,which,sudo,cpu.sh,ln,uname
22
grep,sed,awk,cat,tail,head,less,more,sort,uniq,wc,cut,tr,tee
3-
ps,top,sleep,journalctl,xargs,logrotate
3+
ps,top,sleep,journalctl,xargs,logrotate,systemctl

contextual-classifier/ContextualClassifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void ContextualClassifier::ClassifierMain() {
252252
// Untune any Configurations from the last proc-invocation
253253
for(int64_t handle: this->mCurrRestuneHandles) {
254254
if(handle > 0) {
255-
untuneRequestHelper(handle);
255+
this->untuneRequestHelper(handle);
256256
}
257257
}
258258
this->mCurrRestuneHandles.clear();

tests/CMakeLists.txt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,41 +67,48 @@ if(BUILD_TESTS)
6767
set(FLORET_FOUND TRUE)
6868
set(FLORET_LIBRARIES ${PC_FLORET_LIBRARIES})
6969
set(FLORET_INCLUDE_DIRS ${PC_FLORET_INCLUDE_DIRS})
70-
endif()
70+
endif()
7171
endif()
7272

7373
if(FLORET_FOUND)
7474
message(STATUS "floret found, building MLInference with USE_FLORET=1")
7575
add_definitions(-DUSE_FLORET=1)
7676

7777
target_sources(UrmComponentTests PRIVATE
78-
${CMAKE_CURRENT_SOURCE_DIR}/Component/ContextClassificationTest.cpp)
78+
${CMAKE_CURRENT_SOURCE_DIR}/Component/ContextClassificationTest.cpp
79+
)
7980

80-
target_link_libraries(UrmComponentTests PUBLIC ContextualClassifier
81-
ml_inference_lib)
81+
target_link_libraries(UrmComponentTests PUBLIC
82+
ContextualClassifier
83+
ml_inference_lib
84+
)
8285

8386
target_include_directories(UrmComponentTests PRIVATE
84-
${CMAKE_SOURCE_DIR}/contextual-classifier/Include)
87+
${CMAKE_SOURCE_DIR}/contextual-classifier/Include
88+
)
8589
else()
8690
message(STATUS "floret not found")
8791
endif()
8892
endif()
8993

94+
# Install
9095
install(TARGETS UrmComponentTests DESTINATION ${CMAKE_INSTALL_BINDIR})
9196

9297
add_executable(UrmIntegrationTests Integration/IntegrationTests.cpp)
93-
9498
target_link_libraries(UrmIntegrationTests PUBLIC UrmAuxUtils
9599
UrmClient
96100
RestuneTestUtils
97101
${LIBYAML_LIBRARIES})
98102
target_include_directories(UrmIntegrationTests PRIVATE ${LIBYAML_INCLUDE_DIRS})
99103

100104
if(BUILD_CLASSIFIER)
101-
target_sources(UrmIntegrationTests PRIVATE
102-
${CMAKE_CURRENT_SOURCE_DIR}/Integration/CCIntegrationTest.cpp)
105+
target_sources(
106+
UrmIntegrationTests PRIVATE
107+
${CMAKE_CURRENT_SOURCE_DIR}/Integration/CCIntegrationTests.cpp
108+
)
103109
endif()
104110

111+
# Install
105112
install(TARGETS UrmIntegrationTests RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
106113

107114
endif()
Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
22
// SPDX-License-Identifier: BSD-3-Clause-Clear
33

4-
#include "ErrCodes.h"
5-
#include "UrmPlatformAL.h"
4+
#include <thread>
5+
66
#include "Utils.h"
7-
#include "TestUtils.h"
8-
#include "URMTests.h"
97
#include "UrmAPIs.h"
10-
#include <thread>
8+
#include "ErrCodes.h"
9+
#include "URMTests.h"
10+
#include "TestUtils.h"
11+
#include "UrmPlatformAL.h"
1112

1213
// Test configuration and paths
1314
#define TEST_CLASS "INTEGRATION"
@@ -17,7 +18,6 @@
1718
// Path to the Floret supervised learning model binary
1819
static const std::string FT_MODEL_PATH = CLASSIFIER_CONFIGS_DIR "floret_model_supervised.bin";
1920

20-
2121
/**
2222
* API under test: Tune / Untune
2323
* - Spawns GStreamer and verifies that correctly
@@ -45,16 +45,16 @@ URM_TEST(TestGstreamerPerAppConfigValidated, {
4545

4646
// Verify executable exists before attempting spawn
4747
if (!AuxRoutines::fileExists("/usr/bin/gst-launch-1.0")) {
48-
std::cout << LOG_BASE << "Executable not found: /usr/bin/gst-launch-1.0" << std::endl;
49-
std::cout << LOG_BASE << "Status: SKIPPED" << std::endl;
48+
LOG_SKIP("Executable not found: /usr/bin/gst-launch-1.0");
49+
SKIP;
5050
return;
5151
}
5252

5353
// Spawn GStreamer
5454
pid_t pid = fork();
5555
if (pid == 0) {
5656
// Child process: redirect output to suppress application noise
57-
int devNull = open("/dev/null", O_WRONLY);
57+
int32_t devNull = open("/dev/null", O_WRONLY);
5858
if (devNull != -1) {
5959
dup2(devNull, STDERR_FILENO);
6060
dup2(devNull, STDOUT_FILENO);
@@ -128,18 +128,15 @@ URM_TEST(TestViPerAppConfigValidated, {
128128

129129
// Verify executable exists before attempting spawn
130130
if (!AuxRoutines::fileExists("/usr/bin/vi")) {
131-
std::cout << LOG_BASE << "Executable not found: " <<"/usr/bin/vi"<< std::endl;
132-
std::cout << LOG_BASE << "Status: SKIPPED" << std::endl;
133-
134-
// return from this Test case if not .exe not exist
135-
return;
131+
LOG_SKIP("Executable not found: /usr/bin/vi");
132+
SKIP;
136133
}
137134

138135
// Spawn vi
139136
pid_t pid = fork();
140137
if (pid == 0) {
141138
// Child process: redirect output to suppress application noise
142-
int devNull = open("/dev/null", O_WRONLY);
139+
int32_t devNull = open("/dev/null", O_WRONLY);
143140
if (devNull != -1) {
144141
dup2(devNull, STDERR_FILENO);
145142
dup2(devNull, STDOUT_FILENO);

tests/Integration/IntegrationTests.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
#include <thread>
55

6-
#include "ErrCodes.h"
7-
#include "UrmPlatformAL.h"
86
#include "Utils.h"
7+
#include "UrmAPIs.h"
8+
#include "ErrCodes.h"
9+
#include "URMTests.h"
910
#include "TestUtils.h"
1011
#include "TestBaseline.h"
11-
#include "URMTests.h"
12-
#include "UrmAPIs.h"
12+
#include "UrmPlatformAL.h"
1313

1414
#define TEST_CLASS "INTEGRATION"
1515
#define TEST_SUBCAT "INTEGRATION"
@@ -529,7 +529,7 @@ URM_TEST(ResourceLogicalToPhysicalTranslationVerification4, {
529529
* - Verify that the Resource Node's value remains unchanged.
530530
* Cross-Reference id: [H]
531531
*/
532-
URM_TEST(UnSupportedResourceTuningVerification, {
532+
URM_TEST(TestUnSupportedResourceTuningVerification, {
533533
std::string testResourceName = "/etc/urm/tests/nodes/target_test_resource4.txt";
534534
int32_t testResourceOriginalValue = 516;
535535

@@ -3668,6 +3668,12 @@ static std::string encodeCluster(const std::string& nodePath, int32_t physicalCl
36683668
}
36693669

36703670
URM_TEST(TestMultiResourceSignal, {
3671+
int32_t physicalClusterID = baseline.getExpectedPhysicalCluster(2);
3672+
if(physicalClusterID == -1) {
3673+
LOG_SKIP("Logical Cluster: 2 not found on test device, Skipping Test Case")
3674+
SKIP
3675+
}
3676+
36713677
std::string clusResource = "/etc/urm/tests/nodes/cluster_type_resource_%d_cluster_id.txt";
36723678
int32_t physicalClusterID0 = baseline.getExpectedPhysicalCluster(0);
36733679
int32_t physicalClusterID1 = baseline.getExpectedPhysicalCluster(1);

0 commit comments

Comments
 (0)