Skip to content

Commit e9f0ddb

Browse files
jonsimantova-maurice
authored andcommitted
Fixed Blastdoor to work with Python 3, and added tests for demangling to
ensure subprocess I/O works correctly, and renaming symbols in files. Python3 fix includes no longer using poll() for input (the blocking read() works just fine as long as you check for exceptions) and handling binary vs. non-binary strings properly. Also a few small fixes in build_mpms that make it easier to test merge_libraries: - Now exits properly if postprocessing a library fails. - Added a -B option so you can laBel the resulting MPM with a different label than the one in Rapid. This ensures that if you are using build_mpms.sh -b '--fetch_mpms=...' to fetch a subset of MPMs, you don't need to use the same label for your output MPM as the input MPM, so you don't pollute the normal label namespace. PiperOrigin-RevId: 288805974
1 parent f5138d9 commit e9f0ddb

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

merge_libraries_test_file.cc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright 2020 Google LLC
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+
*/
16+
17+
/* This is a test file for merge_libraries.py tests. It contains some C and C++
18+
* symbols that merge_libraries can rename. */
19+
20+
extern "C" {
21+
int test_symbol(void) { return 1; } // NOLINT
22+
23+
int test_another_symbol(void) { return 2; } // NOLINT
24+
25+
int test_yet_one_more_symbol(void) { return 3; } // NOLINT
26+
27+
int global_c_symbol = 789; // NOLINT
28+
29+
extern int not_in_this_file(); // NOLINT
30+
}
31+
32+
namespace test_namespace {
33+
34+
class TestClass {
35+
public:
36+
TestClass();
37+
int TestMethod();
38+
int TestMethodNotInThisfile();
39+
int TestStaticMethod();
40+
int TestStaticMethodNotInThisFile();
41+
static int test_static_field; // NOLINT
42+
};
43+
44+
int global_cpp_symbol = 12345; // NOLINT
45+
46+
int TestClass::test_static_field;
47+
48+
TestClass::TestClass() {}
49+
50+
int TestClass::TestMethod() { return not_in_this_file(); }
51+
52+
int TestClass::TestStaticMethod() { return TestStaticMethodNotInThisFile(); }
53+
54+
} // namespace test_namespace

0 commit comments

Comments
 (0)