Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: #162 : Adding changes for creating weak stubs and linking the same in Makefile #163

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

kanjoe24
Copy link
Contributor

Adding changes for creating weak stubs and linking the same in Makefile

@kanjoe24
Copy link
Contributor Author

tested this changes on HDMI-CEC halif, with following changes in test Makefile:

cat diff_log.txt 
diff --git a/Makefile b/Makefile
index 25a3867..08901ac 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ TOP_DIR := $(ROOT_DIR)
 SRC_DIRS = $(ROOT_DIR)/src
 INC_DIRS := $(ROOT_DIR)/../include
 HAL_LIB := RCECHal
-SKELTON_SRCS := $(ROOT_DIR)/skeletons/src/hdmi_cec_driver.c
+#SKELTON_SRCS := $(ROOT_DIR)/skeletons/src/hdmi_cec_driver.c
 VCOMPONENT_SRCS := $(wildcard $(ROOT_DIR)/vcomponent/src/*.c)
 VCOMPONENT_OBJS := $(subst src,build,$(VCOMPONENT_SRCS:.c=.o))
 
@@ -42,17 +42,20 @@ ifeq ($(TARGET),)
 $(info TARGET NOT SET )
 $(info TARGET FORCED TO Linux)
 TARGET=linux
-SRC_DIRS += $(ROOT_DIR)/skeletons/src
+#SRC_DIRS += $(ROOT_DIR)/skeletons/src
 YLDFLAGS += -lpthread -lrt
 endif
 
+# Add the source files from skeletons/src directory
+BUILD_WEAK_STUBS_SRC = $(ROOT_DIR)/skeletons/src
+
 $(info TARGET [$(TARGET)])
 
 ifeq ($(TARGET),arm)
 HAL_LIB_DIR := $(ROOT_DIR)/libs
 YLDFLAGS = -Wl,-rpath,$(HAL_LIB_DIR) -L$(HAL_LIB_DIR) -l$(HAL_LIB)  -lpthread -lrt
 ifeq ("$(wildcard $(HAL_LIB_DIR)/lib$(HAL_LIB).so)","")
-SETUP_SKELETON_LIBS := skeleton
+#SETUP_SKELETON_LIBS := skeleton
 endif
 endif
 
@@ -75,6 +78,7 @@ export INC_DIRS
 export TARGET
 export TOP_DIR
 export HAL_LIB_DIR
+export BUILD_WEAK_STUBS_SRC
 
 .PHONY: clean list build skeleton vcomponent
 
diff --git a/build.sh b/build.sh
index 6b77cee..b3b26c3 100755
--- a/build.sh
+++ b/build.sh
@@ -59,7 +59,8 @@ else
     git clone ${TEST_REPO} ut-core
     check_next_revision
     cd ./ut-core
-    git checkout ${UT_CORE_PROJECT_VERSION}
+    #git checkout ${UT_CORE_PROJECT_VERSION}
+    git checkout feature/gh162-Makefile-changes-for-weak-stubs
     ./build.sh $@
     cd ..
     ./${0} $@

@kanjoe24
Copy link
Contributor Author

kanjoe24 commented Dec 18, 2024

Weak stubs lib is made in the build/${TARGET}:

 tree build/linux/
build/linux/
├── lib
│   └── libweak_stubs_libs.a
└── obj
    ├── hal_test
    ├── skeletons
    │   └── src
    │       └── hdmi_cec_driver.o
    ├── src
    │   ├── main.o
    │   ├── test_l1_hdmi_cec_driver.o
    │   ├── test_l2_hdmi_cec_sink_driver.o
    │   ├── test_l2_hdmi_cec_source_driver.o
    │   ├── test_l3_hdmi_cec_driver.o
    │   ├── test_register.o
    │   └── test_vcomponent.o
    └── ut-core
        ├── framework
        │   └── CUnit-2.1-3
        │       └── CUnit
        │           └── Sources
        │               └── Framework
        │                   ├── CUError.o
        │                   ├── MyMem.o
        │                   ├── TestDB.o
        │                   ├── TestRun.o
        │                   └── Util.o
        └── src
            ├── c_source
            │   ├── cunit_lgpl
            │   │   ├── ut_automated.o
            │   │   ├── ut_basic.o
            │   │   └── ut_console.o
            │   └── ut_cunit.o
            ├── ut_kvp_profile.o
            └── ut_main.o


tree ut/build/arm/
ut/build/arm/
├── lib
│   └── libweak_stubs_libs.a
└── obj
    ├── hal_test
    ├── skeletons
    │   └── src
    │       └── hdmi_cec_driver.o
    ├── src
    │   ├── main.o
    │   ├── test_l1_hdmi_cec_driver.o
    │   ├── test_l2_hdmi_cec_sink_driver.o
    │   ├── test_l2_hdmi_cec_source_driver.o
    │   ├── test_l3_hdmi_cec_driver.o
    │   ├── test_register.o
    │   └── test_vcomponent.o
    └── ut-core
        ├── framework
        │   └── CUnit-2.1-3
        │       └── CUnit
        │           └── Sources
        │               └── Framework
        │                   ├── CUError.o
        │                   ├── MyMem.o
        │                   ├── TestDB.o
        │                   ├── TestRun.o
        │                   └── Util.o
        └── src
            ├── c_source
            │   ├── cunit_lgpl
            │   │   ├── ut_automated.o
            │   │   ├── ut_basic.o
            │   │   └── ut_console.o
            │   └── ut_cunit.o
            ├── ut_kvp_profile.o
            └── ut_main.o

14 directories, 21 files

@kanjoe24 kanjoe24 requested a review from Ulrond December 18, 2024 12:29
@kanjoe24 kanjoe24 self-assigned this Dec 18, 2024
@kanjoe24 kanjoe24 added the enhancement New feature or request label Dec 18, 2024
Makefile Outdated Show resolved Hide resolved
@kanjoe24
Copy link
Contributor Author

The path for object files changed:

tree ut/build
ut/build
└── linux
    ├── lib
    │   └── libweak_stubs_libs.a
    └── obj
        ├── hal_test
        ├── src
        │   ├── main.o
        │   ├── test_l1_hdmi_cec_driver.o
        │   ├── test_l2_hdmi_cec_sink_driver.o
        │   ├── test_l2_hdmi_cec_source_driver.o
        │   ├── test_l3_hdmi_cec_driver.o
        │   ├── test_register.o
        │   └── test_vcomponent.o
        ├── ut-core
        │   ├── framework
        │   │   └── CUnit-2.1-3
        │   │       └── CUnit
        │   │           └── Sources
        │   │               └── Framework
        │   │                   ├── CUError.o
        │   │                   ├── MyMem.o
        │   │                   ├── TestDB.o
        │   │                   ├── TestRun.o
        │   │                   └── Util.o
        │   └── src
        │       ├── c_source
        │       │   ├── cunit_lgpl
        │       │   │   ├── ut_automated.o
        │       │   │   ├── ut_basic.o
        │       │   │   └── ut_console.o
        │       │   └── ut_cunit.o
        │       ├── ut_kvp_profile.o
        │       └── ut_main.o
        └── weak_stubs
            └── src
                └── hdmi_cec_driver.o


@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch from 3d4d7b9 to 5b4370e Compare December 19, 2024 10:59
@kanjoe24 kanjoe24 requested a review from Ulrond December 19, 2024 11:09
@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch 2 times, most recently from 0294205 to fb826e6 Compare December 20, 2024 23:01
@kanjoe24
Copy link
Contributor Author

kanjoe24 commented Dec 20, 2024

I have modified the weak_stubs to be a shared lib rather than a static one. Also added tests that implements weak functions for ut_kvp.c and ut_log.c.

With these changes when ut-test is run with both ut-control(linked first) and weak_stubs(linked last) linked following is the result

Building shared library weak_stubs_libs...
Copy shared library weak_stubs_libs to [/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin]
cp /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/build/linux/lib/libweak_stubs_libs.so /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin
Linking test /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/ut-test
gcc -ggdb -o0 -Wall /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/CUError.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/MyMem.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/TestDB.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/TestRun.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/Util.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/cunit_lgpl/ut_automated.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/cunit_lgpl/ut_basic.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/cunit_lgpl/ut_console.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/ut_cunit.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/ut_kvp_profile.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/ut_main.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/tests/src/c_source/ut_test_assert.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/tests/src/c_source/ut_test_kvp_profile.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/tests/src/ut_test_main.o  -o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/ut-test -DUT_CUNIT -DNDEBUG -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/../include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/ut-control/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/CUnit-2.1-3/CUnit/Headers -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src/c_source -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/ut-control/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/CUnit-2.1-3/CUnit/Headers -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src/c_source -D UT_VERSION=\"4.3.0-8-g5b4370e\"   -L/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/ut-control/build/linux/lib -lut_control -Wl,-rpath, -pthread -lpthread -L/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/build/linux/lib -lweak_stubs_libs
make[2]: Leaving directory '/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core'
ut-control LIB Copied to [/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin]
make[1]: Leaving directory '/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core'
Copy Assets to [/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin/assets] 
Build Complete
make: Leaving directory '/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests'
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ cd -
/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ ls
assets  lib  libut_control.so  libweak_stubs_libs.so  run.sh  ut-test
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ ./run.sh 
Listing Filename:[/tmp/ut-log_2024-12-20_223849.log-Listing.xml]
Results Filename:[/tmp/ut-log_2024-12-20_223849.log]
Setting Log Path [./logs]
Listing Filename:[./logs/ut-log_2024-12-20_223849.log-Listing.xml]
Results Filename:[./logs/ut-log_2024-12-20_223849.log]
Using Profile[./assets/test_kvp.yaml]

2024-12-20-22:38:49, LOG   , ut_cunit.c,   147 : ---- start of test run ----

 ut-core: Wrapper framework for testing frameworks

***************** CUNIT CONSOLE - MAIN MENU ******************************
(R)un  (S)elect  (L)ist  (A)ctivate  (F)ailures  (O)ptions  (H)elp  (Q)uit
Enter command: r

2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   636 : Running Suite : ut-kvp - assert open / close
2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile open()'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   144 : test_ut_kvp_profile_open - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   148 : test_ut_kvp_profile_open - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile open()'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile getInstance()'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   191 : Check ut_kvp_profile_getInstance() - Positive
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile getInstance()'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile close()'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   153 : test_ut_kvp_profile_close - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   157 : test_ut_kvp_profile_close - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile close()'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   636 : Running Suite : ut-kvp - assert testing yaml 
2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint8'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    43 : test_ut_kvp_profile_uint8 - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    51 : test_ut_kvp_profile_uint8 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint8'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint16'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    58 : test_ut_kvp_profile_uint16 - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    66 : test_ut_kvp_profile_uint16 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint16'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint32'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    73 : test_ut_kvp_profile_uint32 - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    81 : test_ut_kvp_profile_uint32 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint32'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint64'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    88 : test_ut_kvp_profile_uint64
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    96 : test_ut_kvp_profile_uint64 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint64'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile string'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   103 : test_ut_kvp_profile_string
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   110 : test_ut_kvp_profile_string - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile string'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile bool'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   116 : test_ut_kvp_profile_bool
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   124 : test_ut_kvp_profile_bool - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile bool'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile list count'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   132 : test_ut_kvp_profile_list_count
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   139 : test_ut_kvp_profile_list_count - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile list count'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   636 : Running Suite : ut-kvp - assert testing json 
2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint8'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    43 : test_ut_kvp_profile_uint8 - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    51 : test_ut_kvp_profile_uint8 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint8'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint16'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    58 : test_ut_kvp_profile_uint16 - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    66 : test_ut_kvp_profile_uint16 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint16'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint32'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    73 : test_ut_kvp_profile_uint32 - start
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    81 : test_ut_kvp_profile_uint32 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint32'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile uint64'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    88 : test_ut_kvp_profile_uint64
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,    96 : test_ut_kvp_profile_uint64 - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile uint64'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile string'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   103 : test_ut_kvp_profile_string
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   110 : test_ut_kvp_profile_string - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile string'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile bool'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   116 : test_ut_kvp_profile_bool
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   124 : test_ut_kvp_profile_bool - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile bool'
2024-12-20-22:38:51, LOG   , ut_console.c,   633 : 

2024-12-20-22:38:51, LOG   , ut_console.c,   639 :      Running Test : 'kvp profile list count'
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   132 : test_ut_kvp_profile_list_count
2024-12-20-22:38:51, STEP  , ut_test_kvp_profile.c,   139 : test_ut_kvp_profile_list_count - end
2024-12-20-22:38:51, LOG   , ut_console.c,   661 :      Test Complete : 'kvp profile list count'

Run Summary:    Type  Total    Ran Passed Failed Inactive
              suites      3      3    n/a      0        0
               tests     17     17     17      0        0
             asserts     58     58     58      0      n/a

Elapsed time =    0.006 seconds


***************** CUNIT CONSOLE - MAIN MENU ******************************
(R)un  (S)elect  (L)ist  (A)ctivate  (F)ailures  (O)ptions  (H)elp  (Q)uit
Enter command: q

2024-12-20-22:38:54, LOG   , ut_cunit.c,   177 : Logfile:[./logs/ut-log_2024-12-20_223849.log]
2024-12-20-22:38:54, LOG   , ut_cunit.c,   185 : ---- end of test run ----

@kanjoe24
Copy link
Contributor Author

On the other hand when ut_control is removed, following is the result

Building shared library weak_stubs_libs...
Copy shared library weak_stubs_libs to [/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin]
cp /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/build/linux/lib/libweak_stubs_libs.so /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin
Linking test /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/ut-test
gcc -ggdb -o0 -Wall /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/CUError.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/MyMem.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/TestDB.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/TestRun.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/framework/CUnit-2.1-3/CUnit/Sources/Framework/Util.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/cunit_lgpl/ut_automated.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/cunit_lgpl/ut_basic.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/cunit_lgpl/ut_console.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/c_source/ut_cunit.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/ut_kvp_profile.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/src/ut_main.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/tests/src/c_source/ut_test_assert.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/tests/src/c_source/ut_test_kvp_profile.o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/tests/src/ut_test_main.o  -o /home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/linux/obj/ut-test -DUT_CUNIT -DNDEBUG -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/../include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/ut-control/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/CUnit-2.1-3/CUnit/Headers -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src/c_source -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/ut-control/include -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/framework/CUnit-2.1-3/CUnit/Headers -I/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/src/c_source -D UT_VERSION=\"4.3.0-8-g5b4370e\"   -Wl,-rpath, -pthread -lpthread -L/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/build/linux/lib -lweak_stubs_libs
make[2]: Leaving directory '/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core'
ut-control LIB Copied to [/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin]
make[1]: Leaving directory '/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core'
Copy Assets to [/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin/assets] 
Build Complete
make: Leaving directory '/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests'
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ 
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core (feature/gh162-Makefile-changes-for-weak-stubs)$ cd -
/home/jpn323/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ ls
assets  lib  libut_control.so  libweak_stubs_libs.so  run.sh  ut-test
jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ ./run.sh 
Weak implementation of [UT_log_setLogFilePath]Weak implementation of [UT_log_getLogFilename]Listing Filename:[default_log_file.log-Listing.xml]
Results Filename:[default_log_file.log]
Setting Log Path [./logs]
Weak implementation of [UT_log_setLogFilePath]Weak implementation of [UT_log_getLogFilename]Listing Filename:[default_log_file.log-Listing.xml]
Results Filename:[default_log_file.log]
Using Profile[./assets/test_kvp.yaml]
Weak implementation of [ut_kvp_createInstance]Weak implementation of [ut_kvp_open]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]

 ut-core: Wrapper framework for testing frameworks

***************** CUNIT CONSOLE - MAIN MENU ******************************
(R)un  (S)elect  (L)ist  (A)ctivate  (F)ailures  (O)ptions  (H)elp  (Q)uit
Enter command: r
Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_createInstance]Weak implementation of [ut_kvp_open]Weak implementation of [ut_kvp_createInstance]Weak implementation of [ut_kvp_open]Weak implementation of [ut_kvp_createInstance]Weak implementation of [ut_kvp_open]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_createInstance]Weak implementation of [ut_kvp_open]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getStringField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getStringField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getStringField]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getListCount]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getListCount]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getListCount]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_createInstance]Weak implementation of [ut_kvp_open]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt8Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt16Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt32Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getUInt64Field]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getStringField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getStringField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getStringField]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getBoolField]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getListCount]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getListCount]Weak implementation of [UT_logPrefix]Weak implementation of [ut_kvp_getListCount]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]

Run Summary:    Type  Total    Ran Passed Failed Inactive
              suites      3      3    n/a      0        0
               tests     17     17      2     15        0
             asserts     57     57      8     49      n/a

Elapsed time =    0.001 seconds


***************** CUNIT CONSOLE - MAIN MENU ******************************
(R)un  (S)elect  (L)ist  (A)ctivate  (F)ailures  (O)ptions  (H)elp  (Q)uit
Enter command: q
Weak implementation of [UT_log_getLogFilename]Weak implementation of [UT_logPrefix]Weak implementation of [UT_logPrefix]jpn323@janus ~/workspace/rdk-halif-hdmi_cec/ut/ut-core/tests/build/bin (feature/gh162-Makefile-changes-for-weak-stubs)$ 

@kanjoe24
Copy link
Contributor Author

Also the directory structure from hal interface looks like below

 tree ut/build
ut/build
└── linux
    ├── lib
    │   └── libweak_stubs_libs.so
    └── obj
        ├── hal_test
        ├── src
        │   ├── main.o
        │   ├── test_l1_hdmi_cec_driver.o
        │   ├── test_l2_hdmi_cec_sink_driver.o
        │   ├── test_l2_hdmi_cec_source_driver.o
        │   ├── test_l3_hdmi_cec_driver.o
        │   ├── test_register.o
        │   └── test_vcomponent.o
        ├── ut-core
        │   ├── framework
        │   │   └── CUnit-2.1-3
        │   │       └── CUnit
        │   │           └── Sources
        │   │               └── Framework
        │   │                   ├── CUError.o
        │   │                   ├── MyMem.o
        │   │                   ├── TestDB.o
        │   │                   ├── TestRun.o
        │   │                   └── Util.o
        │   └── src
        │       ├── c_source
        │       │   ├── cunit_lgpl
        │       │   │   ├── ut_automated.o
        │       │   │   ├── ut_basic.o
        │       │   │   └── ut_console.o
        │       │   └── ut_cunit.o
        │       ├── ut_kvp_profile.o
        │       └── ut_main.o
        └── weak_stubs
            └── src
                └── hdmi_cec_driver.o

15 directories, 21 files
jpn323@janus ~/workspace/rdk-halif-hdmi_cec (develop)$ tree ut/bin/
ut/bin/
├── hal_test
├── lib
│   └── libweak_stubs_libs.so
├── libut_control.so
└── libweak_stubs_libs.so

@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch from fb826e6 to fdf8b4d Compare December 20, 2024 23:31
Updating the weak stub static libraray to shared library as the vendor
specific libs are mostly shared rather than static.
Also added some tests to check the functionality
@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch from fdf8b4d to 5a1949c Compare December 20, 2024 23:32
Makefile Show resolved Hide resolved
@avyak123
Copy link

Hi,
Tried cross compiling bridge-util hal with the changes in the latest commit, and it worked as expected. The weak symbols from the skeleton shared library were successfully overridden by the strong symbols from the vendor-specific library when the hal test binary was executed.
Thanks

@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch from 09547b4 to 6d824dc Compare December 23, 2024 14:14
@kanjoe24 kanjoe24 requested a review from Ulrond December 23, 2024 14:15
@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch from 6d824dc to 9d210d9 Compare December 23, 2024 14:16
Ulrond
Ulrond previously approved these changes Dec 24, 2024
Makefile Show resolved Hide resolved
@kanjoe24 kanjoe24 force-pushed the feature/gh162-Makefile-changes-for-weak-stubs branch from 9d210d9 to 986f176 Compare December 24, 2024 11:35
@kanjoe24 kanjoe24 requested a review from Ulrond December 24, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Approved For Merge
Development

Successfully merging this pull request may close these issues.

Makefile changes to support building of weak stubs
3 participants