forked from Unidata/thredds-test-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync_test_data.sh
61 lines (52 loc) · 1.96 KB
/
sync_test_data.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
#!/bin/bash
LOCAL_COPY_DIR="local"
INSTRUCTIONS_URL="https://github.com/Unidata/thredds-test-data"
RSYNC_SERVER="rsync://sync.unidata.ucar.edu/thredds-test-data/"
#
# Get directory this script
# Taken from https://gist.github.com/TheMengzor/968e5ea87e99d9c41782
#
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
###
TOP_LEVEL_DATA_DIR="${DIR}/${LOCAL_COPY_DIR}"
FULL_TEST_DATA_PATH="${TOP_LEVEL_DATA_DIR}/thredds-test-data"
echo ""
if [ ! -d ${LOCAL_COPY_DIR} ];
then
BANNER="###################################################"
HASHCHAR="#"
for (( i=0; i<${#LOCAL_COPY_DIR}; i++ )); do
BANNER=${BANNER}$HASHCHAR
done
echo "$BANNER"
echo "# Starting initial sync of THREDDS test data to $LOCAL_COPY_DIR/ #"
echo "$BANNER"
else
echo "###############################################"
echo "# Syncing local copy of the THREDDS test data #"
echo "###############################################"
fi
rsync --archive --verbose --delete $RSYNC_SERVER $LOCAL_COPY_DIR
echo ""
echo "#############"
echo "# Finished! #"
echo "#############"
echo ""
echo "To ensure the netcdf-java or TDS tests know where the test data live, do one of the following:"
echo "1. Set the location in ~/.gradle/gradle.properties:"
echo ""
echo " # For tests annotated with NeedsCdmUnitTest"
echo " systemProp.unidata.testdata.path=${FULL_TEST_DATA_PATH}"
echo ""
echo "2. Set the location from the command line when running gradle for a single test:"
echo ""
echo " ./gradlew -D\"unidata.testdata.path\"=${FULL_TEST_DATA_PATH} :cdm-test:test --tests ucar.nc2.ft.coverage.TestCoverageCurvilinear"
echo ""
echo "Happy Testing!"
echo ""