[ObjC] Run ios perf test from bazel (#31019)

* run ios CronetTest from bazel

* run ios perf test from bazel

* ci fix

Co-authored-by: Denny C. Dai <dennycd@me.com>
pull/31451/head
Hannah Shi 2 years ago committed by GitHub
parent 16b8386467
commit c7a2fc8e75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 46
      src/objective-c/tests/BUILD
  2. 3
      src/objective-c/tests/PerfTests/PerfTests.m
  3. 14
      src/objective-c/tests/run_one_test.sh
  4. 1
      tools/internal_ci/macos/grpc_objc_bazel_test.sh
  5. 15
      tools/run_tests/run_tests.py

@ -193,6 +193,35 @@ grpc_objc_testing_library(
],
)
grpc_objc_testing_library(
name = "PerfTests-lib-Posix",
srcs = [
"ConfigureCronet.m",
"PerfTests/PerfTests.m",
"PerfTests/PerfTestsBlockCallbacks.m",
"PerfTests/PerfTestsNoCFStreamSSL.m",
],
hdrs = ["ConfigureCronet.h"] + glob(["PerfTests/*.h"]),
deps = [
"//src/objective-c:grpc_objc_client_core_cronet_testing",
],
)
grpc_objc_testing_library(
name = "PerfTests-lib",
srcs = [
"ConfigureCronet.m",
"PerfTests/PerfTests.m",
"PerfTests/PerfTestsBlockCallbacks.m",
"PerfTests/PerfTestsCFStreamSSL.m",
"PerfTests/PerfTestsCronet.m",
],
hdrs = ["ConfigureCronet.h"] + glob(["PerfTests/*.h"]),
deps = [
"//src/objective-c:grpc_objc_client_core_cronet_testing",
],
)
grpc_objc_testing_library(
name = "UnitTests",
deps = [
@ -234,6 +263,23 @@ grpc_objc_ios_unit_test(
],
)
grpc_objc_ios_unit_test(
name = "PerfTestsPosix",
deps = [
"PerfTests-lib-Posix",
],
)
grpc_objc_ios_unit_test(
name = "PerfTests",
env = {
"GRPC_CFSTREAM_RUN_LOOP": "1",
},
deps = [
"PerfTests-lib",
],
)
macos_unit_test(
name = "MacTests",
minimum_os_version = "10.10",

@ -359,7 +359,8 @@ extern const char *kCFStreamVarName;
NSMutableArray<NSString *> *addrs = [NSMutableArray arrayWithCapacity:kNumAddrs];
NSMutableArray<RMTTestService *> *services = [NSMutableArray arrayWithCapacity:kNumAddrs];
for (int i = 0; i < kNumAddrs; ++i) {
addrs[i] = [NSString stringWithFormat:@"127.0.0.%d", (i + 1)];
// http://readme.localtest.me/
addrs[i] = [NSString stringWithFormat:@"%d.localtest.me", (i + 1)];
NSString *hostWithPort = [NSString stringWithFormat:@"%@:%@", addrs[i], port];
services[i] = [RMTTestService serviceWithHost:hostWithPort];
}

@ -45,21 +45,7 @@ TLS_PORT=$(curl localhost:32766/get)
$INTEROP --port=$PLAIN_PORT --max_send_message_size=8388608 &
$INTEROP --port=$TLS_PORT --max_send_message_size=8388608 --use_tls &
# Create loopback aliases for iOS performance tests
if [ $SCHEME == PerfTests ] || [ $SCHEME == PerfTestsPosix ]; then
for ((i=2;i<11;i++))
do
sudo ifconfig lo0 alias 127.0.0.$i up
done
fi
function finish {
if [ $SCHEME == PerfTests ] || [ $SCHEME == PerfTestsPosix ]; then
for ((i=2;i<11;i++))
do
sudo ifconfig lo0 -alias 127.0.0.$i
done
fi
kill -9 `jobs -p`
echo "EXIT TIME: $(date)"
}

@ -57,6 +57,7 @@ TEST_TARGETS=(
//src/objective-c/tests:MacTests
//src/objective-c/tests:UnitTests
//src/objective-c/tests:CronetTests
//src/objective-c/tests:PerfTests
//src/objective-c/tests:tvtests_build_test
# codegen plugin tests
//src/objective-c/tests:objc_codegen_plugin_test

@ -1014,21 +1014,6 @@ class ObjCLanguage(object):
shortname='ios-test-cfstream-tests',
cpu_cost=1e6,
environ=_FORCE_ENVIRON_FOR_WRAPPERS))
# TODO(jtattermusch): Create bazel target for the test and remove the test from here.
out.append(
self.config.job_spec(['src/objective-c/tests/run_one_test.sh'],
timeout_seconds=30 * 60,
shortname='ios-perf-test',
cpu_cost=1e6,
environ={'SCHEME': 'PerfTests'}))
# TODO(jtattermusch): Clarify what's the difference between PerfTests and PerfTestsPosix
# TODO(jtattermusch): Create bazel target for the test and remove the test from here.
out.append(
self.config.job_spec(['src/objective-c/tests/run_one_test.sh'],
timeout_seconds=30 * 60,
shortname='ios-perf-test-posix',
cpu_cost=1e6,
environ={'SCHEME': 'PerfTestsPosix'}))
# TODO(jtattermusch): Create bazel target for the test (how does one add the cronet dependency in bazel?)
# TODO(jtattermusch): move the test out of the test/cpp/ios directory?
out.append(

Loading…
Cancel
Save