File: executeTestSuite.sh

package info (click to toggle)
boinc 8.0.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 106,832 kB
  • sloc: cpp: 167,537; php: 111,699; pascal: 56,262; ansic: 49,284; xml: 18,762; python: 7,938; javascript: 6,538; sh: 5,719; makefile: 2,183; java: 2,041; objc: 1,867; perl: 1,843; sql: 830; lisp: 47; csh: 30
file content (100 lines) | stat: -rwxr-xr-x 2,512 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash

# This file is part of BOINC.
# http://boinc.berkeley.edu
# Copyright (C) 2018 University of California
#
# BOINC is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# BOINC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
#

## support script to install the boinc server docker environment
## test_dir must be outside of the code directory because the code is copied/symlinked
## into the testsuite

# checks if a given path is canonical (absolute and does not contain relative links)
# from http://unix.stackexchange.com/a/256437
isPathCanonical() {
  case "x$1" in
    (x*/..|x*/../*|x../*|x*/.|x*/./*|x./*)
        rc=1
        ;;
    (x/*)
        rc=0
        ;;
    (*)
        rc=1
        ;;
  esac
  return $rc
}

# checks if first argument is a subpath of second argument
isPathSubpath() {
  case $(readlink -f $1)/ in
    $(readlink -f $2)/*)
      rc=0
      ;;
    $(readlink -f $1))
      rc=0
      ;;
    *)
      rc=1
      ;;
  esac
  return $rc
}

# check working directory because the script needs to be called like: ./integration_test/installTestSuite.sh
if [ ! -d "integration_test" ]; then
    echo "start this script in the source root directory"
    exit 1
fi

ROOTDIR=$(pwd)
PREFIX=$(realpath -s $ROOTDIR/../bst)
test_dir=""
while [[ $# -gt 0 ]]; do
    key="$1"
    case $key in
        --test_dir)
        test_dir="$2"
        shift
        ;;
        *)
        echo "unrecognized option $key"
        ;;
    esac
    shift # past argument or value
done

if [ "x$test_dir" != "x" ]; then
    if isPathCanonical "$test_dir" && [ "$test_dir" != "/" ]; then
      if isPathSubpath "$test_dir" "$ROOTDIR"; then
          echo "test_dir must not be a subdirectory of $ROOTDIR"
          exit 1
      else
          PREFIX="$test_dir"
      fi
    else
        echo "test_dir must be an absolute path without ./ or ../ in it"
        exit 1
    fi
fi

cd "${PREFIX}/tests" || exit 1

composer test
if [ $? -ne 0 ]; then exit 1; fi

cd "${ROOTDIR}" || exit 1