enable_asserts.py 993 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python
  2. #
  3. # Copyright (c) 2012 The Chromium Authors. All rights reserved.
  4. # Use of this source code is governed by a BSD-style license that can be
  5. # found in the LICENSE file.
  6. """Enables dalvik vm asserts in the android device."""
  7. from pylib import android_commands
  8. import optparse
  9. import sys
  10. def main(argv):
  11. option_parser = optparse.OptionParser()
  12. option_parser.add_option('--enable_asserts', dest='set_asserts',
  13. action='store_true', default=None,
  14. help='Sets the dalvik.vm.enableassertions property to "all"')
  15. option_parser.add_option('--disable_asserts', dest='set_asserts',
  16. action='store_false', default=None,
  17. help='Removes the dalvik.vm.enableassertions property')
  18. options, _ = option_parser.parse_args(argv)
  19. commands = android_commands.AndroidCommands()
  20. if options.set_asserts != None:
  21. if commands.SetJavaAssertsEnabled(options.set_asserts):
  22. commands.Reboot(full_reboot=False)
  23. if __name__ == '__main__':
  24. main(sys.argv)