Commit 22dbbced authored by Garcia's avatar Garcia
Browse files

Bug fixed in scripts

parent c416ab90
Loading
Loading
Loading
Loading
+16 −15
Original line number Diff line number Diff line
@@ -67,28 +67,26 @@ RUN echo "docker-titan-STF549" > /etc/hostname \
    && useradd --create-home --shell /bin/bash etsi \
    && echo "etsi:etsi" | chpasswd \
    && adduser etsi sudo \
    && echo "" >> /etc/profile \
    && echo "export HOME=/home/etsi" >> /etc/profile \
    && echo "export LD_LIBRARY_PATH=/home/etsi/TriesAndDelete/etsi_its/lib:$LD_LIBRARY_PATH" >> /etc/profile \
    && echo "export PATH=/home/etsi/bin:$PATH" >> /etc/profile \
    && echo "cd /home/etsi" >> /etc/profile \
    && echo ". ./devenv.bash" >> /etc/profile \
    && cd /home/etsi \
    && mkdir -p .ssh bin lib include tmp frameworks docs man dev \
    && chown etsi:etsi .ssh bin lib include tmp frameworks docs man dev
    && echo "" >> /home/etsi/.bashrc \
    && echo "export HOME=/home/etsi" >> /home/etsi/.bashrc \
    && echo "export LD_LIBRARY_PATH=/home/etsi/dev/etsi_its/lib:$LD_LIBRARY_PATH" >> /home/etsi/.bashrc \
    && echo "export PATH=/home/etsi/bin:$PATH" >> /home/etsi/.bashrc \
    && echo "cd /home/etsi" >> /home/etsi/.bashrc \
    && echo ". ./devenv.bash" >> /home/etsi/.bashrc \
    && . /home/etsi/.bashrc \
    && mkdir -p bin lib include tmp frameworks docs man dev \
    && chown etsi:etsi bin lib include tmp frameworks docs man dev

USER etsi

ADD id_rsa* /home/etsi/.ssh/

RUN cd /home/etsi/dev \
    && git clone https://forge.etsi.org/gitlab/emergency-communications/NG112 ./STF549_Ng112 \
    && cd /home/etsi/dev/STF549_Ng112 \
    && git checkout TTCN_3_Developments \
    && cd /home/etsi/dev/STF549_Ng112/ttcn \
    && ssh-agent -s \
    && svn co --non-interactive svn+ssh://forge.etsi.org/svn/LibSip/trunk ./LibSip \
    && svn co --non-interactive svn+ssh://forge.etsi.org/svn/LibCommon/trunk/ttcn ./LibCommon/ttcn \
    && svn co --username svnusers --password svnusers --non-interactive --trust-server-cert https://oldforge.etsi.org/svn/LibSip/trunk ./LibSip \
    && svn co --username svnusers --password svnusers --non-interactive --trust-server-cert https://oldforge.etsi.org/svn/LibCommon/trunk/ttcn ./LibCommon/ttcn \
    && cd /home/etsi/dev/STF549_Ng112/scripts \
    && chmod 775 *.bash devenv.bash.* \
    && cd /home/etsi \
@@ -109,7 +107,10 @@ RUN cd /home/etsi/dev \
    && cd /home/etsi/dev/STF549_Ng112/scripts \
    && ./build_titan.bash \
    && . /home/etsi/devenv.bash \
    && ./update_emcom_project.bash
    && ./update_emcom_project.bash \
    && cd ${HOME}/dev/etsi_emco/src/TestCodec/objs \
    && ../bin/testcodec_generate_makefile.bash \
    && ../bin/run_all.bash 

CMD ["/bin/bash"]

+1 −3
Original line number Diff line number Diff line
@@ -3,14 +3,12 @@
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

#set -e
set -vx
#set -vx

DOCKER_FILE=./Dockerfile
if [ -f ${DOCKER_FILE} ]
then
    cp ~/.ssh/id_rsa* .
    docker build --tag stf549_ng112 --force-rm .
    rm ./id_rsa*
    if [ "$?" != "0" ]
    then
        echo "Docker build failed: $?"
