forked from googleapis/google-cloud-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runintegrationtests.sh
executable file
·63 lines (53 loc) · 1.52 KB
/
runintegrationtests.sh
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
#!/bin/bash
# Assumption: everything has been built already, and if you're asking for
# coverage, you've already installed the relevant package.
set -e
source toolversions.sh
RETRY_ARG=
COVERAGE_ARG=
for arg in "$@"
do
case $arg in
--retry)
RETRY_ARG=yes
;;
--coverage)
install_dotcover
COVERAGE_ARG=yes
;;
*)
echo "Unknown argument: $arg. Supported arguments: --coverage --retry"
exit 1
;;
esac
done
# We only overwrite integration-test-failures.txt at the very end,
# so that if we abort tests early, we don't assume there's nothing to retry.
FAILURE_FILE=$(realpath integration-test-failures.txt)
FAILURE_TEMP_FILE=${FAILURE_FILE}.tmp
rm -f $FAILURE_TEMP_FILE
touch $FAILURE_TEMP_FILE
cd apis
if [[ "$RETRY_ARG" == "yes" ]]
then
declare -r testdirs=$(cat $FAILURE_FILE)
else
declare -r testdirs=$(echo */*.IntegrationTests */*.Snippets)
fi
for testdir in $testdirs
do
if [[ "$testdir" =~ Metadata ]]
then
echo "Skipping $testdir; test not supported yet."
elif [[ "$COVERAGE_ARG" == "yes" && -f "$testdir/coverage.xml" ]]
then
(cd $testdir; $DOTCOVER cover "coverage.xml" /ReturnTargetExitCode || echo "$testdir" >> $FAILURE_TEMP_FILE)
else
# For a non-coverage run, just run dotnet with the same arugments that we would have run
# for coverage.
(cd $testdir;
dotnetargs=$(grep TargetArguments coverage.xml | sed -E 's/<\/?TargetArguments>//g');
dotnet $dotnetargs || echo "$testdir" >> $FAILURE_TEMP_FILE)
fi
done
mv -f $FAILURE_TEMP_FILE $FAILURE_FILE