From 57d7587d9a14b437dce369b380f5ccde96929219 Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Thu, 23 Jul 2020 17:23:08 +0000 Subject: [PATCH] vagrant, docker and remote test small changes --- docker/main/Makefile.in | 2 +- test/cicd/Makefile.in | 7 ++++++- test/vagrant/Makefile.in | 5 +++++ test/vagrant/vagrant.sh | 29 ++++++++++++++++++++++++----- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/docker/main/Makefile.in b/docker/main/Makefile.in index b10050f8..b9c2a45f 100644 --- a/docker/main/Makefile.in +++ b/docker/main/Makefile.in @@ -75,7 +75,7 @@ push: # Note tests will kill the daemons started in the start scrips test: docker ./cleanup.sh ; PORT=8080 ./start.sh # kill (ignore error) and the start it - sudo docker exec -it clixon-system bash -c 'cd /usr/local/bin/test && ./all.sh' + sudo docker exec -t clixon-system bash -c 'cd /usr/local/bin/test && ./all.sh' depend: diff --git a/test/cicd/Makefile.in b/test/cicd/Makefile.in index 16a63d1a..251390f6 100644 --- a/test/cicd/Makefile.in +++ b/test/cicd/Makefile.in @@ -40,6 +40,7 @@ SHELL = /bin/sh .PHONY: all clean distclean depend install uninstall +# Optional specific LOGDIR, eg "LOGDIR=/var/log make" # Include "site.mk" file if it exists and define the HOSTS variables # eg : @@ -54,7 +55,11 @@ all: $(HOSTS) # Real hosts reachable by ssh $(HOSTS): - ./cicd.sh $@ 2>&1 | tee $@.log +ifdef LOGDIR + ./cicd.sh $@ 2>&1 > $(LOGDIR)/$@.log +else + ./cicd.sh $@ 2>&1 | tee /$@.log +endif clean: rm -f *.log diff --git a/test/vagrant/Makefile.in b/test/vagrant/Makefile.in index bcee54ee..a4bc11a5 100644 --- a/test/vagrant/Makefile.in +++ b/test/vagrant/Makefile.in @@ -40,6 +40,7 @@ SHELL = /bin/sh .PHONY: all clean distclean depend install uninstall +# Optional specific LOGDIR, eg "LOGDIR=/var/log make" # The "site.mk" file if it exists and define the VAGRANTS variables # eg: @@ -59,7 +60,11 @@ logs: # Local vagrant hosts eg generic/centos8. The vagrantdir is a subdirectory and logs will # appear eg as generic/centos8.log $(VAGRANTS): logs +ifdef LOGDIR + ./vagrant.sh $@ 2>&1 > "$(LOGDIR)/$(subst /,-,$@).log" +else ./vagrant.sh $@ 2>&1 | tee "logs/$(subst /,-,$@).log" +endif destroy: for i in $(VAGRANTS) ; \ diff --git a/test/vagrant/vagrant.sh b/test/vagrant/vagrant.sh index a9d18196..1df31a36 100755 --- a/test/vagrant/vagrant.sh +++ b/test/vagrant/vagrant.sh @@ -96,6 +96,7 @@ system=$($sshcmd uname) # we use the release "hack" instead # Some release have packages, some need to be built from source buildfcgi=false buildevhtp=false +buildcmake=false # Some releases (eg centos/7) has too old cmake to build libevhtp case $release in openbsd) # packages for building @@ -154,7 +155,8 @@ case $release in evhtp) $sshcmd sudo yum install -y libevent openssl buildevhtp=true - $sshcmd sudo yum install -y libevent-devel cmake openssl-devel + buildcmake=true # Actually, only necessary on centos/7 + $sshcmd sudo yum install -y libevent-devel openssl-devel ;; esac ;; @@ -249,11 +251,28 @@ case ${with_restconf} in . ./nginx.sh $dir $idfile $port $wwwuser ;; evhtp) + if $buildcmake; then + $sshcmd "test -d cmake || sudo git clone https://gitlab.kitware.com/cmake/cmake.git" + $sshcmd "(cd cmake; sudo ./bootstrap)" + $sshcmd "(cd cmake; sudo make)" + $sshcmd "(cd cmake; sudo make install)" + fi if $buildevhtp; then - $sshcmd "test -d libevhtp || sudo git clone https://github.com/criticalstack/libevhtp.git" - $sshcmd "(cd libevhtp/build; sudo cmake -DEVHTP_DISABLE_REGEX=ON -DEVHTP_DISABLE_EVTHR=ON ..)" - $sshcmd "(cd libevhtp/build; sudo make)" - $sshcmd "(cd libevhtp/build; sudo make install)" + if true; then + $sshcmd << 'EOF' + test -d libevhtp || sudo git clone https://github.com/criticalstack/libevhtp.git + cd libevhtp/build; + CMAKE=$(which cmake) + sudo $CMAKE -DEVHTP_DISABLE_REGEX=ON -DEVHTP_DISABLE_EVTHR=ON .. + sudo make + sudo make install +EOF + else + $sshcmd "test -d libevhtp || sudo git clone https://github.com/criticalstack/libevhtp.git" + $sshcmd "(cd libevhtp/build; sudo /usr/local/bin/cmake -DEVHTP_DISABLE_REGEX=ON -DEVHTP_DISABLE_EVTHR=ON ..)" + $sshcmd "(cd libevhtp/build; sudo make)" + $sshcmd "(cd libevhtp/build; sudo make install)" + fi fi ;; esac