diff --git a/.ci/filter_docker_aarch64.sh b/.ci/filter_docker_aarch64.sh new file mode 100755 index 0000000000..7192a69cbe --- /dev/null +++ b/.ci/filter_docker_aarch64.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Copyright (c) 2018 ARM Limited +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +GOPATH_LOCAL="${GOPATH%%:*}" +kata_dir="${GOPATH_LOCAL}/src/github.com/kata-containers" +test_dir="${kata_dir}/tests" +ci_dir="${test_dir}/.ci" +test_config_file="${ci_dir}/configuration_aarch64.yaml" + +describe_filter_flag="docker.Describe" +context_filter_flag="docker.Context" +it_filter_flag="docker.It" + +# value for '-focus' in ginkgo +_focus_options=() + +filter_and_build() +{ + dependency="$1" + array_docker=$("${GOPATH_LOCAL}/bin/yq" read "${test_config_file}" "${dependency}") + [ "${array_docker}" = "null" ] && array_docker="" && return + mapfile -t _array_docker <<< "${array_docker}" + for entry in "${_array_docker[@]}" + do + _focus_options+=("${entry#- }|") + done +} + +main() +{ + # build focus option based on Describe block + filter_and_build "${describe_filter_flag}" + + # build focus option based on context block + filter_and_build "${context_filter_flag}" + + # build focus option based on it block + filter_and_build "${it_filter_flag}" + + focus_options=$(IFS= ; echo "${_focus_options[*]}") + + echo "${focus_options%|}" + +} + +main diff --git a/.ci/filter_test_aarch64.sh b/.ci/filter_test_aarch64.sh new file mode 100755 index 0000000000..0a47277f93 --- /dev/null +++ b/.ci/filter_test_aarch64.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (c) 2018 ARM Limited +# +# SPDX-License-Identifier: Apache-2.0 + +set -e + +GOPATH_LOCAL="${GOPATH%%:*}" +kata_dir="${GOPATH_LOCAL}/src/github.com/kata-containers" +test_dir="${kata_dir}/tests" +ci_dir="${test_dir}/.ci" +test_config_file="${ci_dir}/configuration_aarch64.yaml" + +test_filter_flag="test" + +_test_union=() + +main() +{ + array_test=$("${GOPATH_LOCAL}/bin/yq" read "${test_config_file}" "${test_filter_flag}") + [ "${array_test}" = "null" ] && array_test="" && return + mapfile -t _array_test <<< "${array_test}" + for entry in "${_array_test[@]}" + do + _test_union+=("${entry#- }") + done + test_union=$(IFS=" "; echo "${_test_union[*]}") + echo "${test_union}" +} + +main diff --git a/Makefile b/Makefile index 17227f1c9d..2c00df4afe 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,14 @@ # SPDX-License-Identifier: Apache-2.0 # -# The time limit in seconds for each test -TIMEOUT ?= 60 +# get arch +ARCH := $(shell bash -c arch) + +ARCH_FILE_SUFFIX = -options.mk +ARCH_FILE = $(ARCH)$(ARCH_FILE_SUFFIX) + +# Load architecture-dependent settings +include $(ARCH_FILE) default: checkcommits @@ -24,7 +30,7 @@ else ./ginkgo -v functional/ -- -runtime=${RUNTIME} -timeout=${TIMEOUT} endif -integration: ginkgo +docker: ginkgo ifeq ($(RUNTIME),) $(error RUNTIME is not set) else @@ -60,7 +66,7 @@ openshift: bash -f .ci/install_bats.sh bash -f integration/openshift/run_openshift_tests.sh -test: functional integration crio docker-compose openshift kubernetes swarm cri-containerd +test: ${UNION} check: checkcommits log-parser diff --git a/aarch64-options.mk b/aarch64-options.mk new file mode 100755 index 0000000000..5c85e498c2 --- /dev/null +++ b/aarch64-options.mk @@ -0,0 +1,13 @@ +# +# Copyright (c) 2018 ARM Limited +# +# SPDX-License-Identifier: Apache-2.0 + +# The time limit in seconds for each test +TIMEOUT := 120 + +# union for 'make test' +UNION := $(shell bash -f .ci/filter_test_aarch64.sh) + +# value of '-focus' in ginkgo command for docker integration tests +FOCUS := $(shell bash -f .ci/filter_docker_aarch64.sh) diff --git a/x86_64-options.mk b/x86_64-options.mk new file mode 100644 index 0000000000..60081c299c --- /dev/null +++ b/x86_64-options.mk @@ -0,0 +1,15 @@ +# +# Copyright (c) 2017-2018 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 +# + +# The time limit in seconds for each test +TIMEOUT := 60 + +# union for 'make test' +UNION := 'functional docker crio docker-compose openshift kubernetes swarm cri-containerd' + +# value of '-focus' in ginkgo command for docker integration tests +FOCUS := +