-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2856 from fasaxc/combine-bpf-fvs
Combine bpf fvs
- Loading branch information
Showing
4 changed files
with
173 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (c) 2019 Tigera, Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
vm_name_prefix=$1 | ||
project=unique-caldron-775 | ||
zone=${ZONE:-europe-west3-c} | ||
my_dir="$(dirname $0)" | ||
repo_dir="." | ||
artifacts_dir="$repo_dir/artifacts" | ||
|
||
echo "Collecting artifacts..." | ||
|
||
num_fv_batches=${NUM_FV_BATCHES:-8} | ||
batches=(ut $(seq 1 ${num_fv_batches})) | ||
pids=() | ||
monitor_pids=() | ||
for batch in "${batches[@]}"; do | ||
vm_name="$vm_name_prefix$batch" | ||
echo "Collecting artifacts from $vm_name..." | ||
VM_NAME=$vm_name $my_dir/on-test-vm ${REPO_NAME}/.semaphore/collect-artifacts || echo "Failed to collect artifacts from ${vm_name}." | ||
gcloud --quiet compute scp "--zone=${ZONE}" "ubuntu@${vm_name}:${REPO_NAME}/artifacts" ./ --recurse || echo "Failed to SCP from ${vm_name}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (c) 2019 Tigera, Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
vm_name_prefix=$1 | ||
project=unique-caldron-775 | ||
zone=${ZONE:-europe-west3-c} | ||
my_dir="$(dirname $0)" | ||
repo_dir="." | ||
artifacts_dir="$repo_dir/artifacts" | ||
|
||
num_fv_batches=${NUM_FV_BATCHES:-8} | ||
batches=(ut $(seq 1 ${num_fv_batches})) | ||
pids=() | ||
for batch in "${batches[@]}"; do | ||
vm_name="$vm_name_prefix$batch" | ||
log_file="$artifacts_dir/create-vm-$batch.log" | ||
echo "Creating test VM $vm_name in background. Redirecting log to $log_file." | ||
"${my_dir}/create-test-vm" "$vm_name" >& "$log_file" & | ||
pids+=( $! ) | ||
sleep 1 | ||
done | ||
|
||
for pid in "${pids[@]}"; do | ||
echo "Waiting for create-test-vm process PID=$pid to finish" | ||
if ! wait "$pid"; then | ||
echo "Creating one of the test VMs failed, exiting. Logs should be attached as artifacts." | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo "All test VMs started." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (c) 2019 Tigera, Inc. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
vm_name_prefix=$1 | ||
project=unique-caldron-775 | ||
zone=${ZONE:-europe-west3-c} | ||
num_fv_batches=${NUM_FV_BATCHES:-8} | ||
batches=(ut $(seq 1 ${num_fv_batches})) | ||
my_dir="$(dirname $0)" | ||
repo_dir="." | ||
artifacts_dir="$repo_dir/artifacts" | ||
|
||
echo "Starting tests..." | ||
|
||
pids=() | ||
monitor_pids=() | ||
for batch in "${batches[@]}"; do | ||
vm_name="$vm_name_prefix$batch" | ||
log_file="$artifacts_dir/test-$batch.log" | ||
if [ $batch = "ut" ]; then | ||
echo "Starting UTs" | ||
VM_NAME=$vm_name $my_dir/on-test-vm make --directory=${REPO_NAME} ut-bpf check-wireguard >& "$log_file" & | ||
pid=$! | ||
pids+=( $pid ) | ||
echo "UT PID: $pid" | ||
else | ||
echo "Starting FV batch $batch" | ||
VM_NAME=$vm_name ./.semaphore/on-test-vm make --directory=${REPO_NAME} fv-bpf GINKGO_FOCUS=BPF-SAFE FV_NUM_BATCHES=8 FV_BATCHES_TO_RUN="$batch" >& "$log_file" & | ||
pid=$! | ||
pids+=( $pid ) | ||
echo "FV batch PID: $pid" | ||
fi | ||
|
||
prefix="[batch=${batch} pid=${pid}]" | ||
echo "$prefix Monitoring $log_file in background for Failure/Success messages..." | ||
( | ||
tail -f $log_file | grep --line-buffered \ | ||
-e "Failure" \ | ||
-e "SUCCESS" \ | ||
-e "Parallel test node" \ | ||
-e "Test batch" \ | ||
-C10 | sed 's/.*/'"${prefix}"' &/'; | ||
) & | ||
mon_pid=$! | ||
monitor_pids+=( $mon_pid ) | ||
done | ||
|
||
final_result=0 | ||
|
||
echo "Waiting for background test runners to finish..." | ||
for pid in "${pids[@]}"; do | ||
echo "Waiting for test process batch PID=$pid to finish" | ||
if wait "$pid"; then | ||
echo "Test batch succeeded PID=$pid." | ||
else | ||
echo "Test batch failed PID=$pid." | ||
final_result=1 | ||
fi | ||
done | ||
|
||
echo "Shutting down test monitors..." | ||
for pid in "${monitor_pids[@]}"; do | ||
kill $pid || true | ||
done | ||
echo "Done, exiting with RC=$final_result" | ||
|
||
exit $final_result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters