1*6777b538SAndroid Build Coastguard Worker# Private Code Test 2*6777b538SAndroid Build Coastguard Worker 3*6777b538SAndroid Build Coastguard WorkerThis directory provides a mechanism for testing that native does not link in 4*6777b538SAndroid Build Coastguard Workerobject files from unwanted directories. The test finds all linker inputs, and 5*6777b538SAndroid Build Coastguard Workerchecks that none live inside a list of internal paths. 6*6777b538SAndroid Build Coastguard Worker 7*6777b538SAndroid Build Coastguard WorkerOriginal bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1266989 8*6777b538SAndroid Build Coastguard Worker 9*6777b538SAndroid Build Coastguard Worker## Determining Internal Directories 10*6777b538SAndroid Build Coastguard Worker 11*6777b538SAndroid Build Coastguard WorkerThis is done by parsing the `.gclient_entries` file for all paths coming from 12*6777b538SAndroid Build Coastguard Workerhttps://chrome-internal.googlesource.com. I chose this approach since it is 13*6777b538SAndroid Build Coastguard Workersimple. 14*6777b538SAndroid Build Coastguard Worker 15*6777b538SAndroid Build Coastguard WorkerThe main alternative I found was to use `gclient flatten`. Example output: 16*6777b538SAndroid Build Coastguard Worker 17*6777b538SAndroid Build Coastguard Worker``` 18*6777b538SAndroid Build Coastguard Worker # src -> src/internal 19*6777b538SAndroid Build Coastguard Worker "src/internal": { 20*6777b538SAndroid Build Coastguard Worker "url": "https://chrome-internal.googlesource.com/chrome/src-internal.git@c649c6a155fe65c3730e2d663d7d2058d33bf1f9", 21*6777b538SAndroid Build Coastguard Worker "condition": 'checkout_src_internal', 22*6777b538SAndroid Build Coastguard Worker }, 23*6777b538SAndroid Build Coastguard Worker``` 24*6777b538SAndroid Build Coastguard Worker 25*6777b538SAndroid Build Coastguard Worker* Paths could be found in this way by looking for `checkout_src_internal` 26*6777b538SAndroid Build Coastguard Worker within `condition`, and by looking for the comment line for `recurse_deps` 27*6777b538SAndroid Build Coastguard Worker that went through an internal repo. 28*6777b538SAndroid Build Coastguard Worker 29*6777b538SAndroid Build Coastguard Worker## Determining Linker Inputs 30*6777b538SAndroid Build Coastguard Worker 31*6777b538SAndroid Build Coastguard WorkerThis is done by performing a custom link step with a linker that just records 32*6777b538SAndroid Build Coastguard Workerinputs. This seemed like the simplest approach. 33*6777b538SAndroid Build Coastguard Worker 34*6777b538SAndroid Build Coastguard WorkerTwo alternatives: 35*6777b538SAndroid Build Coastguard Worker1) Dump paths found in debug information. 36*6777b538SAndroid Build Coastguard Worker2) Scan a linker map file for input paths. 37