Commit 768ca75d authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Add pipeline for MEC TTCN-3 Test Suite

parents
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+26 −0
Original line number Original line Diff line number Diff line
# CI/CD:
#
# BUILD triggered by:
#  - any (branch commit)
#  
#   

stages:
  - build
    
Build stfubuntu docker image:
  stage: build
  before_script: cd common
  script: docker build --tag etsiforge/stfubuntu:20.04 -f Dockerfile.stfubuntu .
  rules:
    - changes:
        - common/Dockerfile.sftubuntu
              
Build TTCN-3 Test Suite docker image for devel:
  stage: build
  before_script: cd GS32-3
  script: docker build -t etsiforge/mec-ts .
  rules:
    - changes:
        - GS32-3/Dockerfile
 No newline at end of file

GS32-3/.gitlab-ci.yml

0 → 100644
+23 −0
Original line number Original line Diff line number Diff line
# CI/CD:
#
# Runnig tests triggered by:
#  - devel (branch commit) and ENVIRONMENT_ENABLED
#  

workflow:
  rules:
    - if: $CI_COMMIT_BRANCH == "devel"
    
stages:
  - run
        
Running tests:
  stage: run
  before_script:
    - set -vx
  script:
    - echo 'Running tests'
    - docker run --interactive --tty --rm --publish 2222:22 --env DISPLAY=$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --cap-add=NET_RAW --cap-add=NET_ADMIN etsiforge/mec-ts /bin/bash -c "export ATS=AtsMec && cd ~ && . ./devenv.bash && sed --in-place 's/sbxpl1eil4/sbxrsvoat/g' ~/dev/mec_devel/etc/AtsMec/AtsMec.cfg && cd ~/dev/mec_devel/scripts && ./run_all.bash"
  rules:
    - if: $ENVIRONMENT_ENABLED == "True"
 No newline at end of file

GS32-3/Dockerfile

0 → 100644
+49 −0
Original line number Original line Diff line number Diff line
FROM alpine:latest

# Install dependencies
RUN apk update && \
    apk add --no-cache sudo make git g++ diffutils expect openssl-dev libxml2-dev libxml2-utils libxslt-dev libtool ncurses-dev jsoncpp-dev readline-dev flex bison perl libexecinfo-dev bash libedit libedit-dev lksctp-tools lksctp-tools-dev libpcap-dev

# Create user and sudouser
RUN \
    addgroup -g 1000 etsi && \
    adduser -S -D -u 1000 -G etsi -h /home/etsi -s /bin/bash etsi && \
    echo "etsi:etsi" | chpasswd  && \
    echo "etsi ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers || exit 1 
USER etsi

# Setup Hosts file at the boot time
RUN \
    echo 'sudo sh -c "cp /etc/hosts /etc/append && (echo \"127.0.1.1  $HOSTNAME\"; cat /etc/append) > /etc/hosts"' >> /home/etsi/.bashrc \
    echo 'sh' >> /home/etsi/.bashrc || exit 1

# Clone Titan
WORKDIR /home/etsi
RUN mkdir -p frameworks dev tmp && cd frameworks && git clone https://github.com/eclipse/titan.core.git || exit 1
WORKDIR /home/etsi/frameworks/titan.core/

# Setup ENV variables
ENV TTCN3_DIR=/home/etsi/frameworks/titan.core/Install
ENV PATH=$TTCN3_DIR/bin:$PATH \
    LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH

# Set flags
RUN \
    echo "ALPINE_LINUX=yes" > Makefile.personal && \
    echo "TTCN3_DIR=$TTCN3_DIR" >> Makefile.personal && \
    echo "JNI=no" >> Makefile.personal && \
    echo "GUI=no" >> Makefile.personal && \
    echo "DEBUG=no" >> Makefile.personal || exit 1

# Build Titan
RUN \
    sed --in-place 's/LINUX_LIBS     := -lxml2/LINUX_LIBS     := -lxml2 -lpthread/g' ./core/Makefile && \
    make install && make clean || exit 1

WORKDIR /home/etsi/dev

ENV ATS=AtsCise

EXPOSE 30181/tcp

ENTRYPOINT /home/yann/dev/cise/virtualization/docker/docker-entrypoint.sh
+53 −0
Original line number Original line Diff line number Diff line
#!/bin/bash

