From: gcalvino Date: Fri, 24 Nov 2017 12:48:51 +0000 (+0100) Subject: Make option for test functionality added to tool to upgrade vnf,ns descriptors to... X-Git-Tag: v3.0.3~8^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F5732%2F1;p=osm%2Fdevops.git Make option for test functionality added to tool to upgrade vnf,ns descriptors to R. THREE Signed-off-by: gcalvino --- diff --git a/descriptor-packages/mk/dirs.mk b/descriptor-packages/mk/dirs.mk index 85a05e52..b3df4056 100644 --- a/descriptor-packages/mk/dirs.mk +++ b/descriptor-packages/mk/dirs.mk @@ -14,6 +14,9 @@ # limitations under the License. # +TOPDIR=$(shell readlink -f .|sed -e 's/\/descriptor-packages\/.*//') +TOOLS_DIR := $(TOPDIR)/tools + SUBDIRS_CLEAN = $(addsuffix .clean, $(SUBDIRS)) .PHONY: $(SUBDIRS) $(SUBDIRS_CLEAN) clean @@ -27,3 +30,6 @@ $(SUBDIRS_CLEAN): %.clean: $(SUBDIRS): @$(MAKE) --no-print-directory -C $@ + +test: + $(TOOLS_DIR)/launch_tests.sh diff --git a/descriptor-packages/tools/launch_tests.sh b/descriptor-packages/tools/launch_tests.sh new file mode 100755 index 00000000..066e35c1 --- /dev/null +++ b/descriptor-packages/tools/launch_tests.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +function test_format +{ + folder=$(dir -1) + + for file in $folder; + do + if [ -n $file ]; then + if [ -d "$file" ]; then + + cd $file + test_format + cd .. + else + extension=${file##*.} + name=${file%.*} + folder_file=`pwd` + if [ $extension == "yaml" ]; then + $tools_dir/upgrade_descriptor_version.py --test -i $folder_file"/"$name.$extension -o $folder_file"/"$name."output" 2> $folder_file"/"$name."error" + [ -s $folder_file"/"$name."output" ] || rm $folder_file"/"$name."output" + [ -s $folder_file"/"$name."error" ] || rm $folder_file"/"$name."error" + fi; + fi; + fi; + done; +} + + +top_dir=`readlink -f .|sed -e 's/\/descriptor-packages\/.*//'` +tools_dir=${top_dir}/tools + +if [ -f $tools_dir/upgrade_descriptor_version.py ]; then + cd ${top_dir}/ + test_format ./ +else + print "Error: 'make' command should be called inside '/devops/descriptor-packages/' folder to work" + exit -1 +fi;