Browse Source

Add allocation counting tests (#1150)

Motivation:

Memory allocations are a useful tool when evaluating performance. As
such it's useful to have a framework where tests can run continually and
be checked against an expected limit.

Modifications:

There are three groups of related changes in this PR.

First, shuffling existing performance test code so that it may be used
with NIOs allocation counting test framework. This includes dropping the
dependency on the 'EchoModel' target and symlinking in the generated
protobuf and gRPC code services instead. Some of the benchmark code was
split into separate files as well (we'll symlink some code to the
allocation counting test). The 'Benchmark' protocol for the tests now
returns an 'Int' from the 'run' function (a requirement of the NIO
allocation counting test framework).

Second, the addition of various scripts to run allocation counting
tests. These were lifted from SwiftNIO and slightly modified to fit our
use case. As such a NOTICES.txt was also added. Three tests were also
added which make use of code from the existing performance tests. The
shared code is symlinked in (to avoid adding an additional library
product to the package).

Third, the Travis configuration was updated to run the tests on 5.2 and
5.3 on Linux only. A script was also added to parse the output from
running tests and produce an allocation limit.

Result:

We can track our allocation counts.
George Barnett 4 năm trước cách đây
mục cha
commit
3d5ed4355e
1 tập tin đã thay đổi với 27 bổ sung0 xóa
  1. 27 0
      NOTICES.txt

+ 27 - 0
NOTICES.txt

@@ -0,0 +1,27 @@
+                          The gRPC Swift Project
+                          ======================
+
+Copyright 2021 The gRPC Swift Project
+
+The gRPC Swift project licenses this file to you 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:
+
+  https://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.
+
+-------------------------------------------------------------------------------
+
+This product uses scripts derived from SwiftNIO's integration testing
+framework: 'test_01_allocation_counts.sh', 'run-nio-alloc-counter-tests.sh' and
+'test_functions.sh'.
+
+  * LICENSE (Apache License 2.0):
+    * https://github.com/apple/swift-nio/blob/main/LICENSE.txt
+  * HOMEPAGE:
+    * https://github.com/apple/swift-nio