+261 −0
Original line number Diff line number Diff line
#!/bin/bash

# Debug mode
#set -e
set -vx

# Usage: sudo ./merge_emcom_project.bash
# TODO Use git clone in temporary directory

OLDPWD=`pwd`

# Storing path
VAGRANT_DIR=/vagrant
if [ ! -d ${VAGRANT_DIR} ]
then
	  exit -1
else
	  VAGRANT_DIR=/vagrant/to_be_merged
	  if [ -d ${VAGRANT_DIR} ]
	  then
	      rm -f ${VAGRANT_DIR}/*
	  else
	          mkdir ${VAGRANT_DIR}
	  fi
fi

# Execution path
RUN_PATH="${0%/*}"
UNAME=`uname -n`
if [ "${UNAME}" == "Ubuntu64" ]
then # Win7 Virtualbox Ubuntu 16.04
    SRC_EMCOM_PATH=/media/sf_F_DRIVE/FSCOM/ETSI/EMCOM/STF549/workspace_titan/STF549_ng112
elif [ "${UNAME}" == "ubuntu-xenial" ]
then # Vqgrant xenial-ubuntu
    SRC_EMCOM_PATH=/media/sf_F_DRIVE/FSCOM/ETSI/EMCOM/STF549/workspace_titan/STF549_ng112
elif [ "${UNAME}" == "vagrant" ]
then # Vagrant xenial-ubuntu
    SRC_EMCOM_PATH=/media/sf_F_DRIVE/FSCOM/ETSI/EMCOM/STF549/workspace_titan/STF549_ng112
elif [ "${UNAME}" == "vagrant-prov" ]
then # Vagrant ubuntu 16.04 with provisioner script to automate EMCOM project build & test
#    CHOWN_USER_GROUP=ubuntu:ubuntu
    SRC_EMCOM_PATH=${HOME}/tmp/STF549
elif [ "${UNAME}" == "yann-FSCOM" ]
then # Win7 cygwin64
    SRC_EMCOM_PATH=/cygdrive/f/FSCOM/ETSI/EMCOM/STF549/workspace_titan/STF549_ng112
else # docket-titan
    SRC_EMCOM_PATH=${HOME}/tmp/STF549_ng112
fi
if [ "${PATH_DEV_EMCOM}" == "" ]
then
    PATH_DEV_EMCOM=`pwd`/../etsi_emcom
fi

# Update ETSI Framework files
echo 'Merging ETSI Framework files'
FWK_SRC_PATH=${SRC_EMCOM_PATH}/ccsrc
FWK_DST_PATH=${PATH_DEV_EMCOM}/framework
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/Protocols/ -name "*.h*" -type f`
for i in ${FWK_DIR_LIST_HH}
do
    BN=`basename $i`
	  s1=`sha256sum -b $i | cut -d' ' -f1`
	  s2=`sha256sum -b ${FWK_DST_PATH}/include/${BN} | cut -d' ' -f1`
	  if [ "${s1}" != "${s2}" ]
	  then
	      cp ${FWK_DST_PATH}/include/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/include/${BN}~ ]
	      then
		        rm ${FWK_DST_PATH}/include/${BN}~
	      fi
	  fi
done
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/Protocols/ -name "*.c*" -type f`
for i in ${FWK_DIR_LIST_CC}
do
    BN=`basename $i`
	  s1=`sha256sum -b $i | cut -d' ' -f1`
	  s2=`sha256sum -b ${FWK_DST_PATH}/src/${BN} | cut -d' ' -f1`
	  if [ "${s1}" != "${s2}" ]
	  then
	      cp ${FWK_DST_PATH}/src/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/src/${BN}~ ]
	      then
		        rm ${FWK_DST_PATH}/src/${BN}~
	      fi
	  fi
done
FWK_DIR_LIST_Y=`find ${FWK_SRC_PATH}/Protocols/ -name "*.y" -type f`
for i in ${FWK_DIR_LIST_Y}
do
    BN=`basename $i`
	  s1=`sha256sum -b $i | cut -d' ' -f1`
	  s2=`sha256sum -b ${FWK_DST_PATH}/src/${BN} | cut -d' ' -f1`
	  if [ "${s1}" != "${s2}" ]
	  then
	      cp ${FWK_DST_PATH}/src/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/src/${BN}~ ]
	      then
		        rm ${FWK_DST_PATH}/src/${BN}~
	      fi
	  fi
done
FWK_DIR_LIST_L=`find ${FWK_SRC_PATH}/Protocols/ -name "*.l" -type f`
for i in ${FWK_DIR_LIST_L}
do
    BN=`basename $i`
	  s1=`sha256sum -b $i | cut -d' ' -f1`
	  s2=`sha256sum -b ${FWK_DST_PATH}/src/${BN} | cut -d' ' -f1`
	  if [ "${s1}" != "${s2}" ]
	  then
	      cp ${FWK_DST_PATH}/src/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/src/${BN}~ ]
	      then
		        rm ${FWK_DST_PATH}/src/${BN}~
	      fi
	  fi
done
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/Framework/ -name "*.h*" -type f`
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/Framework/ -name "*.c*" -type f`
for i in ${FWK_DIR_LIST_HH}
do
    BN=`basename $i`
    s1=`sha256sum -b $i | cut -d' ' -f1`
    s2=`sha256sum -b ${FWK_DST_PATH}/include/${BN} | cut -d' ' -f1`
    if [ "${s1}" != "${s2}" ]
    then
	      cp ${FWK_DST_PATH}/include/${BN} ${VAGRANT_DIR} 
	      if [ -f ${FWK_DST_PATH}/include/${BN}~ ]
	      then
	          rm ${FWK_DST_PATH}/include/${BN}~
	      fi
    fi
done
for i in ${FWK_DIR_LIST_CC}
do
    BN=`basename $i`
    s1=`sha256sum -b $i | cut -d' ' -f1`
    s2=`sha256sum -b ${FWK_DST_PATH}/src/${BN} | cut -d' ' -f1`
    if [ "${s1}" != "${s2}" ]
    then
	      cp ${FWK_DST_PATH}/src/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/src/${BN}~ ]
	      then
	          rm ${FWK_DST_PATH}/src/${BN}~
	      fi
    fi
done
FWK_DIR_LIST_HH=`find ${FWK_SRC_PATH}/loggers/ -name "*.h*" -type f`
for i in ${FWK_DIR_LIST_HH}
do
    BN=`basename $i`
    s1=`sha256sum -b $i | cut -d' ' -f1`
    s2=`sha256sum -b ${FWK_DST_PATH}/include/${BN} | cut -d' ' -f1`
    if [ "${s1}" != "${s2}" ]
    then
	      cp ${FWK_DST_PATH}/include/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/include/${BN}~ ]
	      then
	          rm ${FWK_DST_PATH}/include/${BN}~
	      fi
    fi
done
FWK_DIR_LIST_CC=`find ${FWK_SRC_PATH}/loggers/ -name "*.c*" -type f`
for i in ${FWK_DIR_LIST_CC}
do
    BN=`basename $i`
    s1=`sha256sum -b $i | cut -d' ' -f1`
    s2=`sha256sum -b ${FWK_DST_PATH}/src/${BN} | cut -d' ' -f1`
    if [ "${s1}" != "${s2}" ]
    then
	      cp ${FWK_DST_PATH}/src/${BN} ${VAGRANT_DIR}
	      if [ -f ${FWK_DST_PATH}/src/${BN}~ ]
	      then
	          rm ${FWK_DST_PATH}/src/${BN}~
	      fi
    fi
done
# Update ATS TTCN-3 files
echo 'Update TTCN-3 files'
TTCN_3_ORG_PATH=${SRC_EMCOM_PATH}/ttcn
TTCN_3_DST_PATH=${PATH_DEV_EMCOM}/src
TTCN_3_ATS_LIST='AtsNg112 LibEmcom/LibNg112 LibCommon LibSip LibItsHttp'
for i in ${TTCN_3_ATS_LIST}
do
    # TTCN-3 files
    LIST_TTCN_FILES=`find ${TTCN_3_ORG_PATH}/$i -name "*.ttcn" -type f`
    for j in ${LIST_TTCN_FILES}
    do
	      BN=`basename $j`
	      s1=`sha256sum -b $j | cut -d' ' -f1`
	      s2=`sha256sum -b ${TTCN_3_DST_PATH}/$i/ttcn/${BN} | cut -d' ' -f1`
	      if [ "${s1}" != "${s2}" ]
	      then
	          cp ${TTCN_3_DST_PATH}/$i/ttcn/${BN} ${VAGRANT_DIR}
	      fi
    done
    # XSD files
    LIST_TTCN_FILES=`find ${TTCN_3_ORG_PATH}/$i -name "*.xsd" -type f`
    for j in ${LIST_TTCN_FILES}
    do
	      BN=`basename $j`
	      s1=`sha256sum -b $j | cut -d' ' -f1`
	      s2=`sha256sum -b ${TTCN_3_DST_PATH}/$i/ttcn/${BN} | cut -d' ' -f1`
	      if [ "${s1}" != "${s2}" ]
	      then
	          cp ${TTCN_3_DST_PATH}/$i/xsd/${BN} ${VAGRANT_DIR}
	      fi
    done
    # Other files
    if [ -f ${SRC_EMCOM_PATH}/docs/$i/o2.cfg ]
    then
	      s1=`sha256sum -b ${PATH_DEV_EMCOM}/src/$i/docs/o2.cfg | cut -d' ' -f1`
	      s2=`sha256sum -b ${SRC_EMCOM_PATH}/docs/$i/o2.cfg | cut -d' ' -f1`
	      if [ "${s1}" != "${s2}" ]
	      then
            mkdir -p ${VAGRANT_DIR}/docs/$i
	          cp ${PATH_DEV_EMCOM}/src/$i/docs/o2.cfg ${VAGRANT_DIR}/docs/$i
	      fi
    fi
    if [ -f ${SRC_EMCOM_PATH}/etc/$i/$i.cfg ]
    then
	      s1=`sha256sum -b ${PATH_DEV_EMCOM}/src/$i/etc/$i.cfg | cut -d' ' -f1`
	      s2=`sha256sum -b ${SRC_EMCOM_PATH}/etc/$i/$i.cfg | cut -d' ' -f1`
	      if [ "${s1}" != "${s2}" ]
	      then
            mkdir -p ${VAGRANT_DIR}/etc/$i
	          cp ${PATH_DEV_EMCOM}/src/$i/etc/%i.cfg ${VAGRANT_DIR}/etc/$i
	      fi
    fi
done

TTCN_3_LIB_LIST='LibHttp LibPemea'
for i in ${TTCN_3_LIB_LIST}
do
    LIST_TTCN_FILES=`find ${TTCN_3_ORG_PATH}/$i -name "*.ttcn" -type f`
    for j in ${LIST_TTCN_FILES}
    do
	      BN=`basename $j`
	      s1=`sha256sum -b $j | cut -d' ' -f1`
	      s2=`sha256sum -b ${TTCN_3_DST_PATH}/$i/ttcn/${BN} | cut -d' ' -f1`
	      if [ "${s1}" != "${s2}" ]
	      then
	          cp ${TTCN_3_DST_PATH}/$i/ttcn/${BN} ${VAGRANT_DIR}
	          rm ${TTCN_3_DST_PATH}/$i/ttcn/${BN}~
	      fi
    done
done


LIST_FILES=`find ${PATH_DEV_EMCOM} -name "*~" -type f`
for i in ${LIST_FILES}
do
    BN=$i
    BN=${BN:: -1} # Remove the last character
    cp ${BN} ${VAGRANT_DIR}
    rm $i
done

chmod -R 664 ${VAGRANT_DIR}
exit 0

scripts/run_all.bash

0 → 100644
+47 −0
Original line number Diff line number Diff line
#!/bin/bash
#set -e
#set -vx

clear

export LD_LIBRARY_PATH=/home/vagrant/frameworks/osip/src/osipparser2/.libs:$LD_LIBRARY_PATH

if ! [[ $1 =~ "^[0-9]+$" ]]
then
    COUNTER=$1
else
    COUNTER=1
fi

CURPWD=`pwd`
if [ ! "${PWD##*/}" == "objs" ]
then
    cd ../objs
    if [ ! $? == 0 ]
    then
        echo "Please move to PROJECT/obj directory"
        exit 1
    fi
