From c538340e3bea815f8938d5ada17f26f8747fc97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 5 Apr 2023 20:46:37 +0200 Subject: [PATCH] Finally, eliminate hack/make.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only thing hack/make.sh is now really doing is the warning + sleep without SKOPEO_CONTAINER_TESTS . So, make that a separate script, and eliminate the hack/make directory. Signed-off-by: Miloslav Trmač --- Makefile | 6 +- hack/make.sh | 67 ----------------------- hack/make/test-integration | 7 --- hack/test-integration.sh | 8 +++ hack/{make/test-system => test-system.sh} | 0 hack/warn-destructive-tests.sh | 17 ++++++ 6 files changed, 29 insertions(+), 76 deletions(-) delete mode 100755 hack/make.sh delete mode 100755 hack/make/test-integration create mode 100755 hack/test-integration.sh rename hack/{make/test-system => test-system.sh} (100%) create mode 100755 hack/warn-destructive-tests.sh diff --git a/Makefile b/Makefile index 4d0b09bd..79687d0f 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,8 @@ test-integration: # Intended for CI, assumed to be running in quay.io/libpod/skopeo_cidev container. test-integration-local: bin/skopeo - hack/make.sh test-integration + hack/warn-destructive-tests.sh + hack/test-integration.sh # complicated set of options needed to run podman-in-podman test-system: @@ -209,7 +210,8 @@ test-system: # Intended for CI, assumed to already be running in quay.io/libpod/skopeo_cidev container. test-system-local: bin/skopeo - hack/make.sh test-system + hack/warn-destructive-tests.sh + hack/test-system.sh test-unit: # Just call (make test unit-local) here instead of worrying about environment differences diff --git a/hack/make.sh b/hack/make.sh deleted file mode 100755 index 7046810b..00000000 --- a/hack/make.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash -set -e - -# This script builds various binary from a checkout of the skopeo -# source code. DO NOT CALL THIS SCRIPT DIRECTLY. -# -# Requirements: -# - The current directory should be a checkout of the skopeo source code -# (https://github.com/containers/skopeo). Whatever version is checked out -# will be built. -# - The script is intended to be run inside the container specified -# in the output of hack/get_fqin.sh -# - The right way to call this script is to invoke "make" from -# your checkout of the skopeo repository. -# the Makefile will do a "docker build -t skopeo ." and then -# "docker run hack/make.sh" in the resulting image. -# - -set -o pipefail - -export SKOPEO_PKG='github.com/containers/skopeo' -export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Set this to 1 to enable installation/modification of environment/services -export SKOPEO_CONTAINER_TESTS=${SKOPEO_CONTAINER_TESTS:-0} - -if [[ "$SKOPEO_CONTAINER_TESTS" == "0" ]] && [[ "$CI" != "true" ]]; then - ( - echo "***************************************************************" - echo "WARNING: Executing tests directly on the local development" - echo " host is highly discouraged. Many important items" - echo " will be skipped. For manual execution, please utilize" - echo " the Makefile targets WITHOUT the '-local' suffix." - echo "***************************************************************" - ) > /dev/stderr - sleep 5 -fi - -echo - -go_test_dir() { - dir=$1 - ( - echo '+ go test' $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} "${SKOPEO_PKG}${dir#.}" - cd "$dir" - go test $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} - ) -} - -bundle() { - local bundle="$1"; shift - echo "---> Making bundle: $(basename "$bundle")" - source "$SCRIPTDIR/make/$bundle" "$@" -} - -main() { - if [ $# -lt 1 ]; then - echo 'At least one "bundle" argument expected' >&2 - return 1 - fi - for bundle in $@; do - bundle "$bundle" - echo - done -} - -main "$@" diff --git a/hack/make/test-integration b/hack/make/test-integration deleted file mode 100755 index a9c69b98..00000000 --- a/hack/make/test-integration +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -set -e - -( - make PREFIX=/usr install - go_test_dir ./integration -) 2>&1 diff --git a/hack/test-integration.sh b/hack/test-integration.sh new file mode 100755 index 00000000..63dc2485 --- /dev/null +++ b/hack/test-integration.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +make PREFIX=/usr install + +echo "cd ./integration;" go test $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} +cd ./integration +go test $TESTFLAGS ${BUILDTAGS:+-tags "$BUILDTAGS"} \ No newline at end of file diff --git a/hack/make/test-system b/hack/test-system.sh similarity index 100% rename from hack/make/test-system rename to hack/test-system.sh diff --git a/hack/warn-destructive-tests.sh b/hack/warn-destructive-tests.sh new file mode 100755 index 00000000..4e87a091 --- /dev/null +++ b/hack/warn-destructive-tests.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e + +# Set this to 1 to enable installation/modification of environment/services +export SKOPEO_CONTAINER_TESTS=${SKOPEO_CONTAINER_TESTS:-0} + +if [[ "$SKOPEO_CONTAINER_TESTS" == "0" ]] && [[ "$CI" != "true" ]]; then + ( + echo "***************************************************************" + echo "WARNING: Executing tests directly on the local development" + echo " host is highly discouraged. Many important items" + echo " will be skipped. For manual execution, please utilize" + echo " the Makefile targets WITHOUT the '-local' suffix." + echo "***************************************************************" + ) > /dev/stderr + sleep 5 +fi