Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/test/entrypoint.sh
2486 views
1
#!/bin/sh
2
# Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
# Licensed under the GNU Affero General Public License (AGPL).
4
# See License.AGPL.txt in the project root for license information.
5
6
# exclude 'e' (exit on any error)
7
# there are many test binaries, each can have failures
8
9
test_pattern="*.test"
10
for i in "$@"; do
11
case $i in
12
-testPattern=*|--testPattern=*)
13
test_pattern="${i#*=}"
14
shift
15
;;
16
*)
17
;;
18
esac
19
done
20
21
export PATH="$PATH:/tests"
22
23
FAILURE_COUNT=0
24
# shellcheck disable=SC2045
25
for i in $(find /tests/ -name "$test_pattern" | sort); do
26
echo "running test: $i"
27
"$i" "$@" -test.v;
28
TEST_STATUS=$?
29
if [ "$TEST_STATUS" -ne "0" ]; then
30
FAILURE_COUNT=$((FAILURE_COUNT+1))
31
echo "Test failed at $(date)"
32
else
33
echo "Test succeeded at $(date)"
34
fi;
35
done
36
37
if [ "$FAILURE_COUNT" -ne "0" ]; then
38
# exit with the number of test binaries that failed
39
echo "Test suite ended with failure at $(date)"
40
exit $FAILURE_COUNT
41
fi;
42
43
echo "Test suite ended with success at $(date)"
44
45