fi

rm ../logs/merged.log.*

for i in $(seq 1 1 $COUNTER)
do
    LD_LIBRARY_PATH=/home/vagrant/frameworks/osip/src/osipparser2/.libs:$LD_LIBRARY_PATH ../bin/run_mtc.bash &
    LD_LIBRARY_PATH=/home/vagrant/frameworks/osip/src/osipparser2/.libs:$LD_LIBRARY_PATH ../bin/run_ptcs.bash $2

    dup=$(ps -ef | grep "$0" | grep -v grep | wc -l)
    while [ ${dup} -eq 3 ]
    do
        sleep 1
        dup=$(ps -ef | grep "$0" | grep -v grep | wc -l)
    done
    sleep 1
    
    mv ../logs/merged.log ../logs/merged.log.`date +'%Y%m%d%S'`
done

exit 0

scripts/run_mtc.bash

0 → 100644
+55 −0
Original line number Diff line number Diff line
#!/bin/bash
#set -evx

clear

CURPWD=`pwd`
if [ ! "${PWD##*/}" == "objs" ]
then
    cd ../objs
    if [ ! $? == 0 ]
    then
        echo "Please move to PROJECT/obj directory"
        exit 1
    fi
fi

TITAN_LOG_DIR=../logs
if [ ! -d ${TITAN_LOG_DIR} ]
then
    mkdir ${TITAN_LOG_DIR}
