|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# installation-scripts.sh |
| 4 | +# |
| 5 | +# -- This script tests the bash scripts that install OpenCoarrays and its prerequisites. |
| 6 | +# |
| 7 | +# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License: |
| 8 | +# Copyright (c) 2015-2016, Sourcery, Inc. |
| 9 | +# Copyright (c) 2015-2016, Sourcery Institute |
| 10 | +# All rights reserved. |
| 11 | +# |
| 12 | +# Redistribution and use in source and binary forms, with or without modification, |
| 13 | +# are permitted provided that the following conditions are met: |
| 14 | +# |
| 15 | +# 1. Redistributions of source code must retain the above copyright notice, this |
| 16 | +# list of conditions and the following disclaimer. |
| 17 | +# 2. Redistributions in binary form must reproduce the above copyright notice, this |
| 18 | +# list of conditions and the following disclaimer in the documentation and/or |
| 19 | +# other materials provided with the distribution. |
| 20 | +# 3. Neither the names of the copyright holders nor the names of their contributors |
| 21 | +# may be used to endorse or promote products derived from this software without |
| 22 | +# specific prior written permission. |
| 23 | +# |
| 24 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 25 | +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 26 | +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 27 | +# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 28 | +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 29 | +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 30 | +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 31 | +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 32 | +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 33 | +# POSSIBILITY OF SUCH DAMAGE. |
| 34 | +# |
| 35 | +# Portions of this script derive from BASH3 Boilerplate and are distributed under |
| 36 | +# the following license: |
| 37 | +# |
| 38 | +# The MIT License (MIT) |
| 39 | +# |
| 40 | +# Copyright (c) 2014 Kevin van Zonneveld |
| 41 | +# |
| 42 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 43 | +# of this software and associated documentation files (the "Software"), to deal |
| 44 | +# in the Software without restriction, including without limitation the rights |
| 45 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 46 | +# copies of the Software, and to permit persons to whom the Software is |
| 47 | +# furnished to do so, subject to the following conditions: |
| 48 | +# |
| 49 | +# The above copyright notice and this permission notice shall be included in all |
| 50 | +# copies or substantial portions of the Software. |
| 51 | +# |
| 52 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 53 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 54 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 55 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 56 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 57 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 58 | +# SOFTWARE. |
| 59 | +# |
| 60 | +# |
| 61 | +# - https://github.com/kvz/bash3boilerplate |
| 62 | +# - http://kvz.io/blog/2013/02/26/introducing-bash3boilerplate/ |
| 63 | +# |
| 64 | +# Version: 2.0.0 |
| 65 | +# |
| 66 | +# Authors: |
| 67 | +# |
| 68 | +# - Kevin van Zonneveld (http://kvz.io) |
| 69 | +# - Izaak Beekman (https://izaakbeekman.com/) |
| 70 | +# - Alexander Rathai ([email protected]) |
| 71 | +# - Dr. Damian Rouson (http://www.sourceryinstitute.org/) (documentation) |
| 72 | +# |
| 73 | +# Licensed under MIT |
| 74 | +# Copyright (c) 2013 Kevin van Zonneveld (http://kvz.io) |
| 75 | + |
| 76 | +# The invocation of bootstrap.sh below performs the following tasks: |
| 77 | +# (1) Import several bash3boilerplate helper functions & default settings. |
| 78 | +# (2) Set several variables describing the current file and its usage page. |
| 79 | +# (3) Parse the usage information (default usage file name: current file's name with -usage appended). |
| 80 | +# (4) Parse the command line using the usage information. |
| 81 | + |
| 82 | +### Start of boilerplate -- do not edit this block ####################### |
| 83 | +export OPENCOARRAYS_SRC_DIR="${OPENCOARRAYS_SRC_DIR:-${PWD%/}/../../..}" |
| 84 | +if [[ ! -f "${OPENCOARRAYS_SRC_DIR}/src/libcaf.h" ]]; then |
| 85 | + echo "Please run this script inside the OpenCoarrays source sudirectory src/tests/instsallation" |
| 86 | + echo "or set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path." |
| 87 | + exit 1 |
| 88 | +fi |
| 89 | +export B3B_USE_CASE="${B3B_USE_CASE:-${OPENCOARRAYS_SRC_DIR}/prerequisites/use-case}" |
| 90 | +if [[ ! -f "${B3B_USE_CASE:-}/bootstrap.sh" ]]; then |
| 91 | + echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path." |
| 92 | + exit 2 |
| 93 | +else |
| 94 | + # shellcheck source=../../../prerequisites/use-case/bootstrap.sh |
| 95 | + source "${B3B_USE_CASE}/bootstrap.sh" "$@" |
| 96 | +fi |
| 97 | +### End of boilerplate -- start user edits below ######################### |
| 98 | + |
| 99 | +# Set expected value of present flags that take no arguments |
| 100 | +export __flag_present=1 |
| 101 | + |
| 102 | +# Set up a function to call when receiving an EXIT signal to do some cleanup. Remove if |
| 103 | +# not needed. Other signals can be trapped too, like SIGINT and SIGTERM. |
| 104 | +function cleanup_before_exit () { |
| 105 | + info "Cleaning up. Done" |
| 106 | +} |
| 107 | +trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, SIGTERM etc. |
| 108 | + |
| 109 | + |
| 110 | +pushd "${OPENCOARRAYS_SRC_DIR}"/src/tests/installation |
| 111 | + |
| 112 | +# shellcheck source=../../../prerequisites/stack.sh |
| 113 | +source "${OPENCOARRAYS_SRC_DIR}"/prerequisites/stack.sh |
| 114 | +source test-stack.sh |
| 115 | +test_stack |
| 116 | + |
| 117 | +popd |
0 commit comments