aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Kozemcak <andrej.kozemcak@pantheon.tech>2019-05-31 13:37:35 +0200
committerHongjun Ni <hongjun.ni@intel.com>2019-06-13 02:24:17 +0000
commitd728297d6747c6a0ee07c8420ef3803616dc49dd (patch)
tree45e1e7d8d244bf5813de3928a1a5ffb1945d0d05
parentc7837f0e5956e751c43f909436a6365386ffb472 (diff)
[TEST] - install test dependencies
Change-Id: Ic3a414573030d3b1fe8f34ff787428ed5449eeaf Signed-off-by: Andrej Kozemcak <andrej.kozemcak@pantheon.tech>
-rw-r--r--Makefile39
-rw-r--r--scripts/Test.Dockerfile22
2 files changed, 43 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index d3801f7..b3c3a3e 100644
--- a/Makefile
+++ b/Makefile
@@ -68,6 +68,10 @@ DEB_DEPENDS = ${BUILD_DEB} ${NETOPEER2_DEB} ${CHECKSTYLE_DEB} ${SCVPP_DEB} ${SYS
#Dependencies for grpc
DEB_GNMI_DEPENDS = libpugixml-dev libjsoncpp-dev libtool pkg-config
+#Dependencies for automatic test
+DEB_TEST_DEPENDS = python3-pip python-pip libcurl4-openssl-dev libssh-dev \
+libxml2-dev libxslt1-dev libtool-bin
+
#####
#RPM#
#####
@@ -88,6 +92,10 @@ RPM_DEPENDS = ${BUILD_RPM} ${NETOPEER2_RPM} ${CHECKSTYLE_RPM} ${SCVPP_RPM} \
#Dependencies for grpc
RPM_GNMI_DEPENDS = pugixml jsoncpp libtool pugixml-devel jsoncpp-devel ${GRPC_RPM}
+#Dependencies for automatic test
+RPM_TEST_DEPENDS = python36-devel python36-pip python-pip libxml2-devel \
+libxslt-devel libtool which cmake3
+
.PHONY: help install-dep install-dep-extra install-vpp install-models uninstall-models \
install-dep-gnmi-extra build-scvpp build-plugins build-gnmi build-package docker \
docker-test test clean distclean _clean_dl _libssh _libyang _libnetconf2 _sysrepo _netopeer2
@@ -100,6 +108,7 @@ help:
@echo " install-models - install YANG models"
@echo " uninstall-models - uninstall YANG models"
@echo " install-dep-gnmi-extra - install software extra dependencips from source code for gNMI"
+ @echo " install-test-extra - install software extra dependencies from source code for YDK"
@echo " build-scvpp - build scvpp"
@echo " test-scvpp - unit test for scvpp"
@echo " build-plugins - build plugins"
@@ -195,6 +204,33 @@ _netopeer2:
&&make -j$(nproc) && make install && sudo ldconfig\
&&cd ../../../ && mv v0.7-r1.tar.gz Netopeer2-0.7-r1.tar.gz\
+_test_python:
+ifeq ($(filter ubuntu debian,$(OS_ID)),$(OS_ID))
+ @sudo -E apt-get $(APT_ARGS) -y --force-yes install $(DEB_TEST_DEPENDS)
+else ifeq ($(OS_ID),centos)
+# compiler return me this error and I don't know hot to fix it, yet
+# Found Doxygen: /usr/bin/doxygen (found version "1.8.5") found components: doxygen dot
+# CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
+#
+# @sudo -E yum install -y epel-release
+# @sudo -E yum install -y $(RPM_TEST_DEPENDS)
+else
+ $(error "This option currently works only on Ubuntu, Debian systems")
+endif
+ @pip3 install pexpect pyroute2 psutil
+
+_ydk:
+ @mkdir -p $(BR)/downloads/&&cd $(BR)/downloads/\
+ &&wget https://github.com/CiscoDevNet/ydk-gen/archive/0.8.3.tar.gz\
+ &&tar xvf 0.8.3.tar.gz && cd ydk-gen-0.8.3 && pip install -r requirements.txt\
+ &&./generate.py --libydk -i && ./generate.py --python --core\
+ &&pip3 install gen-api/python/ydk/dist/ydk*.tar.gz\
+ &&./generate.py --python --bundle profiles/bundles/ietf_0_1_5.json\
+ &&./generate.py --python --bundle profiles/bundles/openconfig_0_1_5.json\
+ &&pip3 install gen-api/python/ietf-bundle/dist/ydk*.tar.gz\
+ &&pip3 install gen-api/python/openconfig-bundle/dist/ydk*.tar.gz\
+ &&cd ../\
+
_clean_dl:
@rm -rf $(BR)/downloads
@@ -233,6 +269,9 @@ ifeq ($(OS_ID),centos)
endif
endif
+install-test-extra: _test_python _ydk
+ @cd ../ && rm -rf $(BR)/downloads
+
build-scvpp:
@mkdir -p $(BR)/build-scvpp/; cd $(BR)/build-scvpp; \
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=/usr $(WS_ROOT)/src/scvpp/;\
diff --git a/scripts/Test.Dockerfile b/scripts/Test.Dockerfile
index 025fa9d..04a77a6 100644
--- a/scripts/Test.Dockerfile
+++ b/scripts/Test.Dockerfile
@@ -1,22 +1,8 @@
FROM sweetcomb_img:latest
-#Install utils for testing
-RUN apt-get update; \
- apt-get install -y vim clang-format python3-pip python-pip; \
- apt-get install -y gdebi-core python3-dev python-dev libtool-bin; \
- apt-get install -y libcurl4-openssl-dev libpcre3-dev libssh-dev libxml2-dev libxslt1-dev cmake python-git; \
- pip3 install pexpect pyroute2 psutil;
+# Install test dependence
-WORKDIR /root/src
+COPY . /root/src/sweetcomb
+WORKDIR /root/src/sweetcomb
-RUN git clone https://github.com/CiscoDevNet/ydk-gen.git
-
-WORKDIR /root/src/ydk-gen
-
-RUN pip install -r requirements.txt && \
- ./generate.py --libydk -i && ./generate.py --python --core && \
- pip3 install gen-api/python/ydk/dist/ydk*.tar.gz && \
- ./generate.py --python --bundle profiles/bundles/ietf_0_1_5.json && \
- ./generate.py --python --bundle profiles/bundles/openconfig_0_1_5.json && \
- pip3 install gen-api/python/ietf-bundle/dist/ydk*.tar.gz && \
- pip3 install gen-api/python/openconfig-bundle/dist/ydk*.tar.gz
+RUN make install-test-extra