Skip to content

Commit f876207

Browse files
Fix contextual classifier failures and cleanup nits for test (#203)
Signed-off-by: varusing <varusing@qti.qualcomm.com>
1 parent 636c056 commit f876207

3 files changed

Lines changed: 29 additions & 52 deletions

File tree

tests/Component/ContextClassificationTest.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,29 @@ std::vector<TestAppConfig> loadAppConfigs(const std::string& configPath) {
159159
return apps;
160160
}
161161

162+
/*
163+
* Description: Verifies that the URM classifier model file is properly
164+
* loaded and accessible at system startup.
165+
*/
166+
URM_TEST(TestModelLoads, {
167+
const std::string modelPath = FT_MODEL_PATH;
168+
169+
// Wait for service to settle
170+
std::this_thread::sleep_for(std::chrono::milliseconds(1800));
171+
172+
// Verify model file exists
173+
// fileExists() returns 1 if file exists, 0 if not
174+
int8_t modelExists = AuxRoutines::fileExists(modelPath);
175+
176+
if (modelExists) {
177+
std::cout << LOG_BASE << "Model file found at: " << modelPath << std::endl;
178+
}
179+
else {
180+
std::cout << LOG_BASE << "ERROR: Model file not found: " << modelPath << std::endl;
181+
}
182+
183+
E_ASSERT((modelExists == 1));
184+
})
162185

163186
/*
164187
* Description:

tests/Component/DeviceInfoTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ URM_TEST(TestDeviceClusterCount, {
3232

3333
if(expectedClusterCount == -1) {
3434
LOG_SKIP("Baseline Could not be fetched for the Target, skipping");
35-
return;
35+
SKIP;
3636
}
3737

3838
E_ASSERT((clusterCount == expectedClusterCount));
@@ -48,7 +48,7 @@ URM_TEST(TestDeviceCoreCount, {
4848

4949
if(expectedCoreCount == -1) {
5050
LOG_SKIP("Baseline Could not be fetched for the Target, skipping");
51-
return;
51+
SKIP;
5252
}
5353

5454
E_ASSERT((coreCount == expectedCoreCount));

tests/Integration/CCIntegrationTest.cpp

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,10 @@
1818
static const std::string FT_MODEL_PATH = CLASSIFIER_CONFIGS_DIR "floret_model_supervised.bin";
1919

2020

21-
/*
22-
* Description: Verifies that the URM classifier model file is properly loaded and accessible
23-
* at system startup.
24-
*/
25-
URM_TEST(TestModelLoads, {
26-
const std::string modelPath = FT_MODEL_PATH;
27-
28-
// Wait for URM service to complete initialization and settle
29-
// This ensures all service components, including the classifier subsystem,
30-
// are fully initialized before we attempt to access the model file
31-
std::this_thread::sleep_for(std::chrono::milliseconds(1800));
32-
33-
// Verify model file exists and is accessible
34-
// fileExists() returns file size if successful, -1 if file not found or inaccessible
35-
int64_t modelExists = AuxRoutines::fileExists(modelPath);
36-
37-
// Log the result for debugging
38-
if (modelExists > 0) {
39-
std::cout << LOG_BASE << "Model file found at: " << modelPath << std::endl;
40-
std::cout << LOG_BASE << "Model file size: " << modelExists << " bytes" << std::endl;
41-
} else {
42-
std::cout << LOG_BASE << "ERROR: Model file not found or inaccessible" << std::endl;
43-
std::cout << LOG_BASE << "Expected path: " << modelPath << std::endl;
44-
std::cout << LOG_BASE << "Verify model deployment and file permissions" << std::endl;
45-
}
46-
47-
// Assert that model file exists and is accessible (size > 0)
48-
E_ASSERT((modelExists > 0));
49-
})
50-
5121
/**
5222
* API under test: Tune / Untune
53-
* - Spawns GStreamer and verifies that the per-app config
54-
* correctly tunes the resource node when GStreamer is running
23+
* - Spawns GStreamer and verifies that correctly
24+
* - tunes the resource node when GStreamer is running
5525
* - Verifies resource value is set when GStreamer is active
5626
* - Verifies resource value resets once the request expires
5727
*/
@@ -61,14 +31,6 @@ URM_TEST(TestGstreamerPerAppConfigValidated, {
6131
// Wait for service to settle
6232
std::this_thread::sleep_for(std::chrono::milliseconds(1800));
6333

64-
// Verify model file exists
65-
int64_t modelExists = AuxRoutines::fileExists(modelPath);
66-
if (modelExists <= 0) {
67-
std::cout << LOG_BASE << "Model not found, skipping test" << std::endl;
68-
E_ASSERT(false);
69-
return;
70-
}
71-
7234
std::string testResourceName = "/etc/urm/tests/nodes/target_test_resource1.txt";
7335
int32_t testResourceOriginalValue = 240;
7436

@@ -141,8 +103,8 @@ URM_TEST(TestGstreamerPerAppConfigValidated, {
141103

142104
/**
143105
* API under test: Tune / Untune
144-
* - Spawns vi text editor and verifies that the per-app config
145-
* correctly tunes the resource node when vi is running
106+
* - Spawns vi text editor and verifies that correctly
107+
* - tunes the resource node when vi is running
146108
* - Verifies resource value is set when vi is active
147109
* - Verifies resource value resets once the request expires
148110
*/
@@ -152,14 +114,6 @@ URM_TEST(TestViPerAppConfigValidated, {
152114
// Wait for service to settle
153115
std::this_thread::sleep_for(std::chrono::milliseconds(1800));
154116

155-
// Verify model file exists
156-
int64_t modelExists = AuxRoutines::fileExists(modelPath);
157-
if (modelExists <= 0) {
158-
std::cout << LOG_BASE << "Model not found, skipping test" << std::endl;
159-
E_ASSERT(false);
160-
return;
161-
}
162-
163117
std::string testResourceName = "/etc/urm/tests/nodes/target_test_resource1.txt";
164118
int32_t testResourceOriginalValue = 240;
165119

0 commit comments

Comments
 (0)