Skip to content

Commit

Permalink
Add gh #78 : Adding tests in ut-core to support multiple inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
kanjoe24 committed Dec 19, 2024
1 parent 86416dd commit 51266eb
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"cwd": "${workspaceFolder}/tests/build/bin/",
"program": "${workspaceFolder}/tests/build/bin/ut-test",
"environment": [ {"name": "LD_LIBRARY_PATH", "value":"${workspaceFolder}/tests/build/bin/"} ],
"args": [ "-l", "${workspaceFolder}/tests/logs/", "-p", "${workspaceFolder}/tests/build/bin/assets/test_kvp.yaml"],
"args": [ "-l", "${workspaceFolder}/tests/logs/", "-p", "${workspaceFolder}/tests/build/bin/assets/test_kvp.yaml", "-p", "${workspaceFolder}/tests/build/bin/assets/config-test.yaml"],
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ popd > /dev/null # ${MY_DIR}
# Therefore in that case it warns you but doesnt' chnage to that version, which could cause your tests to break.
# Change this to upgrade your ut-control Major versions. Non ABI Changes 1.x.x are supported, between major revisions

UT_CONTROL_PROJECT_VERSION="1.6.1" # Fixed version
UT_CONTROL_PROJECT_VERSION="1.6.1" # Fixed version, #TODO: change to 1.6.2 once ut-control is merged

# Clone the Unit Test Requirements
[email protected]:rdkcentral/ut-control.git
Expand All @@ -85,6 +85,7 @@ function check_ut_control_revision()
echo -e ${RED}--- New Version of ut-control released [${UT_NEXT_VERSION}] consider upgrading ---${NC}
fi
fi
UT_CONTROL_PROJECT_VERSION=feature/gh62-multiple-profile-input-support
echo -e ${YELLOW}ut-control version selected:[${UT_CONTROL_PROJECT_VERSION}]${NC}
popd > /dev/null
}
Expand Down
59 changes: 59 additions & 0 deletions tests/src/assets/config-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
profile: DUMMY_PROFILE # Dummy string value
hal version: X.X.X # Dummy string value
components: # Array of dummy components
- name: ComponentManager1 # Dummy component object begins
interfaceVersion: X # Dummy integer value
ResourceList1: # Dummy resource list
- id: 0 # Dummy resource object begins
dummyCapabilities: # Array of dummy capabilities
- DUMMY_CAPABILITY_1
- DUMMY_CAPABILITY_2
- DUMMY_CAPABILITY_3
- DUMMY_CAPABILITY_4
supportsFeatureX: true
- id: 1
dummyCapabilities:
- DUMMY_CAPABILITY_1
- DUMMY_CAPABILITY_2
- DUMMY_CAPABILITY_3
- DUMMY_CAPABILITY_4
supportsFeatureX: true
- name: ComponentManager2 # Another dummy component
interfaceVersion: X
platformCapabilities:
- supportsFeatureY: false
sampleRateHz: 00000
pcmFormat: DUMMY_FORMAT
supportsAdditionalFormat: false
ResourceList2:
- id: 0
- id: 1
- name: ComponentManager3
interfaceVersion: X
supportedModes:
- DUMMY_MODE
ResourceList3:
- id: 0
dummyCapabilities:
- capability: DUMMY_CODEC_1
maxFrameRate: XX
maxFrameWidth: XXXX
maxFrameHeight: XXXX
- capability: DUMMY_CODEC_2
maxFrameRate: XX
maxFrameWidth: XXXX
maxFrameHeight: XXXX
supportedRanges:
- RANGE_1
- RANGE_2
- RANGE_3
supportsFeatureZ: true
- id: 1
dummyCapabilities:
- capability: DUMMY_CODEC_1
maxFrameRate: XX
maxFrameWidth: XXXX
maxFrameHeight: XXXX
supportedRanges:
- RANGE_1
supportsFeatureZ: true
18 changes: 16 additions & 2 deletions tests/src/c_source/ut_test_kvp_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <ut_kvp_profile.h>

#define KVP_VALID_TEST_ASSERT_YAML_FILE "assets/test_kvp.yaml"
#define KVP_VALID_TEST_CONFIG_YAML_FILE "assets/config-test.yaml"
#define KVP_VALID_TEST_ASSERT_JSON_FILE "assets/test_kvp.json"

static UT_test_suite_t *gpAssertSuite1 = NULL;
Expand Down Expand Up @@ -143,8 +144,21 @@ void test_ut_kvp_profile_open( void )
{
UT_LOG_STEP( "test_ut_kvp_profile_open - start" );
ut_kvp_profile_open( KVP_VALID_TEST_ASSERT_YAML_FILE );
ut_kvp_profile_open( KVP_VALID_TEST_ASSERT_YAML_FILE );
ut_kvp_profile_open( KVP_VALID_TEST_ASSERT_YAML_FILE );
ut_kvp_profile_open( KVP_VALID_TEST_CONFIG_YAML_FILE );
ut_kvp_instance_t *pInstance;

pInstance = ut_kvp_profile_getInstance();
char* kvpdata = ut_kvp_getData(pInstance);

if(kvpdata != NULL)
{
// Print the emitted KVP string
printf("%s\n", kvpdata);

// Free the emitted KVP string
free(kvpdata);
}

UT_LOG_STEP( "test_ut_kvp_profile_open - end" );
}

Expand Down

0 comments on commit 51266eb

Please sign in to comment.