bloaty_misc_test.cc
Go to the documentation of this file.
1 // Copyright 2016 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "test.h"
16 
17 TEST_F(BloatyTest, NoSections) {
18  RunBloaty({"bloaty", "01-no-sections.bin"});
19 }
20 
21 TEST_F(BloatyTest, SectionCountOverflow) {
22  RunBloaty({"bloaty", "02-section-count-overflow.o"});
23 }
24 
25 TEST_F(BloatyTest, InlinesOnSmallFile) {
26  RunBloaty(
27  {"bloaty", "-d", "compileunits", "03-small-binary-that-crashed-inlines.bin"});
28  RunBloaty(
29  {"bloaty", "-d", "inlines", "03-small-binary-that-crashed-inlines.bin"});
30  EXPECT_EQ(top_row_->vmsize, 2340);
31 }
32 
33 TEST_F(BloatyTest, GoBinary) {
34  RunBloaty(
35  {"bloaty", "-d", "compileunits", "04-go-binary-with-ref-addr.bin"});
36  RunBloaty(
37  {"bloaty", "-d", "inlines", "04-go-binary-with-ref-addr.bin"});
38 }
39 
40 TEST_F(BloatyTest, MultiThreaded) {
41  RunBloaty({"bloaty", "02-section-count-overflow.o"});
42  size_t file_size = top_row_->filesize;
43 
44  // Bloaty doesn't know or care that you are passing the same file multiple
45  // times.
46  std::vector<std::string> args{"bloaty"};
47  const int count = 100;
48  for (int i = 0; i < count; i++) {
49  args.push_back("02-section-count-overflow.o");
50  }
51  RunBloaty(args); // Heavily multithreaded test.
52  EXPECT_EQ(top_row_->filesize, file_size * 100);
53 }
bloaty::RunBloaty
void RunBloaty(const InputFileFactory &factory, const std::string &data_source)
Definition: fuzz_target.cc:44
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
BloatyTest
Definition: bloaty/tests/test.h:72
TEST_F
TEST_F(BloatyTest, NoSections)
Definition: bloaty_misc_test.cc:17
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
test.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:48