mirror of
https://github.com/servo/servo.git
synced 2025-09-23 05:10:09 +01:00
Auto merge of #25239 - marmeladema:issue-23607/test-tidy-no-wpt, r=jdm
Make `mach test-tidy --no-wpt` compatible with Python3 Make `mach test-tidy --no-wpt` compatible with Python3 See also #23607 After this pull request, all python files (except WPT) will be checked for Python3 syntax compatibility. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
b3b72cb9e3
12 changed files with 118 additions and 107 deletions
|
@ -4,6 +4,8 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
from os import path
|
||||
|
@ -12,6 +14,7 @@ import datetime
|
|||
import argparse
|
||||
import platform
|
||||
import subprocess
|
||||
import six
|
||||
|
||||
TOP_DIR = path.join("..", "..")
|
||||
GUARD_TIME = 10
|
||||
|
@ -133,7 +136,7 @@ def execute(base_dir, build_target, renderer, page, profile, trial, layout_threa
|
|||
log_dir = path.join(base_dir, "logs_l" + str(layout_thread_count),
|
||||
"trial_" + str(trial))
|
||||
if os.path.exists(log_dir):
|
||||
print "Log directory already exists: " + log_dir
|
||||
print("Log directory already exists: " + log_dir)
|
||||
sys.exit(1)
|
||||
os.makedirs(log_dir)
|
||||
|
||||
|
@ -142,16 +145,16 @@ def execute(base_dir, build_target, renderer, page, profile, trial, layout_threa
|
|||
|
||||
# Execute
|
||||
start_energy_reader()
|
||||
print 'sleep ' + str(GUARD_TIME)
|
||||
print('sleep ' + str(GUARD_TIME))
|
||||
time.sleep(GUARD_TIME)
|
||||
time_start = time.time()
|
||||
energy_start = read_energy()
|
||||
print cmd
|
||||
print(cmd)
|
||||
os.system(cmd)
|
||||
energy_end = read_energy()
|
||||
time_end = time.time()
|
||||
stop_energy_reader()
|
||||
print 'sleep ' + str(GUARD_TIME)
|
||||
print('sleep ' + str(GUARD_TIME))
|
||||
time.sleep(GUARD_TIME)
|
||||
|
||||
uj = energy_end - energy_start
|
||||
|
@ -172,11 +175,11 @@ def execute(base_dir, build_target, renderer, page, profile, trial, layout_threa
|
|||
f.write("\nPower (W): " + str(watts))
|
||||
|
||||
|
||||
def characterize(build_target, base_dir, (min_layout_threads, max_layout_threads), renderer, page, profile, trials):
|
||||
def characterize(build_target, base_dir, layout_threads_limits, renderer, page, profile, trials):
|
||||
"""Run all configurations and capture results.
|
||||
"""
|
||||
for layout_thread_count in xrange(min_layout_threads, max_layout_threads + 1):
|
||||
for trial in xrange(1, trials + 1):
|
||||
for layout_thread_count in six.moves.xrange(layout_threads_limits[0], layout_threads_limits[1] + 1):
|
||||
for trial in six.moves.xrange(1, trials + 1):
|
||||
execute(base_dir, build_target, renderer, page, profile, trial, layout_thread_count)
|
||||
|
||||
|
||||
|
@ -250,7 +253,7 @@ def main():
|
|||
trials = args.trials
|
||||
|
||||
if os.path.exists(output_dir):
|
||||
print "Output directory already exists: " + output_dir
|
||||
print("Output directory already exists: " + output_dir)
|
||||
sys.exit(1)
|
||||
os.makedirs(output_dir)
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
from os import path
|
||||
|
@ -43,15 +45,15 @@ def execute(base_dir, renderer, page, profile, trial, layout_thread_count):
|
|||
log_dir = path.join(base_dir, "logs_l" + str(layout_thread_count),
|
||||
"trial_" + str(trial))
|
||||
if os.path.exists(log_dir):
|
||||
print "Log directory already exists: " + log_dir
|
||||
print("Log directory already exists: " + log_dir)
|
||||
sys.exit(1)
|
||||
os.makedirs(log_dir)
|
||||
|
||||
# Execute
|
||||
cmd = get_command(layout_thread_count, renderer, page, profile)
|
||||
print cmd
|
||||
print(cmd)
|
||||
os.system(cmd)
|
||||
print 'sleep ' + str(GUARD_TIME)
|
||||
print('sleep ' + str(GUARD_TIME))
|
||||
time.sleep(GUARD_TIME)
|
||||
|
||||
# Write a file that describes this execution
|
||||
|
@ -109,7 +111,7 @@ def main():
|
|||
profile = args.profile
|
||||
|
||||
if os.path.exists(output_dir):
|
||||
print "Output directory already exists: " + output_dir
|
||||
print("Output directory already exists: " + output_dir)
|
||||
sys.exit(1)
|
||||
os.makedirs(output_dir)
|
||||
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import os
|
||||
from os import path
|
||||
import six
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
|
@ -196,7 +199,7 @@ def plot_trial_time_series(config, trial, trial_data, max_end_time, max_power, o
|
|||
|
||||
i = 10
|
||||
for (p, ts, te, es, ee) in trial_data:
|
||||
xranges = [(ts[j] / 1000000.0, (te[j] - ts[j]) / 1000000.0) for j in xrange(len(ts))]
|
||||
xranges = [(ts[j] / 1000000.0, (te[j] - ts[j]) / 1000000.0) for j in six.moves.xrange(len(ts))]
|
||||
ax1.broken_barh(xranges, (i - 0.5 * width, width))
|
||||
i += 10
|
||||
# place a vbar at the final time for this trial
|
||||
|
@ -385,20 +388,20 @@ def main():
|
|||
android = args.android
|
||||
|
||||
if not os.path.exists(directory):
|
||||
print "Input directory does not exist: " + directory
|
||||
print("Input directory does not exist: " + directory)
|
||||
sys.exit(1)
|
||||
|
||||
if os.path.exists(output_dir):
|
||||
print "Output directory already exists: " + output_dir
|
||||
print("Output directory already exists: " + output_dir)
|
||||
sys.exit(1)
|
||||
|
||||
res = process_logs(directory)
|
||||
|
||||
if not android:
|
||||
best = find_best_executions(directory)
|
||||
print 'Best time:', best[0]
|
||||
print 'Best energy:', best[1]
|
||||
print 'Best power:', best[2]
|
||||
print('Best time:', best[0])
|
||||
print('Best energy:', best[1])
|
||||
print('Best power:', best[2])
|
||||
|
||||
os.makedirs(output_dir)
|
||||
plot_all_raw_totals(res, output_dir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue