(unused_argv)
| 256 | |
| 257 | |
| 258 | def main(unused_argv): |
| 259 | before_file = to_absolute_path(flags.FLAGS.before) |
| 260 | after_file = to_absolute_path(flags.FLAGS.after) |
| 261 | input_type = flags.FLAGS.input_type |
| 262 | attrs = flags.FLAGS.attrs |
| 263 | max_mem_alloc_mb = flags.FLAGS.max_mem_alloc_mb |
| 264 | |
| 265 | # resource lib isn't available on Windows. |
| 266 | if os.name != "nt": |
| 267 | max_heap_bytes = max_mem_alloc_mb * 1024 * 1024 |
| 268 | resource.setrlimit(resource.RLIMIT_AS, (max_heap_bytes, max_heap_bytes)) |
| 269 | |
| 270 | before_proto = analysis_v2_pb2.ActionGraphContainer() |
| 271 | after_proto = analysis_v2_pb2.ActionGraphContainer() |
| 272 | try: |
| 273 | if input_type == "proto": |
| 274 | with open(before_file, "rb") as f: |
| 275 | before_proto.ParseFromString(f.read()) |
| 276 | with open(after_file, "rb") as f: |
| 277 | after_proto.ParseFromString(f.read()) |
| 278 | else: |
| 279 | with open(before_file, "r") as f: |
| 280 | before_text = f.read() |
| 281 | text_format.Merge(before_text, before_proto) |
| 282 | with open(after_file, "r") as f: |
| 283 | after_text = f.read() |
| 284 | text_format.Merge(after_text, after_proto) |
| 285 | |
| 286 | _aquery_diff(before_proto, after_proto, attrs, before_file, after_file) |
| 287 | except MemoryError: |
| 288 | print( |
| 289 | "aquery_differ is known to cause OOM issue with large inputs. More details: b/154620006.", |
| 290 | file=sys.stderr) |
| 291 | print( |
| 292 | "Max mem space of {}MB exceeded".format(max_mem_alloc_mb), |
| 293 | file=sys.stderr) |
| 294 | sys.exit(1) |
| 295 | |
| 296 | |
| 297 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected
searching dependent graphs…