run-allocation-counter-tests.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # Copyright 2021, gRPC Authors All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # This script was adapted from SwiftNIO's 'run-nio-alloc-counter-tests.sh'
  16. # script. The license for the original work is reproduced below. See NOTICES.txt
  17. # for more.
  18. ##===----------------------------------------------------------------------===##
  19. ##
  20. ## This source file is part of the SwiftNIO open source project
  21. ##
  22. ## Copyright (c) 2019 Apple Inc. and the SwiftNIO project authors
  23. ## Licensed under Apache License v2.0
  24. ##
  25. ## See LICENSE.txt for license information
  26. ## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
  27. ##
  28. ## SPDX-License-Identifier: Apache-2.0
  29. ##
  30. ##===----------------------------------------------------------------------===##
  31. set -eu
  32. here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  33. tmp_dir="/tmp"
  34. while getopts "t:" opt; do
  35. case "$opt" in
  36. t)
  37. tmp_dir="$OPTARG"
  38. ;;
  39. *)
  40. exit 1
  41. ;;
  42. esac
  43. done
  44. nio_checkout=$(mktemp -d "$tmp_dir/.swift-nio_XXXXXX")
  45. (
  46. cd "$nio_checkout"
  47. git clone --depth 1 https://github.com/apple/swift-nio
  48. )
  49. shift $((OPTIND-1))
  50. tests_to_run=("$here"/test_*.swift)
  51. if [[ $# -gt 0 ]]; then
  52. tests_to_run=("$@")
  53. fi
  54. # We symlink in a bunch of components from the GRPCPerformanceTests target to
  55. # avoid duplicating a bunch of code.
  56. "$nio_checkout/swift-nio/IntegrationTests/allocation-counter-tests-framework/run-allocation-counter.sh" \
  57. -p "$here/../../.." \
  58. -m GRPC \
  59. -t "$tmp_dir" \
  60. -s "$here/shared/Common.swift" \
  61. -s "$here/shared/Benchmark.swift" \
  62. -s "$here/shared/echo.pb.swift" \
  63. -s "$here/shared/echo.grpc.swift" \
  64. -s "$here/shared/MinimalEchoProvider.swift" \
  65. -s "$here/shared/EmbeddedServer.swift" \
  66. "${tests_to_run[@]}"