#set -e
set -vx

echo -e "*****************************\n* Install titan\n*****************************\n"
SRC_DIR=${HOME}/frameworks/titan/titan.core
export TTCN3_DIR=$HOME/frameworks/titan/Install

[ -f /usr/bin/java ] &&  export JAVA_HOME=`readlink -f /usr/bin/java | sed "s:bin/java::"`
TITAN_REPO=`cat ${HOME}/etc/titan_repos.txt | grep 'titan\.core\.git' | head -n 1`
export PATH=$PATH:$TTCN3_DIR/bin

mkdir -p "$SRC_DIR"
cd "$SRC_DIR/.." || exit 1

# Install titan core
git clone --progress "$TITAN_REPO" || exit 1

cd titan.core || exit 1
cat >Makefile.personal <<EOF
TTCN3_DIR=$TTCN3_DIR
JNI=no
GUI=no
DEBUG=no
GEN_PDF=no
JDKDIR=$JAVA_HOME
EOF

# To prevent link error /usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command lineema  
sed --in-place 's/LINUX_LIBS     := -lxml2/LINUX_LIBS     := -lxml2 -lpthread/g' ./core/Makefile

make && make install || exit 1

# To be compiant with build_ttcn3.bash
# TODO Refactor build_ttcn3.bash & devenv.bash
mv ${TTCN3_DIR} ${SRC_DIR}
export TTCN3_DIR=${SRC_DIR}/Install

echo "export TTCN3_DIR=$TTCN3_DIR" >> $HOME/.bashrc
echo "export PATH=\$PATH:\$TTCN3_DIR/bin" >> $HOME/.bashrc

# Install other repos
cd $SRC_DIR/.. || exit 1
cat ${HOME}/etc/titan_repos.txt | grep -v -e '^\s*#' -e 'titan\.core' | while read REPO; do
  [ -z $ $REPO ] && continue
  WS=`echo $REPO | sed -e 's|.*/||g' -e 's|\.git||g'`
  if git clone --progress "${REPO}" "${WS}"; then
    [ -f "$WS/Makefile" ] && make -C "$WS"
  fi
done

cd $HOME
+26 −0
Original line number Original line Diff line number Diff line
#!/bin/bash

ECLIPSE_URL='https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2020-06/R/eclipse-jee-2020-06-R-linux-gtk-x86_64.tar.gz&r=1'
TITAN_URL='https://www.eclipse.org/downloads/download.php?file=/titan/TITAN_Designer_and_Executor_Plugin_7.1.0.zip&r=1'

#set -e
set -vx

echo -e "*****************************\n* Install eclipse\n*****************************\n"

mkdir -p ${HOME}/frameworks
cd ${HOME}/frameworks || exit 1
wget --progress=dot:mega 'http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/2021-12/R/eclipse-cpp-2021-12-R-linux-gtk-x86_64.tar.gz' -Oeclipse-cpp-2021-12-R-linux-gtk-x86_64.tar.gz || exit 1
tar -zxvf ./eclipse-cpp-2021-12-R-linux-gtk-x86_64.tar.gz || exit 1
ln -sf ${HOME}/frameworks/eclipse/eclipse ${HOME}/bin/eclipse
rm -f ./eclipse-cpp-2021-12-R-linux-gtk-x86_64.tar.gz

if wget --progress=dot:mega 'https://www.eclipse.org/downloads/download.php?file=/titan/TITAN_Designer_and_Executor_plugin-8.1.0.zip' -OTITAN_Designer_and_Executor_plugin.zip; then
  eclipse/eclipse -noSplash -application org.eclipse.equinox.p2.director \
    -destination /home/etsi/frameworks/eclipse \
    -repository 'jar:file:///home/etsi/frameworks/TITAN_Designer_and_Executor_plugin.zip!/' \
    -installIU TITAN_Designer.feature.group,TITAN_Executor.feature.group,TITAN_Log_Viewer.feature.group,Titan_external_dependencies.feature.group,Titanium.feature.group,Titanium_external_dependencies.feature.group
  rm -f TITAN_Designer_and_Executor_plugin.zip
fi

cd ${HOME}