Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
111 lines (98 loc) · 3.49 KB
/
Copy pathTaskfile.yml
File metadata and controls
111 lines (98 loc) · 3.49 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
104
105
106
107
108
109
110
111
# SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
# SPDX-License-Identifier: MIT
version: '3'
tasks:
interop:
desc: Run a Pion/dtls interop test
silent: true
env:
PION_DTLS_SOURCE: '{{.CLI_ARGS}}'
DTLS_INTEROP_RUNNER: '{{.RUNNER | default "all"}}'
cmds:
- |
set -eu
case "$DTLS_INTEROP_RUNNER" in
all) test_pattern='.' ;;
boringssl) test_pattern='^TestBoringSSL' ;;
wolfssl) test_pattern='^TestWolfSSL' ;;
openssl3) test_pattern='^TestOpenSSL3' ;;
openssl4) test_pattern='^TestOpenSSL4' ;;
pion-v3) test_pattern='^TestPionV3' ;;
pion-v4) test_pattern='^TestPionV4' ;;
mbedtls) test_pattern='^TestMbedTLS' ;;
anvil) test_pattern='^TestAnvil' ;;
*)
echo "unknown interop runner: $DTLS_INTEROP_RUNNER (expected all, boringssl, wolfssl, openssl3, openssl4, pion-v3, pion-v4, mbedtls, or anvil)" >&2
exit 1
;;
esac
case "$DTLS_INTEROP_RUNNER" in
all|anvil) set -- -count=1 ;;
*) set -- ;;
esac
source="$PION_DTLS_SOURCE"
if [ -z "$source" ]; then
exec go test -v -tags=interop -run "$test_pattern" "$@" ./...
fi
if [ -d "$source" ]; then
dtls_directory="$source"
else
case "$source" in
/*|..|../*|*/../*|*/..)
echo "pion/dtls ref is not a checkout directory: $source" >&2
exit 1
;;
esac
dtls_directory=".cache/pion-dtls/$source"
if [ ! -e "$dtls_directory" ]; then
task clone -- "$source" >/dev/null
elif [ ! -d "$dtls_directory" ]; then
echo "checkout path is not a directory: $dtls_directory" >&2
exit 1
fi
fi
project_directory="$(pwd -P)"
dtls_directory="$(cd "$dtls_directory" && pwd -P)"
dtls_module="$(GOWORK=off go -C "$dtls_directory" list -m)"
if [ "$dtls_module" != "github.com/pion/dtls/v4" ]; then
echo "expected github.com/pion/dtls/v4 checkout, got $dtls_module" >&2
exit 1
fi
workspace_directory="$(mktemp -d "${TMPDIR:-/tmp}/dtls-interop.XXXXXX")"
(
cd "$workspace_directory"
go work init "$project_directory" "$dtls_directory"
)
status=0
GOWORK="$workspace_directory/go.work" go test -v -tags=interop -run "$test_pattern" "$@" ./... || status=$?
rm -rf -- "$workspace_directory"
exit "$status"
clone:
desc: Clone a pion/dtls branch, tag, or commit into a new checkout
silent: true
env:
PION_DTLS_REF: '{{.CLI_ARGS}}'
cmds:
- |
set -eu
ref="$PION_DTLS_REF"
if [ -z "$ref" ]; then
echo "usage: task clone -- <branch, tag, or commit>" >&2
exit 1
fi
case "$ref" in
/*|..|../*|*/../*|*/..)
echo "invalid pion/dtls ref: $ref" >&2
exit 1
;;
esac
destination=".cache/pion-dtls/$ref"
if [ -e "$destination" ]; then
echo "checkout already exists: $destination" >&2
exit 1
fi
mkdir -p "$(dirname "$destination")"
git init --quiet "$destination"
git -C "$destination" fetch --quiet --depth=1 https://github.com/pion/dtls.git -- "$ref"
git -C "$destination" checkout --quiet --detach FETCH_HEAD
echo "PION_DTLS_DIR=$destination"