forked from apptainer/singularity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh.in
executable file
·97 lines (82 loc) · 2.88 KB
/
test.sh.in
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
#!/bin/bash
#
# Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
#
# Copyright (c) 2015-2017, Gregory M. Kurtzer. All rights reserved.
#
# Copyright (c) 2016, The Regents of the University of California, through
# Lawrence Berkeley National Laboratory (subject to receipt of any required
# approvals from the U.S. Dept. of Energy). All rights reserved.
#
# This software is licensed under a customized 3-clause BSD license. Please
# consult LICENSE file distributed with the sources of this project regarding
# your rights to use or distribute this software.
#
# NOTICE. This Software was developed under funding from the U.S. Department of
# Energy and the U.S. Government consequently retains certain rights. As such,
# the U.S. Government has been granted for itself and others acting on its
# behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software
# to reproduce, distribute copies to the public, prepare derivative works, and
# perform publicly and display publicly, and to permit other to do so.
#
#
prefix="@prefix@"
exec_prefix="@exec_prefix@"
libexecdir="@libexecdir@"
sysconfdir="@sysconfdir@"
localstatedir="@localstatedir@"
bindir="@bindir@"
SINGULARITY_OVERLAY_FS="@OVERLAY_FS@"
SINGULARITY_USER_NS="@USER_NS@"
SINGULARITY_libexecdir="$libexecdir"
SINGULARITY_sysconfdir="$sysconfdir"
SINGULARITY_localstatedir="$localstatedir"
SINGULARITY_PATH="$bindir"
export SINGULARITY_libexecdir SINGULARITY_sysconfdir SINGULARITY_localstatedir SINGULARITY_PATH SINGULARITY_OVERLAY_FS SINGULARITY_USER_NS
if [ -z "$CLEAN_SHELL" ]; then
/bin/echo "Building/Installing Singularity to temporary directory"
/bin/echo "Reinvoking in a clean shell"
sleep 1
exec env -i CLEAN_SHELL=1 PATH="$SINGULARITY_PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" bash "$0" "$@"
fi
if [ ! -d "tests" ]; then
/bin/echo "ERROR: Run this from the singularity source root"
exit 1
fi
if [ ! -x "$SINGULARITY_PATH/singularity" ]; then
/bin/echo "ERROR: Could not locate singularity program at: $SINGULARITY_PATH/singularity"
exit 1
fi
if [ ! -d "./tests/" ]; then
/bin/echo "ERROR: Could not locate singularity test directory"
exit 1
fi
if ! cd tests; then
/bin/echo "ERROR: Could not change into the Singularity test directory"
exit 1
fi
if [ -n "$1" ]; then
for i in $@; do
test=`basename "$i"`
if [ -f "$test" ]; then
if ! /bin/sh "$test"; then
/bin/echo "ERROR: Failed running test: $test"
exit 1
fi
else
echo "ERROR: Could not find test: '$test'"
exit 1
fi
done
else
for test in *.sh; do
if [ -f "$test" ]; then
if ! /bin/sh "$test"; then
/bin/echo "ERROR: Failed running test: $test"
exit 1
fi
fi
done
fi
echo
echo "All tests passed"