-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSimpleRippledTestLoop
More file actions
executable file
·103 lines (94 loc) · 2.13 KB
/
SimpleRippledTestLoop
File metadata and controls
executable file
·103 lines (94 loc) · 2.13 KB
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
101
102
103
#!/bin/bash
# Intended to be run from a rippled working directory.
#
# There is some weirdness with the bash shell (or maybe my individual
# setup) where this won't always work if run as a script, so copy/paste
# or run using `source SimpleRippledTestLoop`.
#
# This script assumes you have hooks set up from
# https://github.com/ximinez/git-scripts,
# particularly post-checkout
#
# See SimpleTestLoop for usage, except you don't need to specify the
# binary_name. Default will run all unittests in parallel
maindir="$(pwd)"
builddir="$(dirname $(pwd))/build/$(basename $(pwd))"
preparams=()
while [[ $# -gt 0 ]]
do
if [[ "$1" == "--clean" ]]
then
rm -rf "${builddir}/cmake" "${builddir}/conan"*
shift
elif [[ "$1" == "--ctest" ]]
then
preparams+=( "--ctest" )
shift
elif [[ "$1" == "--debug" ]]
then
preparams+=( "--debug" )
shift
else
break
fi
done
if [ ! -e "${builddir}/cmake" ]
then
echo -n "Run: git checkout "
date
( time git checkout )
fi
params=()
# Look for directories
while [[ $# -gt 0 ]]
do
if [[ -d "${builddir}/cmake/$1" ]]
then
params+=( "${builddir}/cmake/$1" )
shift
elif [[ -d $1 ]]
then
params+=( "$1" )
shift
else
break
fi
done
# Look for Windows targets
if [[ "${OS}" =~ "Windows" ]]
then
while [[ $# -gt 0 ]]
do
if [[ "$1" == "Debug" || "$1" == "Release" ]]
then
params+=( "$1" )
shift
else
break
fi
done
fi
# If there are any parameters left, they are command-line params for
# rippled.
# If there aren't, run all tests with as many jobs as processors.
if [[ $# -gt 0 ]]
then
for runparam in "$@"
do
if echo "$runparam" | grep -- "--unittest\($\| *\($\| -\)\)"
then
echo Automatically enabling ctest, since all other tests are being run
preparams+=( "--ctest" )
break
fi
done
params+=( "$@" )
else
numProcs=$( nproc )
params+=( "--unittest --unittest-jobs=${numProcs}" )
echo Automatically enabling ctest along with all other tests
preparams+=( "--ctest" )
fi
params=( "${preparams[@]}" "rippled" "${params[@]}" )
$( dirname "${BASH_SOURCE}" )/SimpleTestLoop \
"${params[@]}"