diff --git a/.vscode/launch.json b/.vscode/launch.json index ac22f02..df2718a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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": [ diff --git a/build.sh b/build.sh index 0ce399a..8223fb6 100755 --- a/build.sh +++ b/build.sh @@ -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.2" # Fixed version # Clone the Unit Test Requirements UT_CONTROL_REPO=git@github.com:rdkcentral/ut-control.git diff --git a/tests/Makefile b/tests/Makefile index ef968a7..c80ed3c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -78,7 +78,7 @@ framework: make -C ../ framework TARGET=$(TARGET) VARIANT=${VARIANT} @${ECHOE} ${GREEN}Copy Assets to [${BIN_DIR}/assets] ${NC} @mkdir -p ${BIN_DIR}/assets - @cp ${ROOT_DIR}/src/assets/* ${BIN_DIR}/assets + @cp -r ${ROOT_DIR}/src/assets/* ${BIN_DIR}/assets @cp ${ROOT_DIR}/src/*.sh ${BIN_DIR}/. @${ECHOE} ${GREEN}Build Complete${NC} diff --git a/tests/src/assets/config-test.yaml b/tests/src/assets/config-test.yaml new file mode 100644 index 0000000..695fa34 --- /dev/null +++ b/tests/src/assets/config-test.yaml @@ -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 \ No newline at end of file diff --git a/tests/src/assets/include/2d.yaml b/tests/src/assets/include/2d.yaml new file mode 100644 index 0000000..b8cad0c --- /dev/null +++ b/tests/src/assets/include/2d.yaml @@ -0,0 +1,4 @@ +--- +"2": + value: true +include: assets/include/3d.yaml diff --git a/tests/src/assets/include/2s.yaml b/tests/src/assets/include/2s.yaml new file mode 100644 index 0000000..6e845c7 --- /dev/null +++ b/tests/src/assets/include/2s.yaml @@ -0,0 +1,3 @@ +--- +"2": + value: true diff --git a/tests/src/assets/include/3d.yaml b/tests/src/assets/include/3d.yaml new file mode 100644 index 0000000..4b9f675 --- /dev/null +++ b/tests/src/assets/include/3d.yaml @@ -0,0 +1,4 @@ +--- +"3": + value: true +include: assets/include/4d.yaml diff --git a/tests/src/assets/include/3s.yaml b/tests/src/assets/include/3s.yaml new file mode 100644 index 0000000..8cecf00 --- /dev/null +++ b/tests/src/assets/include/3s.yaml @@ -0,0 +1,3 @@ +--- +"3": + value: true diff --git a/tests/src/assets/include/4d.yaml b/tests/src/assets/include/4d.yaml new file mode 100644 index 0000000..7d1f3c3 --- /dev/null +++ b/tests/src/assets/include/4d.yaml @@ -0,0 +1,4 @@ +--- +"4": + value: true +include: assets/include/5d.yaml diff --git a/tests/src/assets/include/4s.yaml b/tests/src/assets/include/4s.yaml new file mode 100644 index 0000000..86cf0fc --- /dev/null +++ b/tests/src/assets/include/4s.yaml @@ -0,0 +1,3 @@ +--- +"4": + value: true diff --git a/tests/src/assets/include/5d.yaml b/tests/src/assets/include/5d.yaml new file mode 100644 index 0000000..7fd3e09 --- /dev/null +++ b/tests/src/assets/include/5d.yaml @@ -0,0 +1,3 @@ +--- +"5": + value: true \ No newline at end of file diff --git a/tests/src/assets/include/depth_check.yaml b/tests/src/assets/include/depth_check.yaml new file mode 100644 index 0000000..2f4fb63 --- /dev/null +++ b/tests/src/assets/include/depth_check.yaml @@ -0,0 +1,4 @@ +--- +"1": + value: true +include: assets/include/2d.yaml diff --git a/tests/src/assets/include/single-include-file.yaml b/tests/src/assets/include/single-include-file.yaml new file mode 100644 index 0000000..401dd92 --- /dev/null +++ b/tests/src/assets/include/single-include-file.yaml @@ -0,0 +1,6 @@ +--- +"1": + value: true +include_0: assets/include/2s.yaml +include_1: assets/include/3s.yaml +include_2: assets/include/4s.yaml \ No newline at end of file diff --git a/tests/src/assets/include/single-include-url.yaml b/tests/src/assets/include/single-include-url.yaml new file mode 100644 index 0000000..c2e33b1 --- /dev/null +++ b/tests/src/assets/include/single-include-url.yaml @@ -0,0 +1,6 @@ +--- +"1": + value: true +include_0: https://raw.githubusercontent.com/rdkcentral/ut-control/main/tests/src/assets/include/2s.yaml +include_1: https://raw.githubusercontent.com/rdkcentral/ut-control/main/tests/src/assets/include/3s.yaml +include_2: https://raw.githubusercontent.com/rdkcentral/ut-control/main/tests/src/assets/include/4s.yaml \ No newline at end of file diff --git a/tests/src/c_source/ut_test_kvp_profile.c b/tests/src/c_source/ut_test_kvp_profile.c index 9669fae..40d3d61 100644 --- a/tests/src/c_source/ut_test_kvp_profile.c +++ b/tests/src/c_source/ut_test_kvp_profile.c @@ -143,8 +143,6 @@ 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_LOG_STEP( "test_ut_kvp_profile_open - end" ); } @@ -178,6 +176,8 @@ int test_ut_kvp_profile_cleanup( void ) void test_ut_kvp_get_instance( void ) { bool result; + bool resultP1; + bool resultP2; ut_kvp_instance_t *pInstance; pInstance = ut_kvp_profile_getInstance(); @@ -192,6 +192,22 @@ void test_ut_kvp_get_instance( void ) // Check for decoding correctly a field from the platformProfile result = ut_kvp_getBoolField( pInstance, "decodeTest/checkBoolTRUE" ); UT_ASSERT( result == true ); + UT_LOG_STEP("Tested for profile : assets/test_kvp.yaml"); + resultP1 = ut_kvp_getBoolField( pInstance, "components/0/ResourceList1/0/supportsFeatureX" ); + UT_ASSERT( resultP1 == true ); + if(resultP1 != true) + { + UT_LOG_ERROR("perhaps platform profile(assets/config-test.yaml) was not passed using -p switch"); + } + UT_LOG_STEP("Tested for profile : assets/config-test.yaml"); + + resultP2 = ut_kvp_getBoolField( pInstance, "5/value" ); + UT_ASSERT( resultP2 == true ); + if(resultP2 != true) + { + UT_LOG_ERROR("perhaps platform profile(assets/include/5d.yaml) was not passed using -p switch"); + } + UT_LOG_STEP("Tested for profile : assets/include/5d.yaml"); } void register_kvp_profile_testing_functions(void) diff --git a/tests/src/run.sh b/tests/src/run.sh index 6176735..d289e2d 100755 --- a/tests/src/run.sh +++ b/tests/src/run.sh @@ -28,6 +28,6 @@ mkdir -p ./logs export LD_LIBRARY_PATH=/usr/lib:/lib:/home/root:${MY_DIR} -./ut-test -l ./logs -p ./assets/test_kvp.yaml $@ +./ut-test -l ./logs -p ./assets/test_kvp.yaml -p assets/config-test.yaml -p assets/include/5d.yaml $@