|
2 | 2 | set -eu
|
3 | 3 |
|
4 | 4 | SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0})
|
5 |
| -ROOT_DIR="$(dirname "$(dirname $SCRIPT_DIR)")" |
| 5 | +SCRIPT_DIR="$( cd -- "$SCRIPT_DIR" > /dev/null 2>&1 && pwd )" |
| 6 | +ROOT_DIR="$(dirname $SCRIPT_DIR)" |
6 | 7 |
|
7 |
| -export PIP_QUIET=1 # Quiet by default |
8 |
| -export PIP_PREFER_BINARY=1 # Prefer binary dists by default |
9 |
| -export UV_FROZEN=1 # Do not modify lock files |
| 8 | +pushd $ROOT_DIR |
10 | 9 |
|
11 | 10 | # Try to source the env file.
|
12 | 11 | if [ -f $SCRIPT_DIR/scripts/env.sh ]; then
|
|
16 | 15 | echo "Not sourcing env inputs"
|
17 | 16 | fi
|
18 | 17 |
|
19 |
| -# Ensure there are test inputs. |
| 18 | +# Handle test inputs. |
20 | 19 | if [ -f $SCRIPT_DIR/scripts/test-env.sh ]; then
|
21 | 20 | echo "Sourcing test inputs"
|
22 | 21 | . $SCRIPT_DIR/scripts/test-env.sh
|
23 | 22 | else
|
24 |
| - echo "Missing test inputs, please run 'just setup-test'" |
| 23 | + echo "Missing test inputs, please run 'just setup-tests'" |
| 24 | + exit 1 |
25 | 25 | fi
|
26 | 26 |
|
27 | 27 | # Source the local secrets export file if available.
|
28 |
| -if [ -f "$ROOT_DIR/secrets-export.sh" ]; then |
29 |
| - . "$ROOT_DIR/secrets-export.sh" |
| 28 | +if [ -f "./secrets-export.sh" ]; then |
| 29 | + . "./secrets-export.sh" |
30 | 30 | fi
|
31 | 31 |
|
32 |
| -PYTHON_IMPL=$(uv run python -c "import platform; print(platform.python_implementation())") |
33 |
| - |
34 |
| -# Ensure C extensions if applicable. |
35 |
| -if [ -z "${NO_EXT:-}" ] && [ "$PYTHON_IMPL" = "CPython" ]; then |
36 |
| - uv run --frozen tools/fail_if_no_c.py |
37 |
| -fi |
38 |
| - |
39 |
| -if [ -n "${PYMONGOCRYPT_LIB:-}" ]; then |
40 |
| - # Ensure pymongocrypt is working properly. |
41 |
| - # shellcheck disable=SC2048 |
42 |
| - uv run ${UV_ARGS} python -c "import pymongocrypt; print('pymongocrypt version: '+pymongocrypt.__version__)" |
43 |
| - # shellcheck disable=SC2048 |
44 |
| - uv run ${UV_ARGS} python -c "import pymongocrypt; print('libmongocrypt version: '+pymongocrypt.libmongocrypt_version())" |
45 |
| - # PATH is updated by configure-env.sh for access to mongocryptd. |
46 |
| -fi |
47 |
| - |
48 |
| -PYTHON_IMPL=$(uv run python -c "import platform; print(platform.python_implementation())") |
49 |
| -echo "Running ${AUTH:-noauth} tests over ${SSL:-nossl} with python $(uv python find)" |
50 |
| -uv run python -c 'import sys; print(sys.version)' |
51 |
| - |
52 |
| -# Show the installed packages |
53 |
| -# shellcheck disable=SC2048 |
| 32 | +# List the packages. |
54 | 33 | PIP_QUIET=0 uv run ${UV_ARGS} --with pip pip list
|
55 | 34 |
|
56 |
| -# Record the start time for a perf test. |
57 |
| -if [ -n "${PERF_TEST:-}" ]; then |
58 |
| - start_time=$(date +%s) |
59 |
| -fi |
| 35 | +# Start the test runner. |
| 36 | +uv run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@" |
60 | 37 |
|
61 |
| -# Run the tests, and store the results in Evergreen compatible XUnit XML |
62 |
| -# files in the xunit-results/ directory. |
63 |
| -TEST_ARGS=${TEST_ARGS} |
64 |
| -if [ "$#" -ne 0 ]; then |
65 |
| - TEST_ARGS="$*" |
66 |
| -fi |
67 |
| -echo "Running tests with $TEST_ARGS and uv args $UV_ARGS..." |
68 |
| -if [ -z "${GREEN_FRAMEWORK:-}" ]; then |
69 |
| - # shellcheck disable=SC2048 |
70 |
| - uv run ${UV_ARGS} pytest $TEST_ARGS |
71 |
| -else |
72 |
| - # shellcheck disable=SC2048 |
73 |
| - uv run ${UV_ARGS} green_framework_test.py $GREEN_FRAMEWORK -v $TEST_ARGS |
74 |
| -fi |
75 |
| -echo "Running tests with $TEST_ARGS... done." |
76 |
| - |
77 |
| -# Handle perf test post actions. |
78 |
| -if [ -n "${PERF_TEST:-}" ]; then |
79 |
| - end_time=$(date +%s) |
80 |
| - elapsed_secs=$((end_time-start_time)) |
81 |
| - |
82 |
| - cat results.json |
83 |
| - |
84 |
| - echo "{\"failures\": 0, \"results\": [{\"status\": \"pass\", \"exit_code\": 0, \"test_file\": \"BenchMarkTests\", \"start\": $start_time, \"end\": $end_time, \"elapsed\": $elapsed_secs}]}" > report.json |
85 |
| - |
86 |
| - cat report.json |
87 |
| -fi |
88 |
| - |
89 |
| -# Handle coverage post actions. |
90 |
| -if [ -n "${COVERAGE:-}" ]; then |
91 |
| - rm -rf .pytest_cache |
92 |
| -fi |
| 38 | +popd |
0 commit comments