| 1 |
#!/usr/bin/env bash |
| 2 |
# update_spec_tests spec |
| 3 |
# This script is used to fetch the latest tests for the given spec. It puts the tests in the |
| 4 |
# directory data/[specname]. It should be run from the root of the repository. |
| 5 |
|
| 6 |
set -o errexit |
| 7 |
set -o nounset |
| 8 |
|
| 9 |
if [ ! -d ".git" ]; then |
| 10 |
echo "$0: This script must be run from the root of the repository" >&2 |
| 11 |
exit 1 |
| 12 |
fi |
| 13 |
|
| 14 |
if [ $# -ne 1 ]; then |
| 15 |
echo "$0: This script must be passed exactly one argument for which tests to sync" >&2 |
| 16 |
exit 1 |
| 17 |
fi |
| 18 |
|
| 19 |
tmpdir=`perl -MFile::Temp=tempdir -wle 'print tempdir(TMPDIR => 1, CLEANUP => 0)'` |
| 20 |
curl -sL https://github.com/mongodb/specifications/archive/master.zip -o "$tmpdir/specs.zip" |
| 21 |
unzip -d "$tmpdir" "$tmpdir/specs.zip" > /dev/null |
| 22 |
mkdir -p "data/$1" |
| 23 |
rsync -ah "$tmpdir/specifications-master/source/$1/tests/" "data/$1" |
| 24 |
rm -rf "$tmpdir" |