else
    rm -f ${TITAN_LOG_DIR}/*.log
fi

CFG_FILES=`find ../etc -name '*.cfg'`
#LOG_FILES=`find ${TITAN_LOG_DIR} -name '*.log'`
#mv ${LOG_FILES} ../logs

#if [ "${OSTYPE}" == "cygwin" ]
#then
#    # Remove dll
#    rm ./*.dll
#    ## Copy the new ones
#    cp ~/lib/libhelper.dll .
#    cp ~/lib/libconverter.dll .
#    cp ~/lib/liblogger.dll .
#    cp ~/lib/libttcn3_tri.dll .
#    cp ~/lib/libcomm.dll .
#fi

echo "> cmtc: to create the MTC server"
echo "> smtc [module_name[[.control]|.testcase_name|.*]: when MyExample is connected, run the TCs in [EXECUTE] section"
echo "> emtc: Terminate MTC."
mctr ${CFG_FILES}

LOG_FILES=`find ${TITAN_LOG_DIR} -name '*.log'`
if [ "${TITAN_LOG_DIR}" != "" ]
then
    ttcn3_logmerge -o ${TITAN_LOG_DIR}/merged.log ${LOG_FILES}
    ttcn3_logformat -o ${TITAN_LOG_DIR}/merged_formated.log ${TITAN_LOG_DIR}/merged.log
    mv ${TITAN_LOG_DIR}/merged_formated.log ${TITAN_LOG_DIR}/merged.log    
    echo "log files were merged into ${TITAN_LOG_DIR}/merged.log"
fi

cd ${CURPWD}
Loading