summaryrefslogtreecommitdiff
path: root/cmds/incidentd/tests/Section_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* incidentd can now handle multiple callers asking it for incident reportsJoe Onorato2019-03-261-107/+113
| | | | | | Test: bit incident_test:* GtsIncidentManagerTestCases:* Bug: 123543706 Change-Id: I9f671dd5d8b2ad139f952a23e575c2be16120459
* Remove the IncidentHeaderProto dependency from statsd.Yao Chen2019-02-071-3/+19
| | | | | | | | | + IncidentReportArgs takes the bytes instead of IncidentHeaderProto object This cl is the ag/6287053 + build fix. Test: incidentd_test && statsd_test Change-Id: I86bcb48f4ab212b36ca4611a1fa05faace9c3702
* Treating all FileSection files as device specific.Kweku Adams2018-06-131-4/+4
| | | | | | | | | | | | Arc++ devices don't have the /d/wakeup_sources file. There's a chance other device won't have it either, and there may be other files that we thought were standard but are actually not, so it's safer to just assume that not every file will be available on every device and not treat a missing file as an error. Bug: 110109543 Test: atest incidentd_test Change-Id: Ief09427f08d18aee611d057ddafdb9a3466744db
* Add a section flag to bypass failure if a specific path can't be found.Yi Jin2018-05-011-1/+9
| | | | | | | | | | | | This is a temporary solution to bypass failure of reading cpu info or battery type in P if the path doesn't exist on some devices. See bug for details. However in Q, incidentd should implement reading from the common Linux kernel interfaces. Bug: 78028767 Bug: 78239764 Test: atest incidentd_test Change-Id: I08ffcb21709efe5478d2ac46121deb5795af1024
* Fix incidentd skip collecting timedout of a section.Yi Jin2018-04-161-0/+4
| | | | | | | | | By moving the section stats collection before any return statements, it won't missing stats collection. Bug: 77962855 Test: atest incidentd_test Change-Id: I0900556428c51636e24df48a407eb916ccff795c
* Use modern c++ code style for incidentd.Yi Jin2018-03-301-18/+19
| | | | | | | | This cl does not contain code logic changes. Bug: 77333635 Test: manual and incidentd_test Change-Id: Iea0a402b1051defd45159ca267e6dd705f9ffa49
* Enable Last Kmsg, also fix the GZipSection test.Yi Jin2018-03-291-5/+16
| | | | | | Bug: 73354384, 76208934 Test: atest incidentd_test and manual as well Change-Id: I074027f4d972686ae3e9415b50e4d3967f6a2355
* Found out it is not possible to exec procrank as non-root/shell.Yi Jin2018-03-271-4/+4
| | | | | | | | | | | But it is ok to disable procrank since the information can be obtain via dumpsys meminfo Optimize the code style a bit. Bug: 72510307 Test: atest incidentd_test Change-Id: If06201aa708461b569d9fb007f20d1e51342d5c2
* Optimize incidentd memory usageYi Jin2018-03-071-2/+15
| | | | | | | | | 1. Remove dependency of libprotobuf-cpp-lite, saves .so mmap ~200KB 2. Don't use auto except iterator for readability. Bug: 74254200 Test: adb shell dumpsys meminfo `pid incidentd` Change-Id: If6198521c3b80929d6ea3f7ed466b5195991ccfd
* Implement a new section to attach LAST_KMSG to incident reportYi Jin2018-02-271-60/+68
| | | | | | | | | | | This section simply gzip a large file and stores result in GZippedFileProto This greatly improves the size, before gzip, the last kmsg size ~500KB, after gzip the proto size is ~60KB. Bug: 73354384 Test: atest incidentd_test and manual on device test Change-Id: I9bfc2cf07384487671edbffb5f0bd8495608fea6
* Throttler for incidentd based on size putting into dropbox.Yi Jin2018-02-201-0/+1
| | | | | | | | | | The incidentd will accumulate the total size put into dropbox and once it exceeds a threshold (currently 20MB) daily, it will stop further requests. It allows collection again 24 hours later. Bug: 64219725 Test: atest incidentd_test and manually flashed incidentd and test. Change-Id: Iea21fbae40d5d01108797b190231d73e74eff213
* This cl formats incidentd and makes it easier for debugging.Yi Jin2018-02-151-13/+13
| | | | | | Bug: 72755317 Test: clang-format -type=file -i <files> Change-Id: Ide91227f26c6b1db6d2e5fe8117ca5cc4cf77fd3
* Put metadata or stats into each dropbox incident report.Yi Jin2018-02-141-6/+23
| | | | | | Bug: 65451198 Test: atest incidentd_test Change-Id: Ib406b177ad7f1b4bda7fef2e606fc66a9836e060
* Add more information to incident header. Especially add config keysYi Jin2018-01-211-11/+7
| | | | | | | | | | | | | | | | to check if the report is uploadable. Move incidentheader.proto to libincident so statds is able to include a lite proto class for incident header. Change IncidentReportArgs to add the proto object instead of serialized bytes to prevent caller gives meaningless data. Bug: 70241842 Test: push config to statsd and verify incidentd generate the report with correct header. Change-Id: If95b655be71047b019b229e5903a08f3c21a1f29
* Implement a new type of section which reads from logd and dumps proto.Yi Jin2018-01-061-1/+21
| | | | | | | | | | And implement a file section which reads from event-log-tags for decoding binary logs. Bug: 70936599 Test: atest incidentd_test && atest incident_helper_test and flush on device and test log sections and event_log_tag_map Change-Id: Ib3d35e317f355de69f01ded012482486e9a43da6
* 1. Implement Privacy Policy Tag InheritanceYi Jin2017-12-011-2/+2
| | | | | | | | | | | | 2. Expose Dest values in IIncidentReportArgs.h Please see bug for detail descriptions. Bug: 67869340 Test: unit tested and on-device test. Ran command: $ out/host/linux-x86/bin/incident-section-gen incidentd to test various of privacy taggings. Change-Id: I12af3d7da4c7c72bd63598893fe2c1f70b09baa4
* Remove unnecessary parameter WriteStringToFileWei Wang2017-11-101-6/+6
| | | | | | | | By default, WriteStringToFile will not follow link, the 'false' parameter is unnecessary. Test: build Change-Id: Ied6dcbf2a85533108dc2f6d71a4571b44684e800
* Extract IncidentHeaderProto to a separated file for statsd to consumeYi Jin2017-09-071-1/+39
| | | | | | | | Create a HeaderSection to deal with header protos which is more testable Bug: 65422268 Test: unit tested Change-Id: Icdcbeded8bc963940a8f9e503cb65a9a247ca5b2
* Implement Pii Stripper Part 3Yi Jin2017-09-071-0/+130
| | | | | | | | | | The incident request args sets privacy spec. Strip action is optimized to run once for each type of spec and ready for flush multiple times. Incident command is updated to take -p option to specify privacy spec. Bug: 64687253 Test: unit tests written, manually run incident command to test as well Change-Id: I6753df117f76dc1a5f4d2152baa3fbbf56b490e4
* Implement PII Stripper, part 2Yi Jin2017-09-071-22/+32
| | | | | | | | | | | | | | | | | | Implement EncodedBuffer that strip pii based on given privacy request. The reason to implement another buffer is the length-delimited field's size could change when its submessage gets stripped. It also intends to keep the orignal data around for other requests to consume it. In addition, the section implementation has adapted EncodedBuffer so write out to each request's fd could be request-specific. The next step is allow requests to set its privacy spec. Notice the current design set the privacy spec of dropbox to AUTOMATIC, this behavior might change in the future. Bug: 64687253 Test: unit tests are writtern, see README.md for how to run unit tests. Change-Id: I7ac236b8265ba9289dc6e17a8a5bf7f67ffb6bf5
* This cl implements CommandSection and use it to add procrank.proto SectionYi Jin2017-08-021-1/+52
| | | | | | | | | Bug: 63863444 Test: manual - create gtests for CommandSection and Procrank Parser following instructions in the README.md of incidentd and incident_helper on how to run them. Change-Id: I099808fd13bf9ed9a564b122f1126b1691a83291
* This cl does the following things:Yi Jin2017-07-241-0/+68
0) Implements a skeleton of incident_helper 1) Implements FileSection class which calls incident_helper to parse file content to protobuf 2) Adds Kernel Wake Sources to incident.proto and makes it parsed by FileSection 3) Adds basic gtests to test FdBuffer, io_utils, FileSection implementation Bug: 62923266 Bug: 62926061 Test: manual - push incidentd, incident_helper and incident to my device and verify kernel wakeup sources file is able to be parsed. Change-Id: I2aa6b6158d962ce70e6fa6c8a9c42213a45ff41c