summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-10-19 19:15:14 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-10-20 01:19:59 -0400
commit00884d7164ce7322b9e627051b65887f9f2c817d (patch)
treebf645634ae263a338e334a1748d3bb0c1f9d092b /tools
parent09e011b3890af1525f27b788da63b09d8e874604 (diff)
Add rustfmt to third_party.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/format.py8
-rwxr-xr-xtools/http_benchmark.py7
-rw-r--r--tools/util.py4
3 files changed, 11 insertions, 8 deletions
diff --git a/tools/format.py b/tools/format.py
index cf03ccca3..0dc100b9f 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -3,7 +3,7 @@
from glob import glob
import os
from third_party import third_party_path, fix_symlinks, google_env, clang_format_path
-from util import root_path, run, find_exts
+from util import root_path, run, find_exts, platform
fix_symlinks()
@@ -39,5 +39,7 @@ run(["node", prettier, "--write"] +
find_exts("website/", ".js", ".ts", ".md"))
# yapf: enable
-# Requires rustfmt 0.8.2 (flags were different in previous versions)
-run(["rustfmt", "--config-path", rustfmt_config] + find_exts("src/", ".rs"))
+run([
+ "third_party/rustfmt/" + platform() +
+ "/rustfmt", "--config-path", rustfmt_config
+] + find_exts("src/", ".rs"))
diff --git a/tools/http_benchmark.py b/tools/http_benchmark.py
index 58e9c279e..1fc78d31b 100755
--- a/tools/http_benchmark.py
+++ b/tools/http_benchmark.py
@@ -33,12 +33,9 @@ def run(server_cmd):
# Run deno echo server in the background.
server = subprocess.Popen(server_cmd)
time.sleep(5) # wait for server to wake up. TODO racy.
- wrk_platform = {
- "linux2": "linux",
- "darwin": "mac",
- }[sys.platform]
try:
- cmd = "third_party/wrk/" + wrk_platform + "/wrk -d " + DURATION + " http://" + ADDR + "/"
+ cmd = "third_party/wrk/%s/wrk -d %s http://%s/" % (util.platform(),
+ DURATION, ADDR)
print cmd
output = subprocess.check_output(cmd, shell=True)
req_per_sec = util.parse_wrk_output(output)
diff --git a/tools/util.py b/tools/util.py
index 10b6b9c6f..7b8b6f6e3 100644
--- a/tools/util.py
+++ b/tools/util.py
@@ -332,3 +332,7 @@ def parse_wrk_output(output):
if req_per_sec is None:
req_per_sec = extract_number(r'Requests/sec:\s+(\d+)', line)
return req_per_sec
+
+
+def platform():
+ return {"linux2": "linux", "darwin": "mac", "win32": "win"}[sys.platform]