-
Notifications
You must be signed in to change notification settings - Fork 18
/
run_fuzz_tests.sh
executable file
·65 lines (52 loc) · 1.7 KB
/
run_fuzz_tests.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
61
62
63
64
65
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
set -ex
DOCKER=${DOCKER:-0}
PLATFORM=virtual
wait_for_service() {
url=$1
timeout=120
while ! curl -s -f -k "$url" > /dev/null; do
echo "Waiting for service to be ready..."
sleep 1
timeout=$((timeout - 1))
if [ $timeout -eq 0 ]; then
echo "Service failed to become ready, exiting"
exit 1
fi
done
}
echo "Setting up python virtual environment."
if [ ! -f "venv/bin/activate" ]; then
python3.8 -m venv "venv"
fi
source venv/bin/activate
pip install --disable-pip-version-check -q -e ./pyscitt
pip install --disable-pip-version-check -q wheel
pip install --disable-pip-version-check -q -r test/requirements.txt
echo "Running fuzz tests..."
export CCF_HOST=${CCF_HOST:-"localhost"}
export CCF_PORT=${CCF_PORT:-8000}
export CCF_URL="https://${CCF_HOST}:${CCF_PORT}"
echo "Service URL: $CCF_URL"
if [ "$DOCKER" = "1" ]; then
echo "Will use a running docker instance for testing..."
PLATFORM=$PLATFORM ./docker/run-dev.sh &
CCF_NETWORK_PID=$!
trap "kill $CCF_NETWORK_PID" EXIT
wait_for_service "$CCF_URL/parameters"
else
echo "Will use a built SCITT binary for testing..."
PLATFORM=$PLATFORM ./start.sh &
# start script will launch cchost process
trap 'pkill -f cchost' EXIT
export CCF_URL="https://localhost:8000"
wait_for_service "$CCF_URL/node/network"
scitt governance local_development \
--url "$CCF_URL" \
--member-key workspace/member0_privk.pem \
--member-cert workspace/member0_cert.pem;
wait_for_service "$CCF_URL/parameters"
fi
python -m test.fuzz_api_submissions