diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c66008..1678a59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [4.0.0](https://github.com/rdkcentral/ut-core/compare/3.2.4...4.0.0) +#### [4.1.0](https://github.com/rdkcentral/ut-core/compare/4.0.0...4.1.0) + +- PR: i117 : update ut_template [`#118`](https://github.com/rdkcentral/ut-core/pull/118) +- pr: i73: Basic working automated release script [`#89`](https://github.com/rdkcentral/ut-core/pull/89) +- Modified release-script-ut-core to include changes for CPP support [`f204021`](https://github.com/rdkcentral/ut-core/commit/f204021a0b93f3e9a740b23f855926c542abf16b) +- Incorporating changes for gtests in ut-core release script #73 [`cd05a5c`](https://github.com/rdkcentral/ut-core/commit/cd05a5c2873b2bf3bce97a5a760c72505c6182d9) +- GH73 : bringing in changes for various environments as mentioned on the main ticket [`2808bc6`](https://github.com/rdkcentral/ut-core/commit/2808bc676ff8d07c63be5df9ef22a3c157b3e928) + +### [4.0.0](https://github.com/rdkcentral/ut-core/compare/3.2.4...4.0.0) + +> 16 October 2024 - pr:i11:Adding changes for Gtest support [`#102`](https://github.com/rdkcentral/ut-core/pull/102) - Adding first level changes for Gtest support #11 [`458edee`](https://github.com/rdkcentral/ut-core/commit/458edee2d1210293697008f52ab10127c3d412d7) diff --git a/build.sh b/build.sh index 4e428ba..8f0a88a 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.5.1" # Fixed version +UT_CONTROL_PROJECT_VERSION="1.6.0" # Fixed version # Clone the Unit Test Requirements UT_CONTROL_REPO=git@github.com:rdkcentral/ut-control.git diff --git a/scripts/Release-Test-Script-Platform-Overview.md b/scripts/Release-Test-Script-Platform-Overview.md new file mode 100644 index 0000000..fe00eb3 --- /dev/null +++ b/scripts/Release-Test-Script-Platform-Overview.md @@ -0,0 +1,78 @@ +# Overview for release-test-script-platform.sh + +This Bash script is designed for automating the process of cloning a PR branch from platform test suite Git repository, building software, and validating build artifacts across multiple environments. It simplifies testing and development workflows by managing repository setup, environment-specific builds, and post-build checks for required binaries and libraries. +It also checks for the existence of various third party packages like openssl, curl, cmake, gtest etc for various environments listed below. +With these validations, it ensures if the PR is good for merge and has not broken the basic requirements. + +Following table gives the overview: + +|#|Target|Docker|Expectation +|---|-----|-----------|--------- +|1|./build_ut.sh TARGET=arm|rdk-dunfell|builds hal for target arm +|2|./build_ut.sh TARGET=arm|rdk-kirkstone|builds hal for target arm +|3|./build_ut.sh TARGET=linux|vm-sync|builds hal for target linux +|4|./build_ut.sh TARGET=linux|none|builds hal for target linux +|5|./build_ut.sh -C tests/ TARGET=arm|rdk-dunfell|builds hal tests for target arm +|6|./build_ut.sh -C tests/ TARGET=arm|rdk-kirkstone|builds hal tests for target arm +|7|./build_ut.sh -C tests/ TARGET=linux|vm-sync|builds hal tests for target linux +|8|./build_ut.sh -C tests/ TARGET=linux|none|builds hal tests for target linux + +## Key Objectives: +1. **Automated Repository Setup**: + Clones a given Git repository (or a default one if not specified) for different target environments (e.g., Ubuntu, VM-SYNC, Dunfell Linux, Dunfell ARM). + + where: + VM-SYNC : is a docker simulating the RDK linux environment + Dunfell Linux : is a docker with linux environment + Dunfell ARM : is a docker simulating the arm environment for yocto version dunfell + Kirkstone ARM : is a docker simulating the arm environment for yocto version kirkstone + +2. **Environment-Specific Builds**: + Runs a customized build process based on the environment. It supports branching logic to switch and build from a specific branch (`UT_CORE_BRANCH_NAME`) when provided. + +3. **Post-Build Checks**: + After compiling, the script verifies: + - The current branch matches the target branch. + - The existence of specific libraries such as: + - [ ] - **CURL static library** (`libcurl.a`) + - [ ] - **OpenSSL static library** (`libssl.a`) + - [ ] - **CMake binary** + - [ ] - **HAL binary** +- Each check outputs either `PASS` or `FAIL`, depending on whether the conditions are met. +- The checks vary based on the environment, allowing for customized validation for each setup. + +4. **Cross-Environment Testing**: + Supports testing on multiple environments for following packages: + + +|#|ENV/PACKAGES|CMAKE(Host)|CURL(Target)|OPENSSL(Target)|GTEST(Target) +|-----|----|--------|------|---------|----------| +|1|Ubuntu+build essentials|NO|YES|NO|YES +|2|VM-SYNC|YES|YES|YES|YES +|3|RDK-DUNFELL(arm)|NO|YES|YES|YES +|4|RDK-DUNFELL(linux)|NO|YES|NO|YES +|5|RDK-KIRKSTONE(arm)|NO|YES|YES|YES +|6|RDK-KIRKSTONE(linux)|NO|YES|NO|YES + +For ex: +On env 1, the script will check for availability of CURL library, OpenSSL libraraies and Gtest libraries for Target.It would however would not look for CMAKE binary for host as this environment already provides cmake support which is provided by build essentials. +On env 2, on the other hand, none of the packages are present , hence the script will check for all of the packages listed above. + +5. **Error Handling**: + Provides error messaging and graceful exits if any step (cloning, building, or checking) fails, ensuring robust automation. + +6. **Output and Logs**: + Generates detailed output, including build logs (`build_log.txt`), and provides real-time feedback about successes and failures for each environment. + +## Execution Flow: +1. **Clone the repository** for each environment. +2. **Run environment-specific builds** using the provided or default branch. +3. **Perform checks** on the build output to ensure that necessary files are present. +4. **Print results** for all environments in a summary format for review. + +This script is a powerful tool for managing multi-environment development workflows, allowing seamless switching between branches, running builds, and verifying output in a repeatable, automated fashion. + +## Caveats: +- Observed that during some of the runs the build_log.txt have undefined reference error, however same is not observed while runing it on terminal (w/o using the script). + In the rare case of the above occurence, user can run manually change to the respective directory, remove `ut/ut-core` and `ut/build/`, and trigger the command : `build_ut.sh TARGET=`.To print the results user can comment all the 4 commands at the end of the bash script except print_results and run the script as usual. +- This script doesnot handle the case of `build_ut.sh TARGET= VARIANT=CPP` as this change is not available from platform test-suit as of now. This script only checks that the PR changes doesnot break the platform test-suit as it exists today. \ No newline at end of file diff --git a/scripts/Release-Test-Script-Ut-Core-Overview.md b/scripts/Release-Test-Script-Ut-Core-Overview.md new file mode 100644 index 0000000..2967d5d --- /dev/null +++ b/scripts/Release-Test-Script-Ut-Core-Overview.md @@ -0,0 +1,70 @@ +# Overview of release-test-script-ut-core.sh + +## Purpose +This Bash script automates the process of cloning the PR branch on ut-core Git repository, building code, and validating build artifacts across multiple environments. It is designed to handle different system architectures (like ARM and x86) and environments (like Ubuntu, VM-SYNC, Dunfell Linux, Dunfell ARM), simplifying testing, building, and validation processes. +where: + VM-SYNC : is a docker simulating the RDK linux environment + Dunfell Linux : is a docker with linux environment + Dunfell ARM : is a docker simulating the arm environment for yocto version dunfell + Kirkstone ARM : is a docker simulating the arm environment for yocto version kirkstone +It checks for the existence of various third party packages like openssl, curl, cmake, gtest etc for various environments listed above. +With these validations, it ensures if the PR is good for merge and has not broken the basic requirements. + +Following table gives the overview: + +|#|Target|Docker|Expectation +|---|-----|-----------|--------- +|1|make TARGET=arm|rdk-dunfell|builds ut-core for target arm +|2|make TARGET=arm|rdk-kirkstone|builds ut-core for target arm +|3|make TARGET=linux|vm-sync|builds ut-core for target linux +|4|make TARGET=linux|none|builds ut-core for target linux +|5|make -C tests/ TARGET=arm|rdk-dunfell|builds ut-core tests for target arm +|6|make -C tests/ TARGET=arm|rdk-kirkstone|builds ut-core tests for target arm +|7|make -C tests/ TARGET=linux|vm-sync|builds ut-core tests for target linux +|8|make -C tests/ TARGET=linux|none|builds ut-core tests for target linux + +## Key Features + +1. **Repository Cloning**: + - The script clones a specified branch from ut-core Git repository. + - A default repository (`git@github.com:rdkcentral/ut-core.git`) is used if none is provided. + +2. **Environment-Specific Build Setup**: + - Supports different environments such as Ubuntu, VM-SYNC, Dunfell Linux, and Dunfell ARM. + - The script runs platform-specific build commands (e.g., `make` for Linux or ARM) in each environment. + +3. **Logging Build Outputs**: + - The script runs the `make` command for different targets (e.g., `linux`, `arm`) and variants (`CPP`), and logs all outputs to files such as `make_log.txt`, `make_cpp_log.txt`, etc. + - Logs can be reviewed in case of build failure. + +4. **Build Verification**: + - After building, the script checks if key artifacts : + - [ ] - static libraries - CURL, OpenSSL, GTest exist + - [ ] - binaries - CMake exist. + - Each environment has customized checks based on expected outputs (for instance, checking for the OpenSSL static library in some environments and not in others). + +5. **Error Handling**: + - If any part of the process (cloning, building, or checking) fails, the script provides detailed error messages and exits. + +6. **Environment Support**: + Supports testing on multiple environments for following packages: + + +|#|ENV/PACKAGES|CMAKE(Host)|CURL(Target)|OPENSSL(Target)|GTEST(Target) +|---|----|--------|------|---------|----------| +|1|Ubuntu+build essentials|NO|YES|NO|YES +|2|VM-SYNC|YES|YES|YES|YES +|3|RDK-DUNFELL(arm)|NO|YES|YES|YES +|4|RDK-DUNFELL(linux)|NO|YES|NO|YES +|5|RDK-KIRKSTONE(arm)|NO|YES|YES|YES +|6|RDK-KIRKSTONE(linux)|NO|YES|NO|YES + +For ex: +On env 1, the script will check for availability of CURL library, OpenSSL libraraies and Gtest libraries for Target.It would however would not look for CMAKE binary for host as this environment already provides cmake support which is provided by build essentials. +On env 2, on the other hand, none of the packages are present , hence the script will check for all of the packages listed above. + + + +## Usage Example +```bash +./release-test-script-ut-core.sh -t \ No newline at end of file diff --git a/scripts/release-test-script-platform.sh b/scripts/release-test-script-platform.sh new file mode 100755 index 0000000..f53b26d --- /dev/null +++ b/scripts/release-test-script-platform.sh @@ -0,0 +1,472 @@ +#!/bin/bash + +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2023 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * + +SCRIPT_EXEC="$(realpath $0)" +MY_DIR="$(dirname $SCRIPT_EXEC)" + +# ANSI color codes +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Function to print usage +usage() { + echo -e "${YELLOW}Usage: $0 -u -t -c ${NC}" +} + +# Parse command-line arguments +while getopts "u:t:c:" opt; do + case $opt in + u) REPO_URL="$OPTARG" ;; + t) UT_CORE_BRANCH_NAME="$OPTARG" ;; + c) UT_CONTROL_BRANCH_NAME="$OPTARG" ;; + *) usage ;; + esac +done + +# Function to print error message and exit +error_exit() { + echo -e "${RED}$1${NC}" 1>&2 + exit 1 +} + +echo "UT_CORE_BRANCH_NAME = $UT_CORE_BRANCH_NAME" +# Check if the branch name is passed else display the usage +if [ -z "$UT_CORE_BRANCH_NAME" ]; then + echo "UT_CORE_BRANCH_NAME is empty" + usage + #exit 1 +fi + +echo "UT_CONTROL_BRANCH_NAME = $UT_CONTROL_BRANCH_NAME" +# Check if the branch name is passed else display the usage +if [ -z "$UT_CONTROL_BRANCH_NAME" ]; then + echo "UT_CONTROL_BRANCH_NAME is empty" +fi + +# If repo_url is not passed by user set it to default +if [ -z "$REPO_URL" ]; then + REPO_URL=git@github.com:rdkcentral/rdk-halif-hdmi_cec.git +fi + +#git clone and change dir +run_git_clone(){ + local environment="$1" + local target="$2" + echo "environment=$environment" + echo "target=$target" + + # Git clone the branch of ut-control to carry out testing + REPO_NAME=$(basename "$REPO_URL" .git) + # Clone the repository + echo -e "${YELLOW}Cloning repository from $REPO_URL${NC}" + + PLAT_DIR=$REPO_NAME-$environment + git clone "$REPO_URL" $PLAT_DIR || error_exit "Error: Failed to clone repository." + GIT_URL=" git clone ${Platform_REPO_URL} $PLAT_DIR" + echo -e "${GREEN}GIT_URL = $GIT_URL${NC}" + + sleep 5 + +} + +run_build(){ + local environment="$1" + local target="$2" + local UT_CORE_BRANCH_NAME="$3" + local UT_CONTROL_BRANCH_NAME="$4" + echo "environment=$environment" + echo "target=$target" + echo "UT_CORE_BRANCH_NAME=$UT_CORE_BRANCH_NAME" + + if [ ! -z "$UT_CORE_BRANCH_NAME" ]; then + #command to run for downloading ut/ + command_to_run="./build_ut.sh TARGET=$target > build_log_temp.txt 2>&1" + echo -e "${GREEN}command_to_run = $command_to_run${NC}" + #($command_to_run) & + eval "$command_to_run &" + command_pid=$! + + + # Check if the command started successfully + # if [ -z "$command_pid" ]; then + # error_exit "Failed to start the command." + # fi + + echo "Started command with PID $command_pid" + + # Wait for the specified time + sleep 10 + + # Stop the command + kill -9 "$command_pid" || error_exit "Failed to stop the command." + + sleep 10 + + # switch ut-core to ut_core_branch_name + # echo "UT_CORE_BRANCH_NAME = $UT_CORE_BRANCH_NAME" + # sed -i "62s|.*| git checkout $UT_CORE_BRANCH_NAME|" ut/build.sh + # sleep 5 + # rm -rf ut/ut-core || error_exit "Failed to remove ut-core" + # sleep 5 + + if [ ! -z "$UT_CONTROL_BRANCH_NAME" ]; then + cd ut/ut-core + git checkout $UT_CORE_BRANCH_NAME + git pull + cd - + + cd ut/ut-core/framework/ut-control + git checkout $UT_CONTROL_BRANCH_NAME + git pull + cd - + rm -rf ut/build/ ut/ut-core/framework/ut-control/build/ ut/ut-core/framework/ut-control/framework/ ut/ut-core/framework/ut-control/host-tools/ + else + # switch ut-core to ut_core_branch_name + echo "UT_CORE_BRANCH_NAME = $UT_CORE_BRANCH_NAME" + sed -i "62s|.*| git checkout $UT_CORE_BRANCH_NAME|" ut/build.sh + sleep 5 + rm -rf ut/ut-core || error_exit "Failed to remove ut-core" + sleep 5 + fi + + + fi + + echo -e "${YELLOW}You may also tail the output in another shell using ${NC}" + echo -e "${MAGENTA}tail -f 100 $PWD/build_log.txt ${NC}" + ./build_ut.sh TARGET="$target" | tee build_log.txt 2>&1 + + if [ $? -eq 0 ]; then + echo -e "${GREEN}Build command executed successfully.${NC}" + else + echo -e "${RED}Build command failed. Check the logs in build_log.txt${NC}" + fi +} + +run_checks() { + # Parameters to be passed to the function + environment=$1 + architecture_type=$2 + UT_CORE_BRANCH_NAME=$3 + UT_CONTROL_BRANCH_NAME=$4 + + echo -e "${RED}==========================================================${NC}" + # Variables to test existence of different librararies + CURL_STATIC_LIB="ut/ut-core/framework/ut-control/build/${architecture_type}/curl/lib/libcurl.a" + OPENSSL_STATIC_LIB="ut/ut-core/framework/ut-control/build/${architecture_type}/openssl/lib/libssl.a" + CMAKE_HOST_BIN="ut/ut-core/framework/ut-control/host-tools/CMake-3.30.0/build/bin/cmake" + HAL_BIN="ut/bin/hal_test" + # CPP_STATIC_LIB="build/${architecture_type}/cpp_libs/lib/libgtest.a" + # CPP_MAIN_STATIC_LIB="build/${architecture_type}/cpp_libs/lib/libgtest_main.a" + + echo -e "${RED}RESULTS for ${environment} ${NC}" + + if [ ! -z "$UT_CORE_BRANCH_NAME" ]; then + cd ut/ut-core/ + + current_branch=$(git branch | grep '\*' | sed 's/* //') + + # Compare with the target branch name + if [ "${current_branch}" == "${UT_CORE_BRANCH_NAME}" ]; then + echo -e "${GREEN}On the branch $UT_CORE_BRANCH_NAME + . PASS${NC}" + else + echo -e "${RED}Branch is not switched. FAIL${NC}" + fi + + cd - + fi + + if [ ! -z "$UT_CONTROL_BRANCH_NAME" ]; then + cd ut/ut-core/framework/ut-control/ + + current_branch=$(git branch | grep '\*' | sed 's/* //') + + # Compare with the target branch name + if [ "${current_branch}" == "${UT_CONTROL_BRANCH_NAME}" ]; then + echo -e "${GREEN}On the branch $UT_CONTROL_BRANCH_NAME + . PASS${NC}" + else + echo -e "${RED}Branch is not switched. FAIL${NC}" + fi + + cd - + fi + + # Test for HAL binary + if [ -f "$HAL_BIN" ]; then + echo -e "${GREEN}$HAL_BIN exists. PASS${NC}" + else + echo -e "${RED}Hal binary does not exist. FAIL ${NC}" + fi + + # Test for CURL static library + if [[ "$environment" == "dunfell_linux" ]]; then + if [ -f "$CURL_STATIC_LIB" ]; then + echo -e "${RED}$CURL_STATIC_LIB exists. FAIL${NC}" + else + echo -e "${GREEN}CURL static lib does not exist. PASS ${NC}" + fi + else + if [ -f "$CURL_STATIC_LIB" ]; then + echo -e "${GREEN}$CURL_STATIC_LIB exists. PASS${NC}" + else + echo -e "${RED}CURL static lib does not exist. FAIL ${NC}" + fi + fi + + # Test for OpenSSL static library + if [[ "$environment" == "ubuntu" ]]; then + if [ ! -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}Openssl static lib does not exist. PASS ${NC}" + else + echo -e "${RED}Openssl static lib exists. FAIL ${NC}" + fi + elif [[ "$environment" == "VM-SYNC" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}$OPENSSL_STATIC_LIB exists. PASS ${NC}" + else + echo -e "${RED}Openssl static lib does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_arm" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}$OPENSSL_STATIC_LIB exists. PASS ${NC}" + else + echo -e "${RED}Openssl static lib does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_linux" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${RED}$OPENSSL_STATIC_LIB exists. FAIL ${NC}" + else + echo -e "${GREEN}Openssl static lib does not exist. PASS ${NC}" + fi + elif [[ "$environment" == "kirkstone_arm" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}$OPENSSL_STATIC_LIB exists. PASS ${NC}" + else + echo -e "${RED}Openssl static lib does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "kirkstone_linux" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${RED}$OPENSSL_STATIC_LIB exists. FAIL ${NC}" + else + echo -e "${GREEN}Openssl static lib does not exist. PASS ${NC}" + fi + fi + + # Test for CMAKE host binary + if [[ "$environment" == "ubuntu" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "VM-SYNC" ]]; then + if [ -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}$CMAKE_HOST_BIN exists. PASS ${NC}" + else + echo -e "${RED}CMake host binary does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_arm" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_linux" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "kirkstone_arm" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "kirkstone_linux" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + fi + + # # Test for CPP static library + # if [ -f "$CPP_STATIC_LIB" ]; then + # echo -e "${GREEN}$CPP_STATIC_LIB exists. PASS${NC}" + # else + # echo -e "${RED}CPP static lib does not exist. FAIL ${NC}" + # fi + + # # Test for CPP main static library + # if [ -f "$CPP_MAIN_STATIC_LIB" ]; then + # echo -e "${GREEN}$CPP_MAIN_STATIC_LIB exists. PASS${NC}" + # else + # echo -e "${RED}CPP main static lib does not exist. FAIL ${NC}" + # fi + + echo -e "${RED}==========================================================${NC}" +} + +# Environment-specific setups and execution +export -f run_git_clone +export -f run_checks +export -f run_build +export -f usage +export -f error_exit + +REPO_NAME=$(basename "$REPO_URL" .git) + +run_on_ubuntu_linux() { + + pushd ${MY_DIR} > /dev/null + run_git_clone "ubuntu" "linux" + # Change to the repository directory + PLAT_DIR="${REPO_NAME}-ubuntu" + pushd ${PLAT_DIR} > /dev/null + run_build "ubuntu" "linux" "$UT_CORE_BRANCH_NAME" "$UT_CONTROL_BRANCH_NAME" + run_checks "ubuntu" "linux" "$UT_CORE_BRANCH_NAME" "$UT_CONTROL_BRANCH_NAME" + popd > /dev/null + popd > /dev/null +} + +run_on_dunfell_linux() { + pushd ${MY_DIR} > /dev/null + SETUP_ENV="sc docker run rdk-dunfell" + run_git_clone "dunfell_linux" "linux" + # Change to the repository directory + PLAT_DIR="${REPO_NAME}-dunfell_linux" + pushd ${PLAT_DIR} > /dev/null + /bin/bash -c "$SETUP_ENV; $(declare -f run_build); run_build ''dunfell_linux 'linux' '$UT_CORE_BRANCH_NAME' '$UT_CONTROL_BRANCH_NAME'" + run_checks "dunfell_linux" "linux" $UT_CORE_BRANCH_NAME $UT_CONTROL_BRANCH_NAME + popd > /dev/null + popd > /dev/null +} + +run_on_dunfell_arm() { + pushd ${MY_DIR} > /dev/null + run_git_clone "dunfell_arm" "arm" + # Change to the repository directory + PLAT_DIR="${REPO_NAME}-dunfell_arm" + pushd ${PLAT_DIR} > /dev/null + /bin/bash -c "sc docker run rdk-dunfell 'cd /opt/toolchains/rdk-glibc-x86_64-arm-toolchain; \ + . environment-setup-armv7at2hf-neon-oe-linux-gnueabi; env | grep CC; cd -; \ + $(declare -f run_build); run_build 'dunfell_arm' 'arm' '$UT_CORE_BRANCH_NAME' '$UT_CONTROL_BRANCH_NAME';exit'" + run_checks "dunfell_arm" "arm" $UT_CORE_BRANCH_NAME $UT_CONTROL_BRANCH_NAME + popd > /dev/null + popd > /dev/null +} + +run_on_vm_sync_linux() { + pushd ${MY_DIR} > /dev/null + SETUP_ENV="sc docker run vm-sync" + run_git_clone "VM-SYNC" "linux" + # Change to the repository directory + PLAT_DIR="${REPO_NAME}-VM-SYNC" + pushd ${PLAT_DIR} > /dev/null + /bin/bash -c "$SETUP_ENV '$(declare -f run_build); run_build 'VM-SYNC' 'linux' '$UT_CORE_BRANCH_NAME' '$UT_CONTROL_BRANCH_NAME';'" + run_checks "VM-SYNC" "linux" $UT_CORE_BRANCH_NAME $UT_CONTROL_BRANCH_NAME + popd > /dev/null + popd > /dev/null +} + +run_on_kirkstone_linux() { + pushd ${MY_DIR} > /dev/null + SETUP_ENV="sc docker run rdk-kirkstone" + run_git_clone "kirkstone_linux" "linux" + # Change to the repository directory + PLAT_DIR="${REPO_NAME}-kirkstone_linux" + pushd ${PLAT_DIR} > /dev/null + /bin/bash -c "$SETUP_ENV; $(declare -f run_build); run_build ''kirkstone_linux 'linux' '$UT_CORE_BRANCH_NAME' '$UT_CONTROL_BRANCH_NAME'" + run_checks "kirkstone_linux" "linux" $UT_CORE_BRANCH_NAME $UT_CONTROL_BRANCH_NAME + popd > /dev/null + popd > /dev/null +} + +run_on_kirkstone_arm() { + pushd ${MY_DIR} > /dev/null + run_git_clone "kirkstone_arm" "arm" + # Change to the repository directory + PLAT_DIR="${REPO_NAME}-kirkstone_arm" + pushd ${PLAT_DIR} > /dev/null + /bin/bash -c "sc docker run rdk-kirkstone 'cd /opt/toolchains/rdk-glibc-x86_64-arm-toolchain; \ + . environment-setup-armv7at2hf-neon-oe-linux-gnueabi; env | grep CC; cd -; \ + $(declare -f run_build); run_build 'kirkstone_arm' 'arm' '$UT_CORE_BRANCH_NAME' '$UT_CONTROL_BRANCH_NAME';exit'" + run_checks "kirkstone_arm" "arm" $UT_CORE_BRANCH_NAME $UT_CONTROL_BRANCH_NAME + popd > /dev/null + popd > /dev/null +} + +print_results() { + pushd ${MY_DIR} > /dev/null + + #Results for ubuntu + PLAT_DIR="${REPO_NAME}-ubuntu" + pushd ${PLAT_DIR} > /dev/null + run_checks "ubuntu" "linux" "$UT_CORE_BRANCH_NAME" + popd > /dev/null + + #Results for VM_SYNC + PLAT_DIR="${REPO_NAME}-VM-SYNC" + pushd ${PLAT_DIR} > /dev/null + run_checks "VM-SYNC" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for dunfell-arm + PLAT_DIR="${REPO_NAME}-dunfell_arm" + pushd ${PLAT_DIR} > /dev/null + run_checks "dunfell_arm" "arm" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for dunfell-linux + PLAT_DIR="${REPO_NAME}-dunfell_linux" + pushd ${PLAT_DIR} > /dev/null + run_checks "dunfell_linux" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for kirkstone-arm + PLAT_DIR="${REPO_NAME}-kirkstone_arm" + pushd ${PLAT_DIR} > /dev/null + run_checks "kirkstone_arm" "arm" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for kirkstone-linux + PLAT_DIR="${REPO_NAME}-kirkstone_linux" + pushd ${PLAT_DIR} > /dev/null + run_checks "kirkstone_linux" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null + + popd > /dev/null + +} + +# Run tests in different environments +run_on_ubuntu_linux +run_on_dunfell_linux +run_on_vm_sync_linux +run_on_dunfell_arm +run_on_kirkstone_arm +run_on_kirkstone_linux +print_results diff --git a/scripts/release-test-script-ut-core.sh b/scripts/release-test-script-ut-core.sh new file mode 100755 index 0000000..f0c68a6 --- /dev/null +++ b/scripts/release-test-script-ut-core.sh @@ -0,0 +1,389 @@ +#!/bin/bash + +# * +# * If not stated otherwise in this file or this component's LICENSE file the +# * following copyright and licenses apply: +# * +# * Copyright 2023 RDK Management +# * +# * Licensed under the Apache License, Version 2.0 (the "License"); +# * you may not use this file except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.apache.org/licenses/LICENSE-2.0 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# * + +SCRIPT_EXEC="$(realpath $0)" +MY_DIR="$(dirname $SCRIPT_EXEC)" + +# ANSI color codes +GREEN='\033[0;32m' +RED='\033[0;31m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Function to print usage +usage() { + echo -e "${YELLOW}Usage: $0 -u -t -c ${NC}" + exit 1 +} + +# Parse command-line arguments +while getopts "u:t:c:" opt; do + case $opt in + u) REPO_URL="$OPTARG" ;; + t) UT_CORE_BRANCH_NAME="$OPTARG" ;; + c) UT_CONTROL_BRANCH_NAME="$OPTARG" ;; + *) usage ;; + esac +done + +# Function to print error message and exit +error_exit() { + echo -e "${RED}$1${NC}" 1>&2 + exit 1 +} + +echo "UT_CORE_BRANCH_NAME = $UT_CORE_BRANCH_NAME" +# Check if the branch name is passed else display the usage +if [ -z "$UT_CORE_BRANCH_NAME" ]; then + echo "UT_CORE_BRANCH_NAME is empty" + usage + exit 1 +fi + +echo "UT_CONTROL_BRANCH_NAME = $UT_CONTROL_BRANCH_NAME" +# Check if the branch name is passed else display the usage +if [ -z "$UT_CONTROL_BRANCH_NAME" ]; then + echo "UT_CONTROL_BRANCH_NAME is empty" +fi + +# If repo_url is not passed by user set it to default +if [ -z "$REPO_URL" ]; then + REPO_URL=git@github.com:rdkcentral/ut-core.git +fi +REPO_NAME=$(basename "$REPO_URL" .git) + +# # Set compiler type based on the environment passed +# case "$environment" in +# "ubuntu" | "VM-SYNC" | "dunfell_linux") architecture_type="linux" ;; +# "dunfell_arm") architecture_type="arm" ;; +# *) +# echo "Unknown environment: $environment" +# echo "Environments are : ubuntu, VM-SYNC, dunfell_arm, dunfell_linux" +# exit 1 +# ;; +# esac + +#git clone and change dir +run_git_clone(){ + local environment="$1" + echo "environment=$environment" + + # Git clone the branch of ut-control to carry out testing + REPO_NAME=$(basename "$REPO_URL" .git) + if [ ! -z "$UT_CORE_BRANCH_NAME" ]; then + # Clone the repository + echo -e "${YELLOW}Cloning repository from $REPO_URL and branch ${UT_CORE_BRANCH_NAME}${NC}" + GIT_URL="git clone ${REPO_URL} -b ${UT_CORE_BRANCH_NAME} ut-core" + git clone "$REPO_URL" -b "$UT_CORE_BRANCH_NAME" "$REPO_NAME-$environment" || error_exit "Error: Failed to clone repository." + echo -e "${GREEN}GIT_URL = $GIT_URL${NC}" + fi + + # Change to the repository directory + echo -e "Current path is: $PWD" + cd "$REPO_NAME-$environment" || error_exit "Error: Failed to change directory to $REPO_NAME-$environment." + UT_CNTRL_DIR=${MY_DIR}/$REPO_NAME-$environment + + if [ ! -z "$UT_CONTROL_BRANCH_NAME" ]; then + sed -i "108s|.*| git checkout $UT_CONTROL_BRANCH_NAME|" build.sh + fi +} + +# Define a function to run the commands +run_make_with_logs() { + local architecture_type="$1" + echo "architecture_type=$architecture_type" + + # Execute make and redirect the log to a file + echo -e "${YELLOW}Running make ...logs redirected to $PWD/make_log.txt${NC}" + make TARGET="$architecture_type" > make_log.txt 2>&1 + if [ $? -eq 0 ]; then + echo -e "${GREEN}Make command executed successfully.${NC}" + else + echo -e "Make command failed. Check the logs in make_log.txt" + fi + + echo -e "${YELLOW}Running make for CPP...logs redirected to $PWD/make_cpp_log.txt${NC}" + make clean; make TARGET="$architecture_type" VARIANT=CPP > make_cpp_log.txt 2>&1 + if [ $? -eq 0 ]; then + echo -e "${GREEN}Make command executed successfully.${NC}" + else + echo -e "Make command failed. Check the logs in make_cpp_log.txt" + fi + + # Execute make -C tests/ and redirect the log to a file + echo -e "${YELLOW}Running make -C tests/...logs redirected to $PWD/make_test_log.txt${NC}" + make TARGET="$architecture_type" -C tests/ > make_test_log.txt 2>&1 + if [ $? -eq 0 ]; then + echo -e "${GREEN}Make -C tests/ command executed successfully.${NC}" + else + echo -e "Make -C tests/ command failed. Check the logs in make_test_log.txt" + fi + + echo -e "${YELLOW}Running make -C tests/ for CPP...logs redirected to $PWD/make_cpp_log.txt${NC}" + make -C tests/ clean;make TARGET="$architecture_type" -C tests/ VARIANT=CPP > make_cpp_log.txt 2>&1 + if [ $? -eq 0 ]; then + echo -e "${GREEN}Make -C tests/ command executed successfully.${NC}" + else + echo -e "Make -C tests/ command failed. Check the logs in make_cpp_log.txt" + fi +} + +run_checks() { + # Parameters to be passed to the function + environment=$1 + architecture_type=$2 + UT_CORE_BRANCH_NAME=$3 + + echo -e "${RED}==========================================================${NC}" + # Variables to test existence of different librararies + CURL_STATIC_LIB="framework/ut-control/build/${architecture_type}/curl/lib/libcurl.a" + OPENSSL_STATIC_LIB="framework/ut-control/build/${architecture_type}/openssl/lib/libssl.a" + CMAKE_HOST_BIN="framework/ut-control/host-tools/CMake-3.30.0/build/bin/cmake" + GTEST_STATIC_LIB="build/${architecture_type}/cpp_libs/lib/libgtest.a" + GTEST_MAIN_STATIC_LIB="build/${architecture_type}/cpp_libs/lib/libgtest_main.a" + + echo -e "${RED}RESULTS for ${environment} ${NC}" + + current_branch=$(git branch | grep '\*' | sed 's/* //') + + # Compare with the target branch name + if [ "${current_branch}" == "${UT_CORE_BRANCH_NAME}" ]; then + echo -e "${GREEN}On the branch $UT_CORE_BRANCH_NAME +. PASS${NC}" + else + error_exit "Branch is not switched. FAIL" + fi + + # Test for CURL static library + if [ -f "$CURL_STATIC_LIB" ]; then + echo -e "${GREEN}$CURL_STATIC_LIB exists. PASS${NC}" + else + echo -e "${RED}CURL static lib does not exist. FAIL ${NC}" + fi + + # Test for OpenSSL static library + if [[ "$environment" == "ubuntu" ]]; then + if [ ! -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}Openssl static lib does not exist. PASS ${NC}" + else + echo -e "${RED}Openssl static lib exists. FAIL ${NC}" + fi + elif [[ "$environment" == "VM-SYNC" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}$OPENSSL_STATIC_LIB exists. PASS ${NC}" + else + echo -e "${RED}Openssl static lib does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_arm" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}$OPENSSL_STATIC_LIB exists. PASS ${NC}" + else + echo -e "${RED}Openssl static lib does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_linux" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${RED}$OPENSSL_STATIC_LIB exists. FAIL ${NC}" + else + echo -e "${GREEN}Openssl static lib does not exist. PASS ${NC}" + fi + elif [[ "$environment" == "kirkstone_arm" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${GREEN}$OPENSSL_STATIC_LIB exists. PASS ${NC}" + else + echo -e "${RED}Openssl static lib does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "kirkstone_linux" ]]; then + if [ -f "$OPENSSL_STATIC_LIB" ]; then + echo -e "${RED}$OPENSSL_STATIC_LIB exists. FAIL ${NC}" + else + echo -e "${GREEN}Openssl static lib does not exist. PASS ${NC}" + fi + fi + + # Test for CMAKE host binary + if [[ "$environment" == "ubuntu" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "VM-SYNC" ]]; then + if [ -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}$CMAKE_HOST_BIN exists. PASS ${NC}" + else + echo -e "${RED}CMake host binary does not exist. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_arm" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "dunfell_linux" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "kirkstone_arm" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + elif [[ "$environment" == "kirkstone_linux" ]]; then + if [ ! -f "$CMAKE_HOST_BIN" ]; then + echo -e "${GREEN}CMake host binary does not exist. PASS ${NC}" + else + echo -e "${RED}CMake host binary exists. FAIL ${NC}" + fi + fi + + # Test for gtest static library + if [ -f "$GTEST_STATIC_LIB" ]; then + echo -e "${GREEN}$GTEST_STATIC_LIB exists. PASS${NC}" + else + echo -e "${RED}GTEST static lib does not exist. FAIL ${NC}" + fi + + # Test for gtest main static library + if [ -f "$GTEST_MAIN_STATIC_LIB" ]; then + echo -e "${GREEN}$GTEST_MAIN_STATIC_LIB exists. PASS${NC}" + else + echo -e "${RED}GTEST main static lib does not exist. FAIL ${NC}" + fi + + echo -e "${RED}==========================================================${NC}" +} + +print_results() { + pushd ${MY_DIR} > /dev/null + + #Results for ubuntu + PLAT_DIR="${REPO_NAME}-ubuntu" + pushd ${PLAT_DIR} > /dev/null + run_checks "ubuntu" "linux" "$UT_CORE_BRANCH_NAME" + popd > /dev/null + + #Results for VM_SYNC + PLAT_DIR="${REPO_NAME}-VM-SYNC" + pushd ${PLAT_DIR} > /dev/null + run_checks "VM-SYNC" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for dunfell-arm + PLAT_DIR="${REPO_NAME}-dunfell_arm" + pushd ${PLAT_DIR} > /dev/null + run_checks "dunfell_arm" "arm" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for dunfell-linux + PLAT_DIR="${REPO_NAME}-dunfell_linux" + pushd ${PLAT_DIR} > /dev/null + run_checks "dunfell_linux" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for kirkstone-arm + PLAT_DIR="${REPO_NAME}-kirkstone_arm" + pushd ${PLAT_DIR} > /dev/null + run_checks "kirkstone_arm" "arm" $UT_CORE_BRANCH_NAME + popd > /dev/null + + #Results for kirkstone-linux + PLAT_DIR="${REPO_NAME}-kirkstone_linux" + pushd ${PLAT_DIR} > /dev/null + run_checks "kirkstone_linux" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null + + popd > /dev/null + +} + +# Environment-specific setups and execution +export -f run_make_with_logs +export -f run_checks +export -f usage +export -f error_exit + +run_on_ubuntu_linux() { + pushd ${MY_DIR} > /dev/null + run_git_clone "ubuntu" + run_make_with_logs "linux" + run_checks "ubuntu" "linux" "$UT_CORE_BRANCH_NAME" + popd > /dev/null +} + +run_on_dunfell_linux() { + pushd ${MY_DIR} > /dev/null + SETUP_ENV="sc docker run rdk-dunfell" + run_git_clone "dunfell_linux" + /bin/bash -c "$SETUP_ENV; $(declare -f run_make_with_logs); run_make_with_logs 'linux'" + run_checks "dunfell_linux" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null +} + +run_on_dunfell_arm() { + pushd ${MY_DIR} > /dev/null + run_git_clone "dunfell_arm" + /bin/bash -c "sc docker run rdk-dunfell 'cd /opt/toolchains/rdk-glibc-x86_64-arm-toolchain; \ + . environment-setup-armv7at2hf-neon-oe-linux-gnueabi; env | grep CC; cd -; \ + $(declare -f run_make_with_logs); run_make_with_logs 'arm';exit'" + run_checks "dunfell_arm" "arm" $UT_CORE_BRANCH_NAME + popd > /dev/null +} + +run_on_vm_sync_linux() { + pushd ${MY_DIR} > /dev/null + SETUP_ENV="sc docker run vm-sync" + run_git_clone "VM-SYNC" + /bin/bash -c "$SETUP_ENV '$(declare -f run_make_with_logs); run_make_with_logs 'linux';'" + run_checks "VM-SYNC" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null +} + +run_on_kirkstone_linux() { + pushd ${MY_DIR} > /dev/null + SETUP_ENV="sc docker run rdk-kirkstone" + run_git_clone "kirkstone_linux" + /bin/bash -c "$SETUP_ENV; $(declare -f run_make_with_logs); run_make_with_logs 'linux'" + run_checks "kirkstone_linux" "linux" $UT_CORE_BRANCH_NAME + popd > /dev/null +} + +run_on_kirkstone_arm() { + pushd ${MY_DIR} > /dev/null + run_git_clone "kirkstone_arm" + /bin/bash -c "sc docker run rdk-kirkstone 'cd /opt/toolchains/rdk-glibc-x86_64-arm-toolchain; \ + . environment-setup-armv7at2hf-neon-oe-linux-gnueabi; env | grep CC; cd -; \ + $(declare -f run_make_with_logs); run_make_with_logs 'arm';exit'" + run_checks "kirkstone_arm" "arm" $UT_CORE_BRANCH_NAME + popd > /dev/null +} + +# Run tests in different environments +( run_on_ubuntu_linux ) & +( run_on_dunfell_linux ) & +( run_on_kirkstone_linux ) & +wait +run_on_vm_sync_linux +run_on_dunfell_arm +run_on_kirkstone_arm +print_results diff --git a/template/ut_template/Makefile b/template/ut_template/Makefile index fd63238..fab8ebc 100644 --- a/template/ut_template/Makefile +++ b/template/ut_template/Makefile @@ -23,6 +23,7 @@ TOP_DIR := $(ROOT_DIR) SRC_DIRS = $(ROOT_DIR)/src INC_DIRS := $(ROOT_DIR)/../include +XCFLAGS := -DNDEBUG ifeq ($(TARGET),) $(info TARGET NOT SET ) @@ -31,6 +32,10 @@ TARGET=linux SRC_DIRS += $(ROOT_DIR)/skeletons/src endif +ifeq ($(TARGET),linux) +SRC_DIRS += $(ROOT_DIR)/skeletons/src +endif + $(info TARGET [$(TARGET)]) ifeq ($(TARGET),arm) @@ -47,6 +52,7 @@ export INC_DIRS export TARGET export TOP_DIR export HAL_LIB_DIR +export XCFLAGS .PHONY: clean list build diff --git a/template/ut_template/bin/run.sh b/template/ut_template/bin/run.sh index 3f95b32..60210ec 100755 --- a/template/ut_template/bin/run.sh +++ b/template/ut_template/bin/run.sh @@ -19,6 +19,52 @@ # * limitations under the License. # * +# Save the original directory where the script was called from +original_dir=$(pwd) + +# Function to convert a relative path into an absolute path +# If the path is already absolute, it remains unchanged +convert_to_absolute_path() { + if [[ "$1" = /* ]]; then + # If it's an absolute path, just return it + echo "$1" + else + # If it's a relative path, prepend the original directory to it + echo "$original_dir/$1" + fi +} + +# Loop through arguments to find the profile path (-p) and other arguments +profile_path="" +other_args=() + +while [[ $# -gt 0 ]]; do + case "$1" in + -p) # When -p flag is found, resolve the path that follows it + shift + profile_path=$(convert_to_absolute_path "$1") + ;; + *) # Collect other arguments + other_args+=("$1") + ;; + esac + shift +done + +# Change to the directory where the script is located cd "$(dirname "$0")" -export LD_LIBRARY_PATH=/usr/lib:/lib:/home/root -./hal_test $@ + +# Set necessary library paths +export LD_LIBRARY_PATH=/usr/lib:/lib:/home/root:./ + +# Run the actual program with the resolved absolute profile path if provided +if [[ -n "$profile_path" ]]; then + # If profile_path is not empty, include it in the command + ./hal_test -p "$profile_path" "${other_args[@]}" +else + # If no profile path, just run the program with other arguments + ./hal_test "${other_args[@]}" +fi + +# Optionally, return to the original directory +cd "$original_dir" \ No newline at end of file