Example #1
0
def get_all_optimized_tests(cwd=None):
  test_targets = process_util.run_cmd_get_output(
      [
          "blaze", "query",
          "filter('%s', %s)" %
          (OBFUSCATED_OPT_TEST_PATTERN % ".*", TEST_TARGET_PATTERN)
      ],
      cwd=cwd).split("\n")
  return filter(bool, test_targets)
Example #2
0
def diff_target(get_target):
  """Diffs j2size repo and current CL for the output."""

  if len(sys.argv) != 2:
    print "must pass the name of the test to diff as an argument"
    return

  test_name = sys.argv[1]
  js_target = get_target(test_name)
  js_file_path = get_file_from_target(js_target)

  print "Constructing a diff of JS changes in '%s'." % test_name

  print ("  blaze building JS for '%s' in the j2size repo" %
         test_name)
  sync_j2size_repo()
  build_tests([js_target], get_j2size_repo_path())

  print "    formatting JS"
  orig_js_file = "/tmp/orig.%s.js" % test_name
  shutil.copyfile(get_j2size_repo_path() + "/" + js_file_path, orig_js_file)
  process_util.run_cmd_get_output(["clang-format", "-i", orig_js_file])

  print ("  blaze building JS for '%s' in the live repo" %
         test_name)
  build_tests([js_target])

  print "    formatting JS"
  modified_js_file = "/tmp/modified.%s.js" % test_name
  shutil.copyfile(js_file_path, modified_js_file)
  process_util.run_cmd_get_output(["clang-format", "-i", modified_js_file])

  print "  starting meld"
  process_util.run_cmd_get_output(["meld", orig_js_file, modified_js_file])

  print "  done"
Example #3
0
def sync_j2size_repo():
  process_util.run_cmd_get_output(
      [INTEGRATION_ROOT + "sync_j2size_repo.sh"])
Example #4
0
def get_minimized_size(js_file):
  """Runs the given file through J2clMinifier."""
  minified = process_util.run_cmd_get_output(
      ["blaze", "run", J2CL_MINIFER, "--", os.path.abspath(js_file)])
  return len(minified)
Example #5
0
def build_tests(test_targets, cwd=None):
  """Blaze builds all integration tests in parallel."""
  process_util.run_cmd_get_output(
      ["blaze", "build"] + test_targets,
      cwd=cwd)