...

Text file src/go.mongodb.org/mongo-driver/etc/update_spec_tests.sh

Documentation: go.mongodb.org/mongo-driver/etc

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

View as plain text