#!/usr/bin/env bash

fail_count=0
max_tries=100
for i in $(seq 1 $max_tries)
do
  bazel clean
  bazel --nohome_rc --nosystem_rc test --config=clang --compilation_mode=fastbuild --workspace_status_command=/bin/true --local_execution_slots=64 --jobs=64  --nobuild_runfile_links --test_timeout=360,600,900,1800 --test_tag_filters=-manual,-flaky,-exclusive,-exclude-from-pre-merge //firmware/common/nanopb/test:nanopb_any_test || fail_count=$((fail_count + 1))
done
echo "Failed $fail_count times out of $max_tries"
