Skip to content

Commit

Permalink
dutils.sh: Add option to store output to a file
Browse files Browse the repository at this point in the history
This patch adds an option to store the output of the commands to a file
with the name of command and timestamp as below:
>> Output is stored in dutils_output_addr2line_2023.01.12-18.21.24.txt
>> Output is stored in dutils_output_trap_2023.01.12-18.20.20.txt
>> Output is stored in dutils_output_nm_2023.01.12-18.22.39.txt

Signed-off-by: Vidisha Thapa <[email protected]>
  • Loading branch information
thapav authored and sunghan-chang committed Jan 13, 2023
1 parent f707499 commit d48544b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions os/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
/tinyara_memstats.txt
/.appSpec
/.bininfo
/dutils_output_*.txt
27 changes: 22 additions & 5 deletions os/dutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TOPDIR="${OSDIR}/.."
BINDIR="${TOPDIR}/build/output/bin"
TRAPDIR="${TOPDIR}/tools/trap"
DOCKER_VERSION="1.5.5"

OUTPUTFILE="dutils_output_"

# Checking docker is installed
nodocker() {
Expand Down Expand Up @@ -207,6 +207,7 @@ function MENU()
unset SELECTED_START

while [ 1 ]; do
OUTPUTFILE="dutils_output_"
if [ ! -z "$1" ];then
SELECTED_START=$1
else
Expand Down Expand Up @@ -243,12 +244,21 @@ function MENU()
function TOOLCHAIN()
{
ARGS=arm-none-eabi-$2

OUTPUTFILE+="$2"
TIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S")
OUTPUTFILE=$OUTPUTFILE"_"$TIMESTAMP.txt

while test $# -gt 0; do
ARGS+=" "$3
shift
done
echo $ARGS
docker run --rm -v ${TOPDIR}:/root/tizenrt -w /root/tizenrt/os --privileged tizenrt/tizenrt:${DOCKER_VERSION} $ARGS

echo "Executing: $ARGS" | tee $OUTPUTFILE
echo "" >> $OUTPUTFILE
docker run --rm -v ${TOPDIR}:/root/tizenrt -w /root/tizenrt/os --privileged tizenrt/tizenrt:${DOCKER_VERSION} $ARGS | tee -a $OUTPUTFILE

echo ">> Output is stored in $OUTPUTFILE"
}

function TRAP_RUN()
Expand All @@ -264,15 +274,22 @@ function TRAP_RUN()
TRAPCMD+=" -c ../../os/"$4
fi

OUTPUTFILE+="trap"
TIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S")
OUTPUTFILE=$OUTPUTFILE"_"$TIMESTAMP.txt

# Parse kernel elf path
make -C "tools" -f Makefile.export TOPDIR=".." EXPORTDIR=".."
source "./makeinfo.sh"
rm -f "makeinfo.sh"
TRAPCMD+=" -e tinyara$EXEEXT"

echo "Executing: $TRAPCMD"
echo "Executing: $TRAPCMD" | tee $OUTPUTFILE
echo "" >> $OUTPUTFILE
# execute TRAP script
docker run --rm ${DOCKER_OPT} -v ${TOPDIR}:/root/tizenrt -it -w /root/tizenrt/tools/trap --privileged tizenrt/tizenrt:1.5.6 python3.7 $TRAPCMD
docker run --rm ${DOCKER_OPT} -v ${TOPDIR}:/root/tizenrt -it -w /root/tizenrt/tools/trap --privileged tizenrt/tizenrt:1.5.6 python3.7 $TRAPCMD | tee -a $OUTPUTFILE

echo ">> Output is stored in $OUTPUTFILE"
}

function HELP()
Expand Down

0 comments on commit d48544b

Please sign in